1VI(1)                       General Commands Manual                      VI(1)
2
3
4

NAME

6       ex, vi, view - text editors
7

SYNOPSIS

9       ex [-eRrSsv] [-c cmd] [-t tag] [-w size] [file ...]
10       vi [-elRrSv] [-c cmd] [-t tag] [-w size] [file ...]
11       view [-eRrSv] [-c cmd] [-t tag] [-w size] [file ...]
12

LICENSE

14       The  vi  program  is  freely redistributable.  You are welcome to copy,
15       modify and share it with others under  the  conditions  listed  in  the
16       LICENSE  file.   If any company (not individual!) finds vi sufficiently
17       useful that you would have purchased it, or if any  company  wishes  to
18       redistribute it, contributions to the authors would be appreciated.
19

DESCRIPTION

21       Vi  is  a screen oriented text editor.  Ex is a line‐oriented text edi‐
22       tor.  Ex and vi are different interfaces to the same program, and it is
23       possible  to switch back and forth during an edit session.  View is the
24       equivalent of using the -R (read‐only) option of vi.
25
26       This manual page is the one provided with the nex/nvi versions  of  the
27       ex/vi  text  editors.   Nex/nvi  are intended as bug‐for‐bug compatible
28       replacements for the original  Fourth  Berkeley  Software  Distribution
29       (4BSD)  ex  and vi programs.  For the rest of this manual page, nex/nvi
30       is used only when it's necessary to distinguish it  from  the  historic
31       implementations of ex/vi.
32
33       This  manual  page  is  intended for users already familiar with ex/vi.
34       Anyone else should almost certainly read a good tutorial on the  editor
35       before  this  manual page.  If you're in an unfamiliar environment, and
36       you absolutely have to get work  done  immediately,  read  the  section
37       after  the options description, entitled “Fast Startup”.  It's probably
38       enough to get you going.
39
40       The following options are available:
41
42       -c     Execute cmd immediately after starting the edit  session.   Par‐
43              ticularly  useful  for  initial positioning in the file, however
44              cmd is not limited to positioning commands.  This is  the  POSIX
45              1003.2  interface  for the historic “+cmd” syntax.  Nex/nvi sup‐
46              ports both the old and new syntax.
47
48       -e     Start editing in ex mode, as if the command name were ex.
49
50       -l     Start editing with the lisp and showmatch options set.
51
52       -R     Start editing in read‐only mode, as  if  the  command  name  was
53              view, or the readonly option was set.
54
55       -r     Recover the specified files, or, if no files are specified, list
56              the files that could be recovered.  If no recoverable  files  by
57              the specified name exist, the file is edited as if the -r option
58              had not been specified.
59
60       -S     Run with the secure edit option set, disallowing all  access  to
61              external programs.
62
63       -s     Enter  batch  mode;  applicable only to ex edit sessions.  Batch
64              mode is useful when running ex  scripts.   Prompts,  informative
65              messages  and other user oriented message are turned off, and no
66              startup files or environmental variables are read.  This is  the
67              POSIX  1003.2  interface for the historic “-” argument.  Nex/nvi
68              supports both the old and new syntax.
69
70       -t     Start editing at the specified tag.  (See ctags(1)).
71
72       -w     Set the initial window size to the specified number of lines.
73
74       -v     Start editing in vi mode, as if the command name was vi or view.
75
76       Note that the -F option (which  prevented  ex/vi  from  making  a  full
77       backup of the target file) has been removed and is no longer available.
78
79       Command  input  for  ex/vi  is read from the standard input.  In the vi
80       interface, it is an error if standard input is not a terminal.  In  the
81       ex  interface,  if  standard input is not a terminal, ex will read com‐
82       mands from it regardless, however, the session will  be  a  batch  mode
83       session, exactly as if the -s option had been specified.
84
85       Ex/vi exits 0 on success, and greater than 0 if an error occurs.
86

FAST STARTUP

