Mode
-
Column edit mode:
Ctrl + vswitch column edit mode (visual block) , use ‘up’ and ‘down’ to choose column,Iswitch to insert mode, edit thenEsc -
Insert Mode:
-
Normal Mode:
-
View Mode:
vin normal mode to switch to visual mode
Moving Around
motion
-
gggo to the top of the file,Ggo to the bottom of the file ,zzmake the current line to the center. -
{&}move by paragraph -
(&),[&]move by parentesis and square bracket -
vf_&vt_move to the next_, first one will include search key and second one will stop before the key -
-Go to first non-space character in last line,+in next line
Mapping
nmap <C + L> : <C + W> <C + L>AutoScript
TBCProductive
-
%s\old\new\gglobal replace,%s\old\new\gcreplace with confirmation -
the silver searchandag-vimcould help to search keyword in vim, it’s much faster than thegrepconfigure:
usage:
:Ag KEY_WORD ./**/*.php -
YouCompleteMe
Plugin
-
Pathogen use
git clonecommand to get the source code -
Vunble use .vimrc to config and run
:PluginInstall -
Some useful plugins: ctrlP, nerdtree, airline, syntastic
Multple File Editing
-
:vspslip screen vertically -
ctrl + wandctrl + hswap the slip, so we could add mapping like this: -
:bn,:bp,:b1,:b2,:b3change buffer -
ctrl + ^swap buffer -
Open multiple files
$ vim *.php-
plugin
nerdtree: help to show files in folders -
plugin
controlPhelp to quick search by file name -
plugin
airlinehelp to organize tab -
plugin
vinegarhelp you to get files in current directory
Linting
-
plugin
Syntastichelp to manager the linting checker -
:SyntasticCheckenable the linting -
:SyntasticToggleswitch from the passive and active mode -
:SyntasticInfocheck the current checkers.
Appendix
My config files on Gist.