Skip to content

Latest commit

 

History

History
435 lines (367 loc) · 29.3 KB

tutorial.md

File metadata and controls

435 lines (367 loc) · 29.3 KB

ThinkVim Tutorial

Structure

The structure of Thinkvim ‼️

User Custom

User custom folder ~/.thinkvim.d,notice the folder must be in your root path ~,in this folder you should touch two files local_plugins.yaml and local_settings.vim

How to Install plugins?

I suggest that most of plugins should lazyload by dein ,There has two ways to install plugins.

  • if you are a vim begginer or you want to follow master branch,you should use local_plugins.yaml. like you want use choosewin plugin,you can installed it in local_plugins.yaml(notice thinkvim has installed ,just for example)
- repo: t9md/vim-choosewin
  on_map: { n: <Plug> }
  hook_source: source  $VIM_PATH/core/layers/tools/choosewin/config.vim
  • repo means github repo
  • on_map is a dein lazyload feature,that mean the plugin will loading when you trigger on_map key,
  • hook_source is executed before plugins are sourced

Dein is hard to use for some vim begginers,you can check the core/dein/plugins.yaml for use. more useage about Dein.

  • if you have vimscript skill and not a vim beginner, want change this config to your own config ,you can edit the core/dein/plugins.yaml.

the keymap of plugins you should config it in local_settings.vim,th same as installed plugins,if you want follow master branch use local_settings.vim,if you want change to your own config you can edit the core/plugins/allkey.vim.

example:

if dein#tap('vim-choosewin')
	nmap -         <Plug>(choosewin)
	nmap <Leader>- :<C-u>ChooseWinSwapStay<CR>
endif
  • If you want to disable some of the plugins I use, you can overwrite them, e.g.:
- { repo: tryu/caw.vim, if: 0 }
  • Your plugin shortcuts should also be based on this format. used if dein#tap('pluginname')
  • Notice ‼️ the lazyload feature of dein will not loading the default config of plugins, so you should config the keymap of lazyload plugins

register the local_settings keymap to whichkey, there are two settings map.

let g:which_key_map   for leaderkey
let g:which_key_localmap  for localkey

example:

if dein#tap('defx.nvim')
         nnoremap <silent> <Leader>F
                \ :<C-u>Defx -search=`expand('%:p')` `getcwd()`<CR>
endif
let g:which_key_map.F='test'
  • if you edit the plugins.yaml ,it doesn't work. you can try to recache the cache. use this function call dein#recache_runtimepath(), or use thinkvim menu ;+m trigger menu,then choose dein,and choose ReacheRuntimePath

How to install or change colorscheme

  • ThinkVim provide a easy way to change colorscheme, use this keymap Leader+fc then thinkvim will write the colorscheme that your choose into cache file,ThinkVim will read this file to load colorscheme when next startup

  • Add your favorite coloscheme file into colors folder

How to use the spaceline

check out the spaceline config

How to set the Startify

Startify can only set the header and footer centered,set this let g:startify_padding_left = 40 into your local_settings.vim,change the value until the file area centered on your screen

How to config completion

More about Coc❤️ , thinkvim is centered on coc with coc-extensions,so you should learn more about coc and coc-extensions

Coc Extensions

Extensions are more powerful than a configured language server. Check out Using coc extensions.

Plus more! To get a full list of coc extensions, search coc.nvim on npm, or use coc-marketplace, which can search and install extensions in coc.nvim directly.

Note: use :CocConfig to edit the configuration file. Completion & validation are supported after coc-json is installed. ThinkVim has installed some cocextensions you can check it in pluginDetail

KeyMap

  • Default leader SPACE localleader; ,The vim keymap in mappings.vim,Plugins keymap in core/plugins/allkey.vim
  • Insertkey like emacs
  • if you find the keymap doesn't work , Or the keymap doesn't show in this keylist but in allkey.vim ,you can create a issue. Welcome PR.
Operation👈 Click

