
Frequent used vi commands.
Line Navigation
k= upj= downl= righth= left0= go to the starting of the current line$= go to the end of the current line
Word Navigation
e= go to the end of the current wordb= go to the previous (before) wordw= go to the next word.
Screen Navigation
H= Go to the first line of current screenM= Go to the middle line of current screenL= Go to the last line of current screenctrl+f= Jump forward one full screen.ctrl+b= Jump backwards one full screenctrl+d= Jump forward (down) a half screenctrl+u= Jump back (up) one half screengg= Go to the beginning of the fileG= Go to the end of the fileNG= Go to the Nth line of the file
Undo/Redo
u= undoCtr+r= redo
Editing
x= delete chardd= delete and copy the current lineyy= copy the linep= pasteo= add a new line belowO= add a new line above
Search & Replace
/pattern= search for patternn= go to next pattern,shift+n= go to previous pattern
:%s/foo/bar/gc- change each
footobarbut ask for confirmation first
- change each
Setting
:set tabstop=2= change tab to 2 space:set nu= enable line numbers along the left side of window:set nonu= disabling line numbers:set paste= avoid unexpected effects for copy and paste




近期评论