88       This  section will tell you the minimum amount that you need to do sim‐
89       ple editing tasks using vi.  If you've never  used  any  screen  editor
90       before,  you're likely to have problems even with this simple introduc‐
91       tion.  In that case you should find someone that already knows  vi  and
92       have them walk you through this section.
93
94       Vi  is  a screen editor.  This means that it takes up almost the entire
95       screen, displaying part of the file on each screen line, except for the
96       last  line  of the screen.  The last line of the screen is used for you
97       to give commands to vi, and for vi to give information to you.
98
99       The other fact that you need to understand is that vi is a modeful edi‐
100       tor,  i.e.  you are either entering text or you are executing commands,
101       and you have to be in the right mode to do one or the other.  You  will
102       be in command mode when you first start editing a file.  There are com‐
103       mands that switch you into input mode.  There  is  only  one  key  that
104       takes  you out of input mode, and that is the <escape> key.  (Key names
105       are written using less‐than  and  greater‐than  signs,  e.g.   <escape>
106       means  the  “escape” key, usually labeled “esc” on your terminal's key‐
107       board.)  If you're ever confused as  to  which  mode  you're  in,  keep
108       entering  the  <escape> key until vi beeps at you.  (Generally, vi will
109       beep at you if you try and do something that's not  allowed.   It  will
110       also display error messages.)
111
112       To  start  editing  a  file,  enter the command “vi file_name<carriage‐
113       return>”.  The command you should enter as soon as you start editing is
114       “:set  verbose  showmode<carriage‐return>”.   This will make the editor
115       give you verbose error messages and display the  current  mode  at  the
116       bottom of the screen.
117
118       The commands to move around the file are:
119
120       h      Move the cursor left one character.
121
122       j      Move the cursor down one line.
123
124       k      Move the cursor up one line.
125
126       l      Move the cursor right one character.
127
128       <cursor‐arrows>
129              The cursor arrow keys should work, too.
130
131       /text<carriage‐return>
132              Search for the string “text” in the file, and move the cursor to
133              its first character.
134
135       The commands to enter new text are:
136
137       a      Append new text, after the cursor.
138
139       i      Insert new text, before the cursor.
140
141       o      Open a new line below the line  the  cursor  is  on,  and  start
142              entering text.
143
144       O      Open  a  new  line  above  the  line the cursor is on, and start
145              entering text.
146
147       <escape>
148              Once you've entered input mode using the one of the a, i, O or o
149              commands,  use <escape> to quit entering text and return to com‐
150              mand mode.
151
152       The commands to copy text are:
153
154       yy     Copy the line the cursor is on.
155
156       p      Append the copied line after the line the cursor is on.
157
158       The commands to delete text are:
159
160       dd     Delete the line the cursor is on.
161
162       x      Delete the character the cursor is on.
163
164       The commands to write the file are:
165
166       :w<carriage‐return>
167              Write the file back to the file with the name  that  you  origi‐
168              nally used as an argument on the vi command line.
169
170       :w file_name<carriage‐return>
171              Write the file back to the file with the name “file_name”.
172
173       The commands to quit editing and exit the editor are:
174
175       :q<carriage‐return>
176              Quit  editing and leave vi (if you've modified the file, but not
177              saved your changes, vi will refuse to quit).
178
179       :q!<carriage‐return>
180              Quit, discarding any modifications that you may have made.
181
182       One final caution.  Unusual characters can take up more than one column
183       on  the  screen,  and  long lines can take up more than a single screen
184       line.  The above commands work on “physical” characters and lines, i.e.
185       they affect the entire line no matter how many screen lines it takes up
186       and the entire character no matter how many screen columns it takes up.
187

VI COMMANDS

