Software >> OS >> Unix >> Utilities >> vi >> What are the vi commands

<esc>i enters edit mode at current character <esc>a enters edit mode after current character <esc>v selects from current cursor to navigated endpt <esc>d delete what is selected by <esc>v <esc>x delete character at current cursor <esc>X delete character following cursor <esc>d0 delete to beginning of line <esc>db delete to beginning of word <esc>dd delete entire line to buffer <esc>Ndd delete N lines to buffer <esc>d( delete to beginning of sentence <esc>d) delete to end of sentence <esc>d{ delete to beginning of paragraph <esc>d} delete to end of paragraph <esc>d <Enter> delete current and following line <esc>dw delete entire word to buffer <esc>D delete line from current char <esc>p paste buffer after current position <esc>P paste buffer before current position <esc>:r <file> reads file <file> below current line <esc>:r ! cmd reads output of cmd below current line <esc>:w <file> writes to new file <file> <esc>:w writes to existing file <esc>0 moves to begin of line <esc>^ move to begin of line <esc>$ move to end of line <esc>b moves to begin of current word <esc>e moves to end of current word <esc>( moves to beginning of document <esc>) moves to end of document <esc>G moves to end of document (Linux Vim) <esc>gg moves to begin of document (Linux Vim) <esc>w moves to beginning of next word <esc>nG moves to beginning of line n <esc>H moves to beginning of current page <esc>G moves to last line in current file <esc>/string search next occurence of "string" <esc>?string search prev occurence of "string" <esc>n repeat last search <esc>N search next string in opposite direction <esc>/string\> search string by matching at the end of wds <esc>/string\< search string by matching at the begin of wds <esc>/s. search for s. where . is wildcard for 1 char <esc>. repeat last command <esc>/s[aei] search for sa, se, si <esc>u undo last command <esc>o add new line after current line <esc>O add new line before current line <esc>ZZ quit with save <esc>:wq <file> quit and save to file <file> <esc>:q! quit without save