xref: /openbsd/usr.bin/vi/docs/help (revision 9b7c3dbb)
1MOVING 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
7ENTERING TEXT:
8a - append after the cursor.             Use the <escape> key to return to
9i - insert before the cursor.            command mode.
10o - open a new line below the cursor.
11O - open new line above the cursor.
12
13WRITING 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
19MISCELLANEOUS:
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=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
25VI 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=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
128EX COMMANDS:
129	  ^D: scroll lines
130	   !: filter lines through commands or run commands
131	   #: display numbered lines
132	   &: repeat the last substitution
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      delete: delete lines from the file
147     display: display buffers, screens or tags
148     [Ee]dit: begin editing another file
149       [Ee]x: begin editing another file
150     exusage: display ex command usage statement
151	file: display (and optionally set) file name
152	  fg: switch the current screen and a backgrounded screen
153      global: execute a global command on lines matching an RE
154	help: display help statement
155      insert: insert input before a line
156	join: join lines into a single line
157	   k: mark a line position
158	list: display lines in an unambiguous form
159	move: move lines elsewhere in the file
160	mark: mark a line position
161	 map: map input or commands to one or more keys
162      mkexrc: write a .exrc file
163     [Nn]ext: edit (and optionally specify) the next file
164      number: change display to number lines
165	open: enter "open" mode (not implemented)
166       print: display lines
167    preserve: preserve an edit session for recovery
168 [Pp]revious: edit the previous file in the file argument list
169	 put: append a cut buffer to the line
170	quit: exit ex/vi
171	read: append input from a command or file to the line
172     recover: recover a saved file
173      resize: grow or shrink the current screen
174      rewind: re-edit all the files in the file argument list
175	   s: substitute on lines matching an RE
176      script: run a shell in a screen
177	 set: set options (use ":set all" to see all options)
178       shell: suspend editing and run a shell
179      source: read a file of ex commands
180	stop: suspend the edit session
181     suspend: suspend the edit session
182	   t: copy lines elsewhere in the file
183      [Tt]ag: edit the file containing the tag
184     tagnext: move to the next tag
185      tagpop: return to the previous group of tags
186     tagprev: move to the previous tag
187      tagtop: discard all tags
188	undo: undo the most recent change
189unabbreviate: delete an abbreviation
190       unmap: delete an input or command map
191	   v: execute a global command on lines NOT matching an RE
192     version: display the program version information
193      visual: enter visual (vi) mode from ex mode
194   [Vv]isual: edit another file (from vi mode only)
195     viusage: display vi key usage statement
196       write: write the file
197	  wn: write the file and switch to the next file
198	  wq: write the file and exit
199	 xit: exit
200	yank: copy lines to a cut buffer
201	   z: display different screens of the file
202	   ~: replace previous RE with previous replacement string,
203=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
204Edit options:
205noaltwerase     filec=""        nomodeline      nosearchincr    timeout
206autoindent      flash           noprint=""      nosecure        nottywerase
207autoprint       hardtabs=0      nonumber        shiftwidth=8    noverbose
208noautowrite     noiclower       nooctalr        noshowmatch     warn
209backup=""       noignorecase    open            noshowmode      window=35
210nobeautify      keytime=6       optimize        sidescroll=16   nowindowname
211cedit=""        noleftright     print=""        noslowopen      wraplen=0
212columns=80      lines=36        prompt          nosourceany     wrapmargin=0
213comment         nolisp          readonly        tabstop=8       wrapscan
214noedcompatible  nolist          noredraw        taglength=0     nowriteany
215escapetime=1    lock            remap           tags="tags"
216noerrorbells    magic           report=5        term="xterm"
217exrc            matchtime=7     ruler           noterse
218noextended      mesg            scroll=17       notildeop
219cdpath="/usr/src/local/nvi:/tmp"
220directory="/tmp"
221paragraphs="IPLPPPQPP LIpplpipbp"
222recdir="/tmp/vi.recover"
223sections="NHSHH HUnhsh"
224shell="/bin/csh"
225shellmeta="~{[*?$`'"\"
226