189       The following section describes the commands available in  the  command
190       mode  of  the  vi editor.  In each entry below, the tag line is a usage
191       synopsis for the command character.
192
193       [count] <control‐A>
194              Search forward count times for the current word.
195
196       [count] <control‐B>
197              Page backwards count screens.
198
199       [count] <control‐D>
200              Scroll forward count lines.
201
202       [count] <control‐E>
203              Scroll forward count lines, leaving the current line and  column
204              as is, if possible.
205
206       [count] <control‐F>
207              Page forward count screens.
208
209       <control‐G>
210              Display the file information.
211
212       <control‐H>
213
214       [count] h
215              Move the cursor back count characters in the current line.
216
217       [count] <control‐J>
218
219       [count] <control‐N>
220
221       [count] j
222              Move  the  cursor  down count lines without changing the current
223              column.
224
225       <control‐L>
226
227       <control‐R>
228              Repaint the screen.
229
230       [count] <control‐M>
231
232       [count] +
233              Move the cursor down count lines to the first nonblank character
234              of that line.
235
236       [count] <control‐P>
237
238       [count] k
239              Move  the  cursor  up  count lines, without changing the current
240              column.
241
242       <control‐T>
243              Return to the most recent tag context.
244
245       <control‐U>
246              Scroll backwards count lines.
247
248       <control‐W>
249              Switch to the next lower screen in the window, or, to the  first
250              screen if there are no lower screens in the window.
251
252       <control‐Y>
253              Scroll  backwards count lines, leaving the current line and col‐
254              umn as is, if possible.
255
256       <control‐Z>
257              Suspend the current editor session.
258
259       <escape>
260              Execute ex commands or cancel partial commands.
261
262       <control‐]>
263              Push a tag reference onto the tag stack.
264
265       <control‐^>
266              Switch to the most recently edited file.
267
268       [count] <space>
269
270       [count] l
271              Move the cursor forward count characters  without  changing  the
272              current line.
273
274       [count] ! motion shell‐argument(s)
275              Replace text with results from a shell command.
276
277       [count] # #|+|-
278              Increment or decrement the cursor number.
279
280       [count] $
281              Move the cursor to the end of a line.
282
283       %      Move to the matching character.
284
285       &      Repeat the previous substitution command on the current line.
286
287       '<character>
288
289       `<character>
290              Return to a context marked by the character <character>.
291
292       [count] (
293              Back up count sentences.
294
295       [count] )
296              Move forward count sentences.
297
298       [count] ,
299              Reverse find character count times.
300
301       [count] -
302              Move to first nonblank of the previous line, count times.
303
304       [count] .
305              Repeat the last vi command that modified text.
306
307       /RE<carriage‐return>
308
309       /RE/ [offset]<carriage‐return>
310
311       ?RE<carriage‐return>
312
313       ?RE? [offset]<carriage‐return>
314
315       N
316
317       n      Search forward or backward for a regular expression.
318
319       0      Move to the first character in the current line.
320
321       :      Execute an ex command.
322
323       [count] ;
324              Repeat the last character find count times.
325
326       [count] < motion
327
328       [count] > motion
329              Shift lines left or right.
330
331       @ buffer
332              Execute a named buffer.
333
334       [count] A
335              Enter input mode, appending the text after the end of the line.
336
337       [count] B
338              Move backwards count bigwords.
339
340       [buffer] [count] C
341              Change text from the current position to the end‐of‐line.
342
343       [buffer] D
344              Delete text from the current position to the end‐of‐line.
345
346       [count] E
347              Move forward count end‐of‐bigwords.
348
349       [count] F <character>
350              Search  count times backward through the current line for <char‐
351              acter>.
352
353       [count] G
354              Move to line count, or the last line of the file  if  count  not
355              specified.
356
357       [count] H
358              Move  to  the  screen  line count - 1 lines below the top of the
359              screen.
360
361       [count] I
362              Enter input mode, inserting the text at  the  beginning  of  the
363              line.
364
365       [count] J
366              Join lines.
367
368       [count] L
369              Move  to the screen line count - 1 lines above the bottom of the
370              screen.
371
372        M     Move to the screen line in the middle of the screen.
373
374       [count] O
375              Enter input mode, appending text in a new line above the current
376              line.
377
378       [buffer] P
379              Insert text from a buffer.
380
381       Q      Exit vi (or visual) mode and switch to ex mode.
382
383       [count] R
384              Enter input mode, replacing the characters in the current line.
385
386       [buffer] [count] S
387              Substitute count lines.
388
389       [count] T <character>
390              Search  backwards, count times, through the current line for the
391              character after the specified <character>.
392
393       U      Restore the current line to its state  before  the  cursor  last
394              moved to it.
395
396       [count] W
397              Move forward count bigwords.
398
399       [buffer] [count] X
400              Delete count characters before the cursor.
401
402       [buffer] [count] Y
403              Copy (or “yank”) count lines into the specified buffer.
404
405       ZZ     Write the file and exit vi.
406
407       [count] [[
408              Back up count section boundaries.
409
410       [count] ]]
411              Move forward count section boundaries.
412
413       ^      Move to first nonblank character on the current line.
414
415       [count] _
416              Move down count - 1 lines, to the first nonblank character.
417
418       [count] a
419              Enter input mode, appending the text after the cursor.
420
421       [count] b
422              Move backwards count words.
423
424       [buffer] [count] c motion
425              Change a region of text.
426
427       [buffer] [count] d motion
428              Delete a region of text.
429
430       [count] e
431              Move forward count end‐of‐words.
432
433       [count] f<character>
434              Search  forward,  count  times,  through the rest of the current
435              line for <character>.
436
437       [count] i
438              Enter input mode, inserting the text before the cursor.
439
440       m <character>
441              Save the current context (line and column) as <character>.
442
443       [count] o
444              Enter input mode, appending text in a new line under the current
445              line.
446
447       [buffer] p
448              Append text from a buffer.
449
450       [count] r <character>
451              Replace count characters.
452
453       [buffer] [count] s
454              Substitute  count  characters  in the current line starting with
455              the current character.
456
457       [count] t <character>
458              Search forward, count times, through the current  line  for  the
459              character immediately before <character>.
460
461       u      Undo the last change made to the file.
462
463       [count] w
464              Move forward count words.
465
466       [buffer] [count] x
467              Delete count characters.
468
469       [buffer] [count] y motion
470              Copy (or “yank”) a text region specified by the count and motion
471              into a buffer.
472
473       [count1] z [count2] -|.|+|^|<carriage‐return>
474              Redraw, optionally repositioning and resizing the screen.
475
476       [count] {
477              Move backward count paragraphs.
478
479       [count] |
480              Move to a specific column position on the current line.
481
482       [count] }
483              Move forward count paragraphs.
484
485       [count] ~
486              Reverse the case of the next count character(s), if the  tildeop
487              option is unset.
488
489       [count] ~ motion
490              Reverse the case of the characters in a text region specified by
491              the count and motion, if the tildeop option is set.
492
493       <interrupt>
494              Interrupt the current operation.
495

VI TEXT INPUT COMMANDS

497       The following section describes the  commands  available  in  the  text
498       input mode of the vi editor.
499
500       <nul>  Replay the previous input.
501
502       <control‐D>
503              Erase to the previous shiftwidth column boundary.
504
505       ^<control‐D>
506              Erase all of the autoindent characters, and reset the autoindent
507              level.
508
509       0<control‐D>
510              Erase all of the autoindent characters.
511
512       <control‐T>
513              Insert sufficient <tab> and <space> characters to  move  forward
514              to the next shiftwidth column boundary.
515
516       <erase>
517
518       <control‐H>
519              Erase the last character.
520
521       <literal next>
522              Quote the next character.
523
524       <escape>
525              Resolve  all  text  input  into  the file, and return to command
526              mode.
527
528       <line erase>
529              Erase the current line.
530
531       <control‐W>
532
533       <word erase>
534              Erase the last word.  The definition of word is dependent on the
535              altwerase and ttywerase options.
536
537       <control‐X>[0-9A-Fa-f]+
538              Insert a character with the specified hexadecimal value into the
539              text.
540
541       <interrupt>
542              Interrupt text input mode, returning to command mode.
543

EX COMMANDS

545       The following section describes the commands available in the  ex  edi‐
546       tor.   In  each  entry  below, the tag line is a usage synopsis for the
547       command.
548
549       <end‐of‐file>
550              Scroll the screen.
551
552       ! argument(s)
553
554       [range]! argument(s)
555              Execute a shell command, or filter lines through  a  shell  com‐
556              mand.
557
558       "      A comment.
559
560       [range] nu[mber] [count] [flags]
561
562       [range] # [count] [flags]
563              Display the selected lines, each preceded with its line number.
564
565       @ buffer
566
567       * buffer
568              Execute a buffer.
569
570       [line] a[ppend][!]
571              The input text is appended after the specified line.
572
573       [range] c[hange][!] [count]
574              The input text replaces the specified range.
575
576       cs[cope] add | find | help | kill | reset
577              Execute a Cscope command.
578
579       [range] d[elete] [buffer] [count] [flags]
580              Delete the lines from the file.
581
582       di[splay] b[uffers] | c[onnections] | s[creens] | t[ags]
583              Display buffers, Cscope connections, screens or tags.
584
585       [Ee][dit][!] [+cmd] [file]
586
587       [Ee]x[!] [+cmd] [file]
588              Edit a different file.
589
590       exu[sage] [command]
591              Display usage for an ex command.
592
593       f[ile] [file]
594              Display and optionally change the file name.
595
596       [Ff]g [name]
597              Vi mode only.  Foreground the specified screen.
598
599       [range] g[lobal] /pattern/ [commands]
600
601       [range] v /pattern/ [commands]
602              Apply commands to lines matching (or not matching) a pattern.
603
604       he[lp] Display a help message.
605
606       [line] i[nsert][!]
607              The input text is inserted before the specified line.
608
609       [range] j[oin][!] [count] [flags]
610              Join lines of text together.
611
612       [range] l[ist] [count] [flags]
613              Display the lines unambiguously.
614
615       map[!] [lhs rhs]
616              Define or display maps (for vi only).
617
618       [line] ma[rk] <character>
619
620       [line] k <character>
621              Mark the line with the mark <character>.
622
623       [range] m[ove] line
624              Move the specified lines after the target line.
625
626       mk[exrc][!] file
627              Write  the  abbreviations, editor options and maps to the speci‐
628              fied file.
629
630       [Nn][ext][!] [file ...]
631              Edit the next file from the argument list.
632
633       [line] o[pen] /pattern/ [flags]
634              Enter open mode.
635
636       pre[serve]
637              Save the file in a form that can later be recovered using the ex
638              -r option.
639
640       [Pp]rev[ious][!]
641              Edit the previous file from the argument list.
642
643       [range] p[rint] [count] [flags]
644              Display the specified lines.
645
646       [line] pu[t] [buffer]
647              Append buffer contents to the current line.
648
649       q[uit][!]
650              End the editing session.
651
652       [line] r[ead][!] [file]
653              Read a file.
654
655       rec[over] file
656              Recover file if it was previously saved.
657
658       res[ize] [+|-]size
659              Vi mode only.  Grow or shrink the current screen.
660
661       rew[ind][!]
662              Rewind the argument list.
663
664       se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]
665              Display or set editor options.
666
667       sh[ell]
668              Run a shell program.
669
670       so[urce] file
671              Read and execute ex commands from a file.
672
673       [range] s[ubstitute] [/pattern/replace/] [options] [count] [flags]
674
675       [range] & [options] [count] [flags]
676
677       [range] ~ [options] [count] [flags]
678              Make substitutions.
679
680       su[spend][!]
681
682       st[op][!]
683
684       <suspend>
685              Suspend the edit session.
686
687       [Tt]a[g][!] tagstring
688              Edit the file containing the specified tag.
689
690       tagn[ext][!]
691              Edit the file containing the next context for the current tag.
692
693       tagp[op][!] [file | number]
694              Pop to the specified tag in the tags stack.
695
696       tagp[rev][!]
697              Edit  the  file  containing the previous context for the current
698              tag.
699
700       unm[ap][!] lhs
701              Unmap a mapped string.
702
703       ve[rsion]
704              Display the version of the ex/vi editor.
705
706       [line] vi[sual] [type] [count] [flags]
707              Ex mode only.  Enter vi.
708
709       [Vi]i[sual][!] [+cmd] [file]
710              Vi mode only.  Edit a new file.
711
712       viu[sage] [command]
713              Display usage for a vi command.
714
715       [range] w[rite][!] [>>] [file]
716
717       [range] w[rite] [!] [file]
718
719       [range] wn[!] [>>] [file]
720
721       [range] wq[!] [>>] [file]
722              Write the file.
723
724       [range] x[it][!] [file]
725              Write the file if it has been modified.
726
727       [range] ya[nk] [buffer] [count]
728              Copy the specified lines to a buffer.
729
730       [line] z [type] [count] [flags]
731              Adjust the window.
732

SET OPTIONS

734       There are a large number of options that  may  be  set  (or  unset)  to
735       change  the  editor's  behavior.   This  section describes the options,
736       their abbreviations and their default values.
737
738       In each entry below, the first part of the tag line is the full name of
739       the  option,  followed  by  any  equivalent abbreviations.  The part in
740       square brackets is the default  value  of  the  option.   Most  of  the
741       options are boolean, i.e. they are either on or off, and do not have an
742       associated value.
743
744       Options apply to both ex and vi modes, unless otherwise specified. Mul‐
745       tiple  options can be given in one set or unset, separated by spaces or
746       tabs.  Spaces and tabs can be included in string options (eg.  tags  or
747       filec) by preceding each with a backslash.  There's no way to get back‐
748       slash itself into an option.
749
750       altwerase [off]
751              Vi only.  Select an alternate word erase algorithm.
752
753       autoindent, ai [off]
754              Automatically indent new lines.
755
756       autoprint, ap [off]
757              Ex only.  Display the current line automatically.
758
759       autowrite, aw [off]
760              Write modified files automatically when changing files.
761
762       backup [""]
763              Backup files before they are overwritten.
764
765       beautify, bf [off]
766              Discard control characters.
767
768       cdpath [environment variable CDPATH, or current directory]
769              The directory paths used as path prefixes for the cd command.
770
771       cedit [no default]
772              Set the character to edit the colon command‐line history.
773
774       columns, co [80]
775              Set the number of columns in the screen.
776
777       comment [off]
778              Vi only.  Skip leading comments in shell,  C  and  C++  language
779              files.
780
781       directory, dir [environment variable TMPDIR, or /tmp]
782              The directory where temporary files are created.
783
784       edcompatible, ed [off]
785              Remember  the  values of the “c” and “g” suffices to the substi‐
786              tute commands, instead of initializing them as  unset  for  each
787              new command.
788
789       errorbells, eb [off]
790              Ex only.  Announce error messages with a bell.
791
792       exrc, ex [off]
793              Read the startup files in the local directory.
794
795       extended [off]
796              Regular  expressions are extended (i.e.  egrep(1)-style) expres‐
797              sions.
798
799       filec [no default]
800              Set the character to perform file path completion on  the  colon
801              command line.
802
803       flash [on]
804              Flash the screen instead of beeping the keyboard on error.
805
806       hardtabs, ht [8]
807              Set the spacing between hardware tab settings.
808
809       iclower [off]
810              Makes  all  Regular  Expressions case‐insensitive, as long as an
811              upper‐case letter does not appear in the search string.
812
813       ignorecase, ic [off]
814              Ignore case differences in regular expressions.
815
816       keytime [6]
817              The 10th's of a second ex/vi waits for a subsequent key to  com‐
818              plete a key mapping.
819
820       leftright [off]
821              Vi only.  Do left‐right scrolling.
822
823       lines, li [24]
824              Vi only.  Set the number of lines in the screen.
825
826       lisp [off]
827              Vi  only.   Modify  various  search commands and options to work
828              with Lisp.  This option is not yet implemented.
829
830       list [off]
831              Display lines in an unambiguous fashion.
832
833       lock [on]
834              Attempt to get an exclusive lock on any file being edited,  read
835              or written.
836
837       magic [on]
838              Treat certain characters specially in regular expressions.
839
840       matchtime [7]
841              Vi  only.   The  10th's of a second ex/vi pauses on the matching
842              character when the showmatch option is set.
843
844       mesg [on]
845              Permit messages from other users.
846
847       modelines, modeline [off]
848              Read the first and last few lines of each file for ex  commands.
849              This option will never be implemented.
850
851       noprint [""]
852              Characters that are never handled as printable characters.
853
854       number, nu [off]
855              Precede each line displayed with its current line number.
856
857       octal [off]
858              Display  unknown  characters  as  octal  numbers, instead of the
859              default hexadecimal.
860
861       open [on]
862              Ex only.  If this option is not set, the open  and  visual  com‐
863              mands are disallowed.
864
865       optimize, opt [on]
866              Vi  only.   Optimize  text  throughput  to dumb terminals.  This
867              option is not yet implemented.
868
869       paragraphs, para [IPLPPPQPP LIpplpipbp]
870              Vi only.  Define additional paragraph boundaries for the { and }
871              commands.
872
873       path []
874              Define additional directories to search for files being edited.
875
876       print [""]
877              Characters that are always handled as printable characters.
878
879       prompt [on]
880              Ex only.  Display a command prompt.
881
882       readonly, ro [off]
883              Mark the file and session as read‐only.
884
885       recdir [/var/tmp/vi.recover]
886              The directory where recovery files are stored.
887
888       redraw, re [off]
889              Vi  only.  Simulate an intelligent terminal on a dumb one.  This
890              option is not yet implemented.
891
892       remap [on]
893              Remap keys until resolved.
894
895       report [5]
896              Set the number of lines about which the editor  reports  changes
897              or yanks.
898
899       ruler [off]
900              Vi only.  Display a row/column ruler on the colon command line.
901
902       scroll, scr [window / 2]
903              Set the number of lines scrolled.
904
905       searchincr [off]
906              Makes the / and ?  commands incremental.
907
908       sections, sect [NHSHH HUnhsh]
909              Vi only.  Define additional section boundaries for the [[ and ]]
910              commands.
911
912       secure [off]
913              Turns off all access to external programs.
914
915       shell, sh [environment variable SHELL, or /bin/sh]
916              Select the shell used by the editor.
917
918       shellmeta [~{[*?$`'"\]
919              Set the meta characters checked to determine if file name expan‐
920              sion is necessary.
921
922       shiftwidth, sw [8]
923              Set the autoindent and shift command indentation width.
924
925       showmatch, sm [off]
926              Vi only.  Note matching “{” and “(” for “}” and “)” characters.
927
928       showmode, smd [off]
929              Vi only.  Display the current editor mode and a “modified” flag.
930
931       sidescroll [16]
932              Vi only.  Set the amount a left‐right scroll will shift.
933
934       slowopen, slow [off]
935              Delay  display  updating  during text input.  This option is not
936              yet implemented.
937
938       sourceany [off]
939              Read startup files not owned by the current user.   This  option
940              will never be implemented.
941
942       tabstop, ts [8]
943              This option sets tab widths for the editor display.
944
945       taglength, tl [0]
946              Set the number of significant characters in tag names.
947
948       tags, tag [tags /var/db/libc.tags /sys/kern/tags]
949              Set the list of tags files.
950
951       term, ttytype, tty [environment variable TERM]
952              Set the terminal type.
953
954       terse [off]
955              This  option has historically made editor messages less verbose.
956              It has no effect in this implementation.
957
958       tildeop [off]
959              Modify the ~ command to take an associated motion.
960
961       timeout, to [on]
962              Time out on keys which may be mapped.
963
964       ttywerase [off]
965              Vi only.  Select an alternate erase algorithm.
966
967       verbose [off]
968              Vi only.  Display an error message for every error.
969
970       w300 [no default]
971              Vi only.  Set the window size if the baud rate is less than 1200
972              baud.
973
974       w1200 [no default]
975              Vi  only.  Set the window size if the baud rate is equal to 1200
976              baud.
977
978       w9600 [no default]
979              Vi only.  Set the window size if the baud rate is  greater  than
980              1200 baud.
981
982       warn [on]
983              Ex  only.   This option causes a warning message to the terminal
984              if the file has been modified, since it was last written, before
985              a !  command.
986
987       window, w, wi [environment variable LINES]
988              Set the window size for the screen.
989
990       windowname [off]
991              Change  the icon/window name to the current file name even if it
992              can't be restored on editor exit.
993
994       wraplen, wl [0]
995              Vi only.  Break lines automatically,  the  specified  number  of
996              columns  from  the  left‐hand  margin.   If both the wraplen and
997              wrapmargin edit options are set, the wrapmargin value is used.
998
999       wrapmargin, wm [0]
1000              Vi only.  Break lines automatically,  the  specified  number  of
1001              columns  from  the  right‐hand  margin.  If both the wraplen and
1002              wrapmargin edit options are set, the wrapmargin value is used.
1003
1004       wrapscan, ws [on]
1005              Set searches to wrap around the end or beginning of the file.
1006
1007       writeany, wa [off]
1008              Turn off file‐overwriting checks.
1009

