Home | History | Annotate | Line # | Download | only in docs
      1 MOVING THE CURSOR:
      2  k - cursor up    ^F - page forward	       /<pattern><CR> - search forward
      3  j - cursor down  ^B - page backward	       ?<pattern><CR> - search backward
      4  h - cursor left   w - move forward a "word"   n - repeat the last search
      5  l - cursor right  b - move backward a "word"
      6 
      7 ENTERING TEXT:
      8 a - append after the cursor.             Use the <escape> key to return to
      9 i - insert before the cursor.            command mode.
     10 o - open a new line below the cursor.
     11 O - open new line above the cursor.
     12 
     13 WRITING AND EXITING:
     14 :w<Enter>  - write the file
     15 :q<Enter>  - exit the file
     16 :q!<Enter> - exit without writing the file
     17 :#<Enter>  - move to a line (e.g., :35<Enter> moves to line 35)
     18 
     19 MISCELLANEOUS:
     20 ^G - display the file name
     21  J - join two lines (use i<Enter><escape> to split a line)
     22  u - undo the last change (enter . after a 'u' to undo more than one change)
     23 
     24 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     25 VI COMMANDS:
     26 	^A search forward for cursor word
     27 	^B scroll up by screens
     28 	^C interrupt an operation (e.g. read, write, search)
     29 	^D scroll down by half screens (setting count)
     30 	^E scroll down by lines
     31 	^F scroll down by screens
     32 	^G file status 
     33 	^H move left by characters
     34 	^J move down by lines
     35 	^L redraw screen
     36 	^M move down by lines (to first non-blank)
     37 	^N move down by lines 
     38 	^P move up by lines   
     39 	^R redraw screen
     40 	^T tag pop
     41 	^U half page up (set count)
     42 	^V input a literal character
     43 	^W move to next screen
     44 	^Y page up by lines
     45 	^Z suspend editor
     46 	^[ <escape> exit input mode, cancel partial commands
     47 	^\ switch to ex mode
     48 	^] tag push cursor word
     49 	^^ switch to previous file
     50    <space> move right by columns
     51 	 ! filter through command(s) to motion
     52 	 # number increment/decrement
     53 	 $ move to last column
     54 	 % move to match
     55 	 & repeat substitution
     56 	 ' move to mark (to first non-blank)
     57 	 ( move back sentence
     58 	 ) move forward sentence
     59 	 + move down by lines (to first non-blank)
     60 	 , reverse last F, f, T or t search
     61 	 - move up by lines (to first non-blank)
     62 	 . repeat the last command
     63 	 / search forward
     64 	 0 move to first character
     65 	 : ex command
     66 	 ; repeat last F, f, T or t search
     67 	 < shift lines left to motion
     68 	 > shift lines right to motion
     69 	 ? search backward
     70 	 @ execute buffer
     71 	 A append to the line
     72 	 B move back bigword
     73 	 C change to end-of-line
     74 	 D delete to end-of-line
     75 	 E move to end of bigword
     76 	 F character in line backward search
     77 	 G move to line
     78 	 H move to count lines from screen top
     79 	 I insert before first nonblank
     80 	 J join lines
     81 	 L move to screen bottom
     82 	 M move to screen middle
     83 	 N reverse last search
     84 	 O insert above line
     85 	 P insert before cursor from buffer
     86 	 Q switch to ex mode
     87 	 R replace characters
     88 	 S substitute for the line(s)
     89 	 T before character in line backward search
     90 	 U Restore the current line
     91 	 W move to next bigword
     92 	 X delete character before cursor
     93 	 Y copy line
     94 	ZZ save file and exit
     95 	[[ move back section
     96 	]] move forward section
     97 	 ^ move to first non-blank
     98 	 _ move to first non-blank
     99 	 ` move to mark
    100 	 a append after cursor
    101 	 b move back word
    102 	 c change to motion
    103 	 d delete to motion
    104 	 e move to end of word
    105 	 f character in line forward search
    106 	 h move left by columns
    107 	 i insert before cursor
    108 	 j move down by lines
    109 	 k move up by lines
    110 	 l move right by columns
    111 	 m set mark
    112 	 n repeat last search
    113 	 o append after line
    114 	 p insert after cursor from buffer
    115 	 r replace character
    116 	 s substitute character
    117 	 t before character in line forward search
    118 	 u undo last change
    119 	 w move to next word
    120 	 x delete character
    121 	 y copy text to motion into a cut buffer
    122 	 z reposition the screen
    123 	 { move back paragraph
    124 	 | move to column
    125 	 } move forward paragraph
    126 	 ~ reverse case
    127 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    128 EX COMMANDS:
    129 	  ^D: scroll lines
    130 	   !: filter lines through commands or run commands
    131 	   #: display numbered lines
    132 	   &: repeat the last subsitution
    133 	   *: execute a buffer
    134 	   <: shift lines left
    135 	   =: display line number
    136 	   >: shift lines right  
    137 	   @: execute a buffer   
    138       append: append input to a line
    139   abbreviate: specify an input abbreviation
    140 	args: display file argument list
    141 	  bg: background the current screen
    142       change: change lines to input
    143 	  cd: change the current directory
    144        chdir: change the current directory
    145 	copy: copy lines elsewhere in the file
    146       cscope: create a set of tags using a cscope command
    147       delete: delete lines from the file
    148      display: display buffers, screens or tags
    149      [Ee]dit: begin editing another file
    150        [Ee]x: begin editing another file
    151      exusage: display ex command usage statement
    152 	file: display (and optionally set) file name
    153 	  fg: switch the current screen and a backgrounded screen
    154       global: execute a global command on lines matching an RE
    155 	help: display help statement
    156       insert: insert input before a line
    157 	join: join lines into a single line
    158 	   k: mark a line position
    159 	list: display lines in an unambiguous form
    160 	move: move lines elsewhere in the file
    161 	mark: mark a line position
    162 	 map: map input or commands to one or more keys
    163       mkexrc: write a .exrc file
    164      [Nn]ext: edit (and optionally specify) the next file
    165       number: change display to number lines
    166 	open: enter "open" mode (not implemented)
    167        print: display lines
    168 	perl: run the perl interpreter with the command
    169       perldo: run the perl interpreter with the command, on each line
    170     preserve: preserve an edit session for recovery
    171  [Pp]revious: edit the previous file in the file argument list
    172 	 put: append a cut buffer to the line
    173 	quit: exit ex/vi
    174 	read: append input from a command or file to the line
    175      recover: recover a saved file
    176       resize: grow or shrink the current screen
    177       rewind: re-edit all the files in the file argument list
    178 	   s: substitute on lines matching an RE
    179       script: run a shell in a screen
    180 	 set: set options (use ":set all" to see all options)
    181        shell: suspend editing and run a shell
    182       source: read a file of ex commands
    183 	stop: suspend the edit session
    184      suspend: suspend the edit session
    185 	   t: copy lines elsewhere in the file
    186       [Tt]ag: edit the file containing the tag
    187      tagnext: move to the next tag
    188       tagpop: return to the previous group of tags
    189      tagprev: move to the previous tag
    190       tagtop: discard all tags
    191 	 tcl: run the tcl interpreter with the command
    192 	undo: undo the most recent change
    193 unabbreviate: delete an abbreviation
    194        unmap: delete an input or command map
    195 	   v: execute a global command on lines NOT matching an RE
    196      version: display the program version information
    197       visual: enter visual (vi) mode from ex mode
    198    [Vv]isual: edit another file (from vi mode only)
    199      viusage: display vi key usage statement
    200        write: write the file
    201 	  wn: write the file and switch to the next file
    202 	  wq: write the file and exit
    203 	 xit: exit
    204 	yank: copy lines to a cut buffer
    205 	   z: display different screens of the file
    206 	   ~: replace previous RE with previous replacement string,
    207 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    208 Edit options:
    209 noaltwerase     filec=""        nomodeline      scroll=17       notildeop
    210 autoindent      flash           msgcat="./"     nosearchincr    timeout  
    211 autoprint       hardtabs=0      noprint=""      nosecure        nottywerase
    212 noautowrite     noiclower       nonumber        shiftwidth=8    noverbose  
    213 backup=""       noignorecase    nooctal         noshowmatch     warn
    214 nobeautify      keytime=6       open            noshowmode      window=35
    215 cedit=""        noleftright     optimize        sidescroll=16   nowindowname
    216 columns=80      lines=36        print=""        noslowopen      wraplen=0
    217 comment         nolisp          prompt          nosourceany     wrapmargin=0
    218 noedcompatible  nolist          readonly        tabstop=8       wrapscan
    219 escapetime=1    lock            noredraw        taglength=0     nowriteany
    220 noerrorbells    magic           remap           tags="tags"
    221 exrc            matchtime=7     report=5        term="xterm"
    222 noextended      mesg            ruler           noterse
    223 cdpath="/usr/src/local/nvi:/tmp"
    224 directory="/tmp"
    225 matchchars="[]{}()<>"
    226 paragraphs="IPLPPPQPP LIpplpipbp"
    227 recdir="/var/tmp/vi.recover"
    228 sections="NHSHH HUnhsh"
    229 shell="/bin/csh"
    230 shellmeta="~{[*?$`'"\"
    231