Tip for VIM
For splitting window.
: split ( for horizontal split )
: vsplit ( for vertical split )
Switch between splitted window
Ctrl-ww
Resize splitted window
Ctrl-w + / - ( 1 unit each time, height )
10 Ctrl-w + ( resize 10 unit height )
Ctrl-w < / > ( 1 unit each time, width )
Search and replace
:%s/original/replace/g ( every occur in file )
:1,$s/original/replace/
:s/original/replace/g ( replace all in current line )
For multiple files
:e ( edit file in new buffer )
:bn ( switch to next file in buffer )
:bp ( switch to previous file in buffer )
:bd ( delete file in buffer , ake close file )
:sp ( edit file in new window )
ETC
:sh ( switch to console ) and Ctrl-d to get back
other way
Ctrl-z (switch to console ) and $fg to get back
show path of current editing file
Ctrl-g ( display file's location )
Ctrl 1 g (display full file's location )
: split ( for horizontal split )
: vsplit ( for vertical split )
Switch between splitted window
Ctrl-ww
Resize splitted window
Ctrl-w + / - ( 1 unit each time, height )
10 Ctrl-w + ( resize 10 unit height )
Ctrl-w < / > ( 1 unit each time, width )
Search and replace
:%s/original/replace/g ( every occur in file )
:1,$s/original/replace/
:s/original/replace/g ( replace all in current line )
For multiple files
:e
:bn ( switch to next file in buffer )
:bp ( switch to previous file in buffer )
:bd ( delete file in buffer , ake close file )
:sp
ETC
:sh ( switch to console ) and Ctrl-d to get back
other way
Ctrl-z (switch to console ) and $fg to get back
show path of current editing file
Ctrl-g ( display file's location )
Ctrl 1 g (display full file's location )
Comments
Post a Comment