ENVIRONMENT VARIABLES

1011       COLUMNS
1012              The number of columns on the screen.  This value  overrides  any
1013              system  or terminal specific values.  If the COLUMNS environmen‐
1014              tal variable is not set when ex/vi runs, or the  columns  option
1015              is explicitly reset by the user, ex/vi enters the value into the
1016              environment.
1017
1018       EXINIT A list of ex startup commands, read if the variable  NEXINIT  is
1019              not set.
1020
1021       HOME   The  user's  home  directory, used as the initial directory path
1022              for the startup “$HOME/.nexrc” and  “$HOME/.exrc”  files.   This
1023              value  is  also used as the default directory for the vi cd com‐
1024              mand.
1025
1026       LINES  The number of rows on the screen.  This value overrides any sys‐
1027              tem  or  terminal  specific  values.  If the LINES environmental
1028              variable is not set when ex/vi runs,  or  the  lines  option  is
1029              explicitly  reset  by  the user, ex/vi enters the value into the
1030              environment.
1031
1032       NEXINIT
1033              A list of ex startup commands.
1034
1035       SHELL  The user's shell of choice (see also the shell option).
1036
1037       TERM   The user's terminal type.  The default is  the  type  “unknown”.
1038              If  the  TERM environmental variable is not set when ex/vi runs,
1039              or the term option is explicitly reset by the user, ex/vi enters
1040              the value into the environment.
1041
1042       TMPDIR The location used to stored temporary files (see also the direc‐
1043              tory edit option).
1044