Keys Mode Description
Ctrl + w Insert delete the whole word
Ctrl + h Insert delete BackSpace
Ctrl + d Insert delete a single char
Ctrl + u Insert delete to the beginning of the line
Ctrl + b Insert move left
Ctrl + f Insert move right
Ctrl + a Insert move the head of line
Ctrl + e Insert move the end of line
Ctrl + p Command move up
Ctrl + b Command move left
Ctrl + f Command move right
Ctrl + a Command move the head of line
Ctrl + e Command move the end of line
Ctrl + d Command move the cursors char
Ctrl + h Command delete BackSpace
Ctrl + S Insert save
Ctrl + Q Insert save and exit
Ctrl + o Insert create a new line
] + b Normal pre buffer
[ + b Normal next buffer
Ctrl + x Normal delete buffer
Y Normal copy utils the end
j Normal gj
k Normal gk
j Visual gj
k Visual gj
- Normal ChooseWin
, + Space Normal Delete trailing spaces
[ + a Normal Ale next
] + a Normal Ale pre
[ + c Normal coc next
] + c Normal coc prev
] + ] Normal jump to prev go func
[ + [ Normal jump to next go func
g + c Normal caw.vim comment
g + c + c Normal caw.vim uncomment
g + a Normal EasyAlign
g + a Visual EasyAlign
s + a Normal vim-sandwich prefix +{iw/is/ip}+{i/f/t}
s + d Normal vim-sandwich prefix +{iw/is/ip}+{i/f/t}
s + r Normal vim-sandwich prefix +{iw/is/ip}+{i/f/t}
s + d + b Normal vim-sandwich prefix +{iw/is/ip}+{i/f/t}
s + r + b Normal vim-sandwich prefix +{iw/is/ip}+{i/f/t}
v Visual vim-expand-region
V Visual vim-expand-region
z + l Normal Denite Outline for golang
z + T Normal Denite Goroot for golang

Window👈 Click

Keys Mode Description
Ctrl + h Normal move to left window
Ctrl + l Normal move to right window
Ctrl + j Normal move to down window
Ctrl + k Normal move to up window
Ctrl + w + [ Normal the width of window reduce 3
Ctrl + w + ] Normal the width of window increase 3
Ctrl + f Normal Window scrolling down
Ctrl + b Normal Window scrolling up
Ctrl + d Normal Window scrolls down half a screen
Ctrl + u Normal Window scrolls up half a screen

Tab👈 Click

Keys Mode Description
Leader + t + n Normal create tab
Leader + t + e Normal edit tab
Leader + t + m Normal move tab

LeaderKey👈 Click

Keys Mode Description
Leader + number Normal number[0-9] choose buffer
Leader + c + a Normal CocDiagnostics
Leader + c + c Normal CocCommands
Leader + c + e Normal CocExtensions
Leader + c + j Normal Cocnext
Leader + c + k Normal CocPrev
Leader + c + o Normal CocOutline
Leader + c + r Normal CocResume
Leader + c + s Normal CocIsymbols
Leader + G Normal open Goyo
Leader + m Normal open mundo
Leader + w Normal save file
Leader + - Normal ChooseWin
Leader + s Normal open Startify
Leader + d Normal open Dash
Leader + p Normal Edit the file which in plugins folder
Leader + c + f Normal coc Format
Leader + f + c Normal fzf chage vim colorscheme
Leader + f + f Normal fzf find files
Leader + f + r Normal fzf rg search
Leader + f + v Normal fzf Vista Finder
Leader + f + b Normal fzf find buffer
Leader + f + w Normal fzf rg search the cursor word
Leader + f + g + c Normal fzf gitcommits
Leader + f + b + c Normal fzf gitbcommits
Leader + Leader + w Normal Easymotion jump to donw
Leader + Leader + b Normal Easymotion jump to up
Leader + Leader + f Normal Easymotion search for jump
Leader + g + d Normal Gdiff
Leader + g + c Normal Gcommit
Leader + g + b Normal Gblame
Leader + g + B Normal GBrowse
Leader + g + S Normal GStatus
Leader + g + p Normal Git push
Leader + g + l Normal Denite show all git log
Leader + g + h Normal Denite show git branch

LocalLeaderKey👈 Click

Keys Mode Description
LocalLeader + t Normal Open Tagbar
LocalLeader + r Normal QuickRun
LocalLeader + v Normal Open Vista
LocalLeader + gi Normal vim-go GoImpl
LocalLeader + gd Normal vim-go GoDescribe
LocalLeader + gc Normal vim-go GoCallees
LocalLeader + gC Normal vim-go GoCallers
LocalLeader + gs Normal vim-go GoCallstack

Denite👈 Click

Keys Mode Description
LocalLeader + m Normal Denite Menu
<CR> Denite Doaction
i Denite Open filter buffer
d Denite Delete
p Denite Preview
s + t Denite tabopen
s + v Denite Vsplit
s + i Denite Split
' Denite QuickMove
q Denite Quit
r Denite RedRaw
y + y Denite Yank
Esc Denite Quit
Ctrl + u Denite Restore Source
Ctrl + f Denite call Defx
Ctrl + x Denite Choose Action
Space Denite Toggle Select
Esc Denite Filter Quit
q Denite Filter Quit
Ctrl + c Denite Filter Quit filter
k + k Denite Filter insert move window
k + k Denite Filter normal move window
j + j Denite Filter insert move window
j + j Denite Filter normal move window

Fzf👈 Click

Keys Mode Description
C-X Normal tab split
C-v Normal split
C-t Normal vsplit
C-d Normal pagedown
C-u Normal pageup

Defx👈 Click

Keys Mode Description
Leader + e Normal open defx
N Defx touch new file
K Defx touch new folder
<CR> Defx open file or folder
l Defx open file or folder
d + d Defx delete (Send2Trash required)
r Defx rename
. Defx show ignore files
h Defx Return to the parent directory
q Defx exit defx
s Defx Open in rightwindow vs
i Defx Open file sp
y + y Defx copy the path of file
</kbd> Defx show the path of file
c Defx copy
m Defx move
p Defx paste
Space Defx multi
g + f Defx open in denite
g + r Defx search in denite
w Defx increase the width

CoC👈 Click

Keys Mode Description
Tab Select Jump
Tab Insert completion donw
Shit + Tab Insert completion up
Ctrl + n Insert completion down
Ctrl + p Insert completion up
Ctrl + Space Normal Forced trigger completion
<CR> Insert/Select Confirm
K Normal Show the function doc
g + d Normal jump to defined
g + y Normal coc-type-definition
g + i Normal coc-implementation
g + r Normal coc-references
[ + g Normal coc-git-prechunk
] + g Normal coc-git-nextchunk