MOVING THE CURSOR: k - cursor up ^F - page forward / - search forward j - cursor down ^B - page backward ? - search backward h - cursor left w - move forward a "word" n - repeat the last search l - cursor right b - move backward a "word" ENTERING TEXT: a - append after the cursor. Use the key to return to i - insert before the cursor. command mode. o - open a new line below the cursor. O - open new line above the cursor. WRITING AND EXITING: :w - write the file :q - exit the file :q! - exit without writing the file :# - move to a line (e.g., :35 moves to line 35) MISCELLANEOUS: ^G - display the file name J - join two lines (use i to split a line) u - undo the last change (enter . after a 'u' to undo more than one change) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= VI COMMANDS: ^A search forward for cursor word ^B scroll up by screens ^C interrupt an operation (e.g. read, write, search) ^D scroll down by half screens (setting count) ^E scroll down by lines ^F scroll down by screens ^G file status ^H move left by characters ^J move down by lines ^L redraw screen ^M move down by lines (to first non-blank) ^N move down by lines ^P move up by lines ^R redraw screen ^T tag pop ^U half page up (set count) ^V input a literal character ^W move to next screen ^Y page up by lines ^Z suspend editor ^[ exit input mode, cancel partial commands ^\ switch to ex mode ^] tag push cursor word ^^ switch to previous file move right by columns ! filter through command(s) to motion # number increment/decrement $ move to last column % move to match & repeat substitution ' move to mark (to first non-blank) ( move back sentence ) move forward sentence + move down by lines (to first non-blank) , reverse last F, f, T or t search - move up by lines (to first non-blank) . repeat the last command / search forward 0 move to first character : ex command ; repeat last F, f, T or t search < shift lines left to motion > shift lines right to motion ? search backward @ execute buffer A append to the line B move back bigword C change to end-of-line D delete to end-of-line E move to end of bigword F character in line backward search G move to line H move to count lines from screen top I insert before first nonblank J join lines L move to screen bottom M move to screen middle N reverse last search O insert above line P insert before cursor from buffer Q switch to ex mode R replace characters S substitute for the line(s) T before character in line backward search U Restore the current line W move to next bigword X delete character before cursor Y copy line ZZ save file and exit [[ move back section ]] move forward section ^ move to first non-blank _ move to first non-blank ` move to mark a append after cursor b move back word c change to motion d delete to motion e move to end of word f character in line forward search h move left by columns i insert before cursor j move down by lines k move up by lines l move right by columns m set mark n repeat last search o append after line p insert after cursor from buffer r replace character s substitute character t before character in line forward search u undo last change w move to next word x delete character y copy text to motion into a cut buffer z reposition the screen { move back paragraph | move to column } move forward paragraph ~ reverse case =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= EX COMMANDS: ^D: scroll lines !: filter lines through commands or run commands #: display numbered lines &: repeat the last substitution *: execute a buffer <: shift lines left =: display line number >: shift lines right @: execute a buffer append: append input to a line abbreviate: specify an input abbreviation args: display file argument list bg: background the current screen change: change lines to input cd: change the current directory chdir: change the current directory copy: copy lines elsewhere in the file delete: delete lines from the file display: display buffers, screens or tags [Ee]dit: begin editing another file [Ee]x: begin editing another file exusage: display ex command usage statement file: display (and optionally set) file name fg: switch the current screen and a backgrounded screen global: execute a global command on lines matching an RE help: display help statement insert: insert input before a line join: join lines into a single line k: mark a line position list: display lines in an unambiguous form move: move lines elsewhere in the file mark: mark a line position map: map input or commands to one or more keys mkexrc: write a .exrc file [Nn]ext: edit (and optionally specify) the next file number: change display to number lines open: enter "open" mode (not implemented) print: display lines preserve: preserve an edit session for recovery [Pp]revious: edit the previous file in the file argument list put: append a cut buffer to the line quit: exit ex/vi read: append input from a command or file to the line recover: recover a saved file resize: grow or shrink the current screen rewind: re-edit all the files in the file argument list s: substitute on lines matching an RE script: run a shell in a screen set: set options (use ":set all" to see all options) shell: suspend editing and run a shell source: read a file of ex commands stop: suspend the edit session suspend: suspend the edit session t: copy lines elsewhere in the file [Tt]ag: edit the file containing the tag tagnext: move to the next tag tagpop: return to the previous group of tags tagprev: move to the previous tag tagtop: discard all tags undo: undo the most recent change unabbreviate: delete an abbreviation unmap: delete an input or command map v: execute a global command on lines NOT matching an RE version: display the program version information visual: enter visual (vi) mode from ex mode [Vv]isual: edit another file (from vi mode only) viusage: display vi key usage statement write: write the file wn: write the file and switch to the next file wq: write the file and exit xit: exit yank: copy lines to a cut buffer z: display different screens of the file ~: replace previous RE with previous replacement string, =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Edit options: noaltwerase filec="" nomodeline scroll=17 notildeop autoindent flash msgcat="./" nosearchincr timeout autoprint hardtabs=0 noprint="" nosecure nottywerase noautowrite noiclower nonumber shiftwidth=8 noverbose backup="" noignorecase nooctal noshowmatch warn nobeautify keytime=6 open noshowmode window=35 cedit="" noleftright optimize sidescroll=16 nowindowname columns=80 lines=36 print="" noslowopen wraplen=0 comment nolisp prompt nosourceany wrapmargin=0 noedcompatible nolist readonly tabstop=8 wrapscan escapetime=1 lock noredraw taglength=0 nowriteany noerrorbells magic remap tags="tags" exrc matchtime=7 report=5 term="xterm" noextended mesg ruler noterse cdpath="/usr/src/local/nvi:/tmp" directory="/tmp" paragraphs="IPLPPPQPP LIpplpipbp" recdir="/var/tmp/vi.recover" sections="NHSHH HUnhsh" shell="/bin/csh" shellmeta="~{[*?$`'"\"