ASYNCHRONOUS EVENTS

1046       SIGALRM
1047              Vi/ex uses this signal for periodic backups  of  file  modifica‐
1048              tions  and to display “busy” messages when operations are likely
1049              to take a long time.
1050
1051       SIGHUP
1052
1053       SIGTERM
1054              If the current buffer has changed since it was last  written  in
1055              its  entirety,  the editor attempts to save the modified file so
1056              it can be later recovered.  See the vi/ex Reference manual  sec‐
1057              tion entitled “Recovery” for more information.
1058
1059       SIGINT When  an  interrupt occurs, the current operation is halted, and
1060              the editor returns to the command level.  If interrupted  during
1061              text  input, the text already input is resolved into the file as
1062              if the text input had been normally terminated.
1063
1064       SIGWINCH
1065              The screen is resized.  See the vi/ex Reference  manual  section
1066              entitled “Sizing the Screen” for more information.
1067
1068       SIGCONT
1069
1070       SIGQUIT
1071
1072       SIGTSTP
1073              Vi/ex ignores these signals.
1074

FILES

1076       /bin/sh
1077              The default user shell.
1078
1079       /etc/vi.exrc
1080              System‐wide vi startup file.
1081
1082       /tmp   Temporary file directory.
1083
1084       /var/tmp/vi.recover
1085              The default recovery file directory.
1086
1087       $HOME/.nexrc
1088              1st choice for user's home directory startup file.
1089
1090       $HOME/.exrc
1091              2nd choice for user's home directory startup file.
1092
1093       .nexrc 1st choice for local directory startup file.
1094
1095       .exrc  2nd choice for local directory startup file.
1096

