VIM ref
by Gary Cheeseman gary.cheeseman.me.uk
This is my Neovim setup as at July 2017
Package management
For package management I’m using junegunn/vim-plug: Minimalist Vim Plugin Manager
Normal Mode
CTRL-a
add [COUNT] to the number or alphabetic characterCTRL-x
subtract [COUNT] to the number or alphabetic character
Bookmarks
I am using the kshenoy/vim-signature plugin for bookmarks
Normal mode
where
x
is a to zmx
Toggle mark ‘x’ and display it in the leftmost columndmx
Remove mark ‘x’ where x is a-zA-Zm,
Place the next available markm.
If no mark on line, place the next available mark. Otherwise, remove (first) existing mark.m-
Delete all marks from the current linem<Space>
Delete all marks from the current buffer]
` Jump to next mark[
` Jump to prev mark]'
Jump to start of next line containing a mark['
Jump to start of prev line containing a mark`
]
Jump by alphabetical order to next mark`
[
Jump by alphabetical order to prev mark']
Jump by alphabetical order to start of next line having a mark'[
Jump by alphabetical order to start of prev line having a markm/
Open location list and display marks from current buffer`m[0-9]
Toggle the corresponding marker !@#$%^&*()m<S-[0-9]>
Remove all markers of the same type]-
Jump to next line having a marker of the same type[-
Jump to prev line having a marker of the same type]=
Jump to next line having a marker of any type[=
Jump to prev line having a marker of any typem?
Open location list and display markers from current bufferm<BS>
Remove all markers
Comments
normal mode
<leader>c space
NERDComToggleComment<leader>cs
NERDComSexyComment<leader>cm
NERDComMinimalComment<leader>cc
NERDCommenterComment<leader>cn
NERDCommenterNested<leader>cu
NERDComUncommentLine
Buffers
command mode
:ls
list buffers:ls!
list buffers including hidden:b6
goto buffer6
:b [TAB]
goto buffer by name with auto-completion:b#
goto alternate buffer:bd
delete current buffer:bd 6
delete buffer6
:bd 6 23
delete buffers6
and23
:bd [TAB]
delete buffer by name can do multiple:22,27bd
delete a range of buffers:%bd
delete entire range all buffers:bd!
adding a bang will delete the buffer even if changed!:bf
goto the first buffer in the list:bn
goto the next buffer in the list:bp
goto the previous buffer in the list:bm
goto the next modified buffer in the list:bl
goto the last buffer in the list:sb 6
split window and goto buffer6
s
:sbn
split window and goto next buffer works with many above
Windows
command mode
:sp
split window:vsp
vertical split window:sp [TAB]
split window and open a file with auto-completion:vsp [TAB]
vertical split window and open a file
normal mode
CTRL-wx
exchange windowsCTRL-wv
split window verticallyCTRL-wc
close the focused windowCTRL-wo
make the focused window the only windowCTRL-wp
focus on previous windowCTRL-w CTRL-w
cycle round windowsCTRL-w[hjkl]
focus on different windowsCTRL-w[HRJL]
move window position- a count can be user with above eg.
3<CTRL>wj
Insert Mode
insert mode
CTRL-w
delete previous workCTRL-t
shift line rightCTRL-d
shift line left
completions
CTRL-n
next completionCTRL-p
previous completionCTRL-e
abort completionCTRL-y
stop completion and accept the currently selected entry
insert_expand mode
CTRL-X enters insert_expand mode
CTRL-x CTRL-e
scroll window one line upCTRL-x CTRL-y
scroll window one line down
completions
CTRL-x CTRL-l
complete lineCTRL-x CTRL-n
search forwards for keywordCTRL-x CTRL-p
search backwards for keywordCTRL-x CTRL-]
search for tagCTRL-x CTRL-v
search for Vim commandsCTRL-x CTRL-s
spelling for word before cursor
Sessions
command mode
:mks [FILENAME]
save session to file:mks! [FILENAME]
save session to existing file:source [FILENAME]
reload session
Ultisnips
insert mode
trigger then [TAB]
to expand the snippetCRTL-j
to move forward through placeholdersCRTL-k
to move backward through placeholdersCRTL-[TAB]
list snippets
EasyMotion
normal mode
<Leader><Leader>f{char}
Find {char} to the right.<Leader><Leader>F{char}
Find {char} to the left.<Leader><Leader>t{char}
Till before the {char} to the right.<Leader><Leader>T{char}
Till after the {char} to the left.<leader><leader>w
beginning of word forward<leader><leader>W
beginning of WORD forward<leader><leader>b
beginning of word backward<leader><leader>B
beginning of WORD backward<leader><leader>e
end of word forward<leader><leader>E
end of WORD forward<leader><leader>ge
end of word backward<leader><leader>gE
end of WORD backward<leader><leader>j
line downward<leader><leader>k
line upward
Emmet
all modes
<C-e><C-e>
expand coding
Vim folding commands
zf#j
creates a fold from the cursor down # lines.zf/string
creates a fold from the cursor to string.zj
moves the cursor to the next fold.zk
moves the cursor to the previous fold.zo
opens a fold at the cursor.zO
opens all folds at the cursor.zm
increases the foldlevel by one.zM
closes all open folds.zr
decreases the foldlevel by one.zR
decreases the foldlevel to zero – all folds will be open.zd
deletes the fold at the cursor.zE
deletes all folds.[z
move to start of open fold.]z
move to end of open fold.
Scratch area
div>ul>ul
sudo synclient touchpadoff=1
No comments:
Post a Comment