summaryrefslogtreecommitdiff
path: root/usr.bin/vi/docs/help
blob: 81df84aa1353b0946b5f3f1266cf4b655ba10d16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
MOVING THE CURSOR:
 k - cursor up    ^F - page forward	       /<pattern><CR> - search forward
 j - cursor down  ^B - page backward	       ?<pattern><CR> - 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 <escape> 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<Enter>  - write the file
:q<Enter>  - exit the file
:q!<Enter> - exit without writing the file
:#<Enter>  - move to a line (e.g., :35<Enter> moves to line 35)

MISCELLANEOUS:
^G - display the file name
 J - join two lines (use i<Enter><escape> 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
	^[ <escape> exit input mode, cancel partial commands
	^\ switch to ex mode
	^] tag push cursor word
	^^ switch to previous file
   <space> 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 subsitution
	   *: 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
      cscope: create a set of tags using a cscope command
      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
	perl: run the perl interpreter with the command
      perldo: run the perl interpreter with the command, on each line
    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
	 tcl: run the tcl interpreter with the command
	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="~{[*?$`'"\"