SEE ALSO

1098       ctags(1), more(1), curses(3), dbopen(3)
1099
1100       The “Vi Quick Reference” card.
1101
1102       “An Introduction to Display Editing with Vi”, found in the “UNIX User's
1103       Manual Supplementary Documents” section of both the 4.3BSD  and  4.4BSD
1104       manual sets.  This document is the closest thing available to an intro‐
1105       duction to the vi screen editor.
1106
1107       “Ex Reference Manual (Version 3.7)”, found in the “UNIX  User's  Manual
1108       Supplementary  Documents”  section of both the 4.3BSD and 4.4BSD manual
1109       sets.  This document is the final reference for the ex editor, as  dis‐
1110       tributed in most historic 4BSD and System V systems.
1111
1112       “Edit: A tutorial”, found in the “UNIX User's Manual Supplementary Doc‐
1113       uments” section of the 4.3BSD manual set.  This document is  an  intro‐
1114       duction to a simple version of the ex screen editor.
1115
1116       “Ex/Vi  Reference  Manual”, found in the “UNIX User's Manual Supplemen‐
1117       tary Documents” section of the 4.4BSD manual set.  This document is the
1118       final  reference for the nex/nvi text editors, as distributed in 4.4BSD
1119       and 4.4BSD‐Lite.
1120
1121       Roff source for all of these documents is distributed with  nex/nvi  in
1122       the nvi/USD.doc directory of the nex/nvi source code.
1123
1124       The files “autowrite”, “input”, “quoting” and “structures” found in the
1125       nvi/docs/internals directory of the nex/nvi source code.
1126

HISTORY

1128       The nex/nvi replacements for the ex/vi editor first appeared in 4.4BSD.
1129

STANDARDS

1131       Nex/nvi is close to IEEE Std1003.2 (“POSIX”).   That  document  differs
1132       from  historical ex/vi practice in several places; there are changes to
1133       be made on both sides.
1134
1135
1136
11373rd Berkeley Distribution             1Q1                                VI(1)
Impressum