2 .\" The Regents of the University of California. All rights reserved.
3 .\" Copyright (c) 1994, 1995, 1996
4 .\" Keith Bostic. All rights reserved.
6 .\" See the LICENSE file for redistribution information.
8 .\" @(#)vi.cmd.roff 8.49 (Berkeley) 8/17/96
10 .SH 1 "Vi Description"
13 takes up the entire screen to display the edited file,
14 except for the bottom line of the screen.
15 The bottom line of the screen is used to enter
19 error and informational messages.
20 If no other information is being displayed,
21 the default display can show the current cursor row and cursor column,
22 an indication of whether the file has been modified,
23 and the current mode of the editor.
28 options for more information.
30 Empty lines do not have any special representation on the screen,
31 but lines on the screen that would logically come after the end of
32 the file are displayed as a single tilde
35 To differentiate between empty lines and lines consisting of only
36 whitespace characters, use the
39 Historically, implementations of
41 have also displayed some lines as single asterisk
44 These were lines that were not correctly displayed, i.e. lines on the
45 screen that did not correspond to lines in the file, or lines that did
46 not fit on the current screen.
48 never displays lines in this fashion.
51 is a modeful editor, i.e. it has two modes,
58 first starts, it is in command mode.
59 There are several commands that change
64 character is used to resolve the text input into the file,
65 and exit back into command mode.
68 command mode, the cursor is always positioned on the last column of
69 characters which take up more than one column on the screen.
72 text insert mode, the cursor is positioned on the first column of
73 characters which take up more than one column on the screen.
75 When positioning the cursor to a new line and column,
76 the type of movement is defined by the distance to the new cursor position.
77 If the new position is close,
78 the screen is scrolled to the new location.
79 If the new position is far away,
80 the screen is repainted so that the new position is on the screen.
81 If the screen is scrolled,
82 it is moved a minimal amount,
83 and the cursor line will usually appear at the top or bottom of the screen.
84 If the screen is repainted,
85 the cursor line will appear in the center of the screen,
86 unless the cursor is sufficiently close to the beginning or end of the file
87 that this isn't possible.
90 option is set, the screen may be scrolled or repainted in a horizontal
91 direction as well as in a vertical one.
93 A major difference between the historical
97 is in the scrolling and screen oriented position commands,
108 In historical implementations of
110 these commands acted on physical (as opposed to logical, or screen)
112 For lines that were sufficiently long in relation to the size of the
113 screen, this meant that single line scroll commands might repaint the
114 entire screen, scrolling or screen positioning commands might not change
115 the screen or move the cursor at all, and some lines simply could not
116 be displayed, even though
118 would edit the file that contained them.
121 these commands act on logical, i.e. screen lines.
122 You are unlikely to notice any difference unless you are editing files
123 with lines significantly longer than a screen width.
126 keeps track of the currently
127 .QQ "most attractive"
129 Each command description (for commands that alter the current cursor
131 specifies if the cursor is set to a specific location in the line,
132 or if it is moved to the
133 .QQ "most attractive cursor position" .
134 The latter means that the cursor is moved to the cursor position that
135 is horizontally as close as possible to the current cursor position.
136 If the current line is shorter than the cursor position
138 would select, the cursor is positioned on the last character in the line.
139 (If the line is empty, the cursor is positioned on the first column
141 If a command moves the cursor to the most attractive position,
142 it does not alter the current cursor position, and a subsequent
143 movement will again attempt to move the cursor to that position.
144 Therefore, although a movement to a line shorter than the currently
145 most attractive position will cause the cursor to move to the end of
146 that line, a subsequent movement to a longer line will cause the
147 cursor to move back to the most attractive position.
151 command makes the end of each line the most attractive cursor position
152 rather than a specific column.
156 command described below notes where the cursor ends up after it is
158 This position is described in terms of characters on the line, i.e.
159 .QQ "the previous character" ,
161 .QQ "the last character in the line" .
162 This is to avoid needing to continually refer to on what part of the
163 character the cursor rests.
165 The following words have special meaning for
168 .KY "previous context"
169 .IP "previous context"
170 The position of the cursor before the command which caused the
171 last absolute movement was executed.
174 command described in the next section that is considered an
175 absolute movement is so noted.
176 In addition, specifying
180 command is considered an absolute movement.
185 command can be used as an optional trailing argument to the
193 and (depending on the
198 This command indicates the end of the region of text that's affected by
200 The motion command may be either the command character repeated (in
201 which case it means the current line) or a cursor movement command.
202 In the latter case, the region affected by the command is from the
203 starting or stopping cursor position which comes first in the file,
204 to immediately before the starting or stopping cursor position which
205 comes later in the file.
206 Commands that operate on lines instead of using beginning and ending
207 cursor positions operate on all of the lines that are wholly or
208 partially in the region.
209 In addition, some other commands become line oriented depending on
210 where in the text they are used.
211 The command descriptions below note these special cases.
213 The following commands may all be used as motion components for
221 <control-A> <control-H> <control-J> <control-M>
222 <control-N> <control-P> <space> $
236 The optional count prefix available for some of the
238 commands that take motion commands,
239 or the count prefix available for the
241 commands that are used as motion components,
242 may be included and is
244 considered part of the motion argument.
245 For example, the commands
249 are equivalent, and the region affected by the
251 command is two words of text.
253 if the optional count prefix is specified for both the
255 command and its motion component,
256 the effect is multiplicative and is considered part of the motion argument.
257 For example, the commands
261 are equivalent, and the region affected by the
263 command is four words of text.
266 A positive number used as an optional argument to most commands,
267 either to give a size or a position (for display or movement commands),
268 or as a repeat count (for commands that modify text).
269 The count argument is always optional and defaults to 1 unless otherwise
270 noted in the command description.
274 command synopsis shows both a
278 they may be presented in any order.
281 Generally, in languages where it is applicable,
283 recognizes two kinds of words.
284 First, a sequence of letters, digits and underscores,
285 delimited at both ends by:
286 characters other than letters, digits, or underscores,
287 the beginning or end of a line, and the beginning or end of the file.
288 Second, a sequence of characters other than letters, digits, underscores,
289 or whitespace characters, delimited at both ends by: a letter, digit,
290 underscore, or whitespace character,
291 the beginning or end of a line, and the beginning or end of the file.
292 For example, the characters
300 Groups of empty lines (or lines containing only whitespace characters)
301 are treated as a single word.
304 A set of non-whitespace characters preceded and followed by whitespace
305 characters or the beginning or end of the file or line.
306 For example, the characters
311 Groups of empty lines (or lines containing only whitespace characters)
312 are treated as a single bigword.
315 An area of text that begins with either the beginning of a file,
316 an empty line, or a section boundary, and continues until either
317 an empty line, section boundary, or the end of the file.
319 Groups of empty lines (or lines containing only whitespace characters)
320 are treated as a single paragraph.
322 Additional paragraph boundaries can be defined using the
327 An area of text that starts with the beginning of the file or a line
328 whose first character is an open brace
330 and continues until the next section or the end of the file.
332 Additional section boundaries can be defined using the
337 An area of text that begins with either the beginning of the file or the
338 first nonblank character following the previous sentence, paragraph, or
339 section boundary and continues until the end of the file or a period
346 followed by either an end-of-line or two whitespace characters.
347 Any number of closing parentheses
355 characters can appear between the period, exclamation point,
356 or question mark and the whitespace characters or end-of-line.
358 Groups of empty lines (or lines containing only whitespace characters)
359 are treated as a single sentence.
362 The following section describes the commands available in the command
366 In each entry below, the tag line is a usage synopsis for the command
368 In addition, the final line and column the cursor rests upon,
369 and any options which affect the command are noted.
371 .IP "[count] <control-A>"
374 times for the current word.
375 The current word begins at the first non-whitespace character on or
376 after the current cursor position,
377 and extends up to the next non-word character or the end of the line.
378 The search is literal, i.e. no characters in the word have any special
379 meaning in terms of Regular Expressions.
380 It is an error if no matching pattern is found between the starting position
381 and the end of the file.
385 command is an absolute movement.
388 command may be used as the motion component of other
390 commands, in which case any text copied into a buffer is
394 Set to the line where the word is found.
396 Set to the first character of the word.
405 .IP "[count] <control-B>"
409 Two lines of overlap are maintained, if possible,
410 by displaying the window starting at line
411 .LI "(top_line - count * window_size) + 2" ,
417 (In the case of split screens, this size is corrected to the
418 current screen size.)
419 It is an error if the movement is past the beginning of the file.
422 Set to the last line of text displayed on the screen.
424 Set to the first nonblank character of the line.
431 .IP "[count] <control-D>"
437 is not specified, scroll forward the number of lines specified by the last
447 scroll forward half the number of lines in the screen.
448 (In the case of split screens, the default scrolling distance is
449 corrected to half the current screen size.)
450 It is an error if the movement is past the end of the file.
453 Set to the current line plus the number of lines scrolled.
455 Set to the first nonblank character of the line.
460 .IP "[count] <control-E>"
463 lines, leaving the cursor on the current line and column, if possible.
464 It is an error if the movement is past the end of the file.
467 Unchanged unless the current line scrolls off the screen,
468 in which case it is set to the first line on the screen.
470 Unchanged unless the current line scrolls off the screen,
471 in which case it is set to the most attractive cursor position.
476 .IP "[count] <control-F>"
480 Two lines of overlap are maintained, if possible,
481 by displaying the window starting at line
482 .LI "top_line + count * window_size - 2" ,
488 (In the case of split screens, this size is corrected to the
489 current screen size.)
490 It is an error if the movement is past the end of the file.
493 Set to the first line on the screen.
495 Set to the first nonblank character of the current line.
503 Display the file information.
504 The information includes the current pathname, the current line,
505 the number of total lines in the file, the current line as a percentage
506 of the total lines in the file, if the file has been modified,
507 was able to be locked, if the file's name has been changed,
508 and if the edit session is read-only.
518 .IP "[count] <control-H>"
522 characters in the current line.
523 It is an error if the cursor is on the first character in the line.
529 commands may be used as the motion component of other
532 in which case any text copied into a buffer is character oriented.
538 .LI "current - count"
539 character, or, the first character in the line if
541 is greater than or equal to the number of characters in the line
547 .IP "[count] <control-J>"
549 .Ip "[count] <control-N>"
554 lines without changing the current column.
555 It is an error if the movement is past the end of the file.
562 commands may be used as the motion component of other
564 commands, in which case any text copied into a buffer is
568 Set to the current line plus
571 The most attractive cursor position.
589 .IP "[count] <control-M>"
594 lines to the first nonblank character of that line.
595 It is an error if the movement is past the end of the file.
601 commands may be used as the motion component of other
603 commands, in which case any text copied into a buffer is
607 Set to the current line plus
610 Set to the first nonblank character in the line.
615 .IP "[count] <control-P>"
620 lines, without changing the current column.
621 It is an error if the movement is past the beginning of the file.
627 commands may be used as the motion component of other
629 commands, in which case any text copied into a buffer is
633 Set to the current line minus
636 The most attractive cursor position.
642 Return to the most recent tag context.
645 command is an absolute movement.
648 Set to the context of the previous tag command.
650 Set to the context of the previous tag command.
655 .IP "[count] <control-U>"
661 is not specified, scroll backward the number of lines specified by the
672 scroll backward half the number of lines in the screen.
673 (In the case of split screens, the default scrolling distance is
674 corrected to half the current screen size.)
675 It is an error if the movement is past the beginning of the file.
678 Set to the current line minus the amount scrolled.
680 Set to the first nonblank character in the line.
686 Switch to the next lower screen in the window, or, to the first
687 screen if there are no lower screens in the window.
690 Set to the previous cursor position in the window.
692 Set to the previous cursor position in the window.
697 .IP "[count] <control-Y>"
700 lines, leaving the current line and column as is, if possible.
701 It is an error if the movement is past the beginning of the file.
704 Unchanged unless the current line scrolls off the screen,
705 in which case it is set to the last line of text displayed
708 Unchanged unless the current line scrolls off the screen,
709 in which case it is the most attractive cursor position.
715 Suspend the current editor session.
716 If the file has been modified since it was last completely written,
719 option is set, the file is written before the editor session is
721 If this write fails, the editor session is not suspended.
736 commands or cancel partial commands.
739 command is being entered (e.g.
745 the command is executed.
746 If a partial command has been entered, e.g.
749 .QT "[0-9]*[!<>cdy]" ,
750 the command is cancelled.
751 Otherwise, it is an error.
756 command is being executed, the current line is set as described for
758 Otherwise, unchanged.
762 command is being executed, the current column is set as described for
764 Otherwise, unchanged.
770 Push a tag reference onto the tag stack.
771 The tags files (see the
773 option for more information) are searched for a tag matching the
775 The current word begins at the first non-whitespace character on or
776 after the current cursor position,
777 and extends up to the next non-word character or the end of the line.
778 If a matching tag is found, the current file is discarded and the
779 file containing the tag reference is edited.
781 If the current file has been modified since it was last completely
782 written, the command will fail.
785 command is an absolute movement.
788 Set to the line containing the matching tag string.
790 Set to the start of the matching tag string.
800 Switch to the most recently edited file.
802 If the file has been modified since it was last completely written,
805 option is set, the file is written out.
806 If this write fails, the command will fail.
807 Otherwise, if the current file has been modified since it was last
808 completely written, the command will fail.
811 Set to the line the cursor was on when the file was last edited.
813 Set to the column the cursor was on when the file was last edited.
820 .IP "[count] <space>"
823 Move the cursor forward
825 characters without changing the current line.
826 It is an error if the cursor is on the last character in the line.
832 commands may be used as the motion component of other
834 commands, in which case any text copied into a buffer is
836 In addition, these commands may be used as the motion components
837 of other commands when the cursor is on the last character in the
843 Set to the current character plus the next
845 characters, or to the last character on the line if
847 is greater than the number of characters in the line after the
853 .IP "[count] ! motion shell-argument(s)<carriage-return>"
854 Replace text with results from a shell command.
855 Pass the lines specified by the
859 arguments as standard input to the program named by the
861 option, and replace those lines with the output (both
862 standard error and standard output) of that command.
864 After the motion is entered,
866 prompts for arguments to the shell command.
868 Within those arguments,
872 characters are expanded to the current and alternate pathnames,
876 character is expanded with the command text of the previous
881 (Therefore, the command
886 The special meanings of
891 can be overridden by escaping them with a backslash.
896 command has yet been executed,
897 it is an error to use an unescaped
899 character as a shell argument.
904 do shell expansion on the strings provided as arguments.
905 If any of the above expansions change the arguments the user entered,
906 the command is redisplayed at the bottom of the screen.
909 then executes the program named by the
913 flag followed by the arguments (which are bundled into a single argument).
917 command is permitted in an empty file.
919 If the file has been modified since it was last completely written,
922 command will warn you.
925 The first line of the replaced text.
927 The first column of the replaced text.
934 .IP "[count] # #|+|-"
935 Increment or decrement the number referenced by the cursor.
936 If the trailing character is a
940 the number is incremented by
942 If the trailing character is a
944 the number is decremented by
951 causes the number to be interpreted as a hexadecimal number.
954 causes the number to be interpreted as an octal number, unless a non-octal
955 digit is found as part of the number.
956 Otherwise, the number is interpreted as a decimal number, and may
962 The current number begins at the first non-blank character at or after
963 the current cursor position, and extends up to the end of the line or
964 the first character that isn't a possible character for the numeric type.
965 The format of the number (e.g. leading 0's, signs) is retained unless
966 the new value cannot be represented in the previous format.
968 Octal and hexadecimal numbers, and the result of the operation, must fit
970 .QT "unsigned long" .
971 Similarly, decimal numbers and their result must fit into a
973 It is an error to use this command when the cursor is not positioned at
980 Set to the first character in the cursor number.
986 Move the cursor to the end of a line.
989 is specified, the cursor moves down
993 It is not an error to use the
995 command when the cursor is on the last character in the line or
996 when the line is empty.
1000 command may be used as the motion component of other
1002 commands, in which case any text copied into a buffer is
1003 character oriented, unless the cursor is at, or before the first
1004 nonblank character in the line, in which case it is line oriented.
1005 It is not an error to use the
1007 command as a motion component when the cursor is on the last character
1008 in the line, although it is an error when the line is empty.
1011 Set to the current line plus
1015 Set to the last character in the line.
1021 Move to the matching character.
1022 The cursor moves to the parenthesis or curly brace which
1024 the parenthesis or curly brace found at the current cursor position
1025 or which is the closest one to the right of the cursor on the line.
1026 It is an error to execute the
1028 command on a line without a parenthesis or curly brace.
1033 command was ignored.
1037 command is an absolute movement.
1040 command may be used as the motion component of other
1042 commands, in which case any text copied into a buffer is
1043 character oriented, unless the starting point of the region is at
1044 or before the first nonblank character on its line, and the ending
1045 point is at or after the last nonblank character on its line, in
1046 which case it is line oriented.
1049 Set to the line containing the matching character.
1051 Set to the matching character.
1057 Repeat the previous substitution command on the current line.
1063 command was ignored.
1068 Unchanged if the cursor was on the last character in the line,
1069 otherwise, set to the first nonblank character in the line.
1079 .KY SQUOTE<character>
1083 Return to a context marked by the character
1091 character, return to the previous context.
1094 is any other character,
1095 return to the context marked by that character (see the
1097 command for more information).
1098 If the command is the
1100 command, only the line value is restored,
1101 and the cursor is placed on the first nonblank character of that line.
1102 If the command is the
1104 command, both the line and column values are restored.
1106 It is an error if the context no longer exists because of
1108 (Contexts follow lines that are moved, or which are deleted
1115 commands are both absolute movements.
1116 They may be used as a motion component for other
1121 command, any text copied into a buffer is line oriented.
1125 any text copied into a buffer is character oriented,
1126 unless it both starts and stops at the first character in the line,
1127 in which case it is line oriented.
1128 In addition, when using the
1130 command as a motion component,
1131 commands which move backward and started at the first character in the line,
1132 or move forward and ended at the first character in the line,
1133 are corrected to the last character of the line preceding the starting and
1134 ending lines, respectively.
1137 Set to the line from the context.
1139 Set to the first nonblank character in the line, for the
1141 command, and set to the context's column for the
1155 command is an absolute movement.
1158 command may be used as the motion component of other
1161 in which case any text copied into a buffer is character oriented,
1162 unless the starting and stopping points of the region are the first
1163 character in the line,
1164 in which case it is line oriented.
1165 If it is line oriented,
1166 the starting point of the region is adjusted to be the end of the line
1167 immediately before the starting cursor position.
1170 Set to the line containing the beginning of the sentence.
1172 Set to the first nonblank character of the sentence.
1186 command is an absolute movement.
1189 command may be used as the motion component of other
1191 commands, in which case any text copied into a buffer is
1192 character oriented, unless the starting point of the region is the
1193 first character in the line, in which case it is line oriented.
1194 In the latter case, if the stopping point of the region is also
1195 the first character in the line, it is adjusted to be the end of the
1196 line immediately before it.
1199 Set to the line containing the beginning of the sentence.
1201 Set to the first nonblank character of the sentence.
1209 Reverse find character
1218 command, searching the other way in the line,
1227 command has not been performed yet.
1231 command may be used as the motion component of other
1233 commands, in which case any text copied into a buffer is
1239 Set to the searched-for character for the
1244 before the character for the
1247 and after the character for the
1255 Move to the first nonblank of the previous line,
1259 It is an error if the movement is past the beginning of the file.
1263 command may be used as the motion component of other
1265 commands, in which case any text copied into a buffer is
1269 Set to the current line minus
1272 Set to the first nonblank character in the line.
1280 command that modified text.
1281 The repeated command may be a command and motion component combination.
1284 is specified, it replaces
1286 the count specified for the repeated command, and, if applicable, for
1287 the repeated motion component.
1290 is not specified, the counts originally specified to the command being
1291 repeated are used again.
1293 As a special case, if the
1295 command is executed immediately after the
1297 command, the change log is rolled forward or backward, depending on
1303 Set as described for the repeated command.
1305 Set as described for the repeated command.
1310 .IP "/RE<carriage-return>"
1311 .Ip "/RE/ [offset]<carriage-return>"
1313 .Ip "?RE<carriage-return>"
1314 .Ip "?RE? [offset]<carriage-return>"
1319 Search forward or backward for a regular expression.
1320 The commands beginning with a slash
1322 character are forward searches, the commands beginning with a
1325 are backward searches.
1327 prompts with the leading character on the last line of the screen
1329 It then searches forward or backward in the file for the next
1330 occurrence of the string, which is interpreted as a Basic Regular
1337 commands are absolute movements.
1338 They may be used as the motion components of other
1340 commands, in which case any text copied into a buffer is
1341 character oriented, unless the search started and ended on
1342 the first column of a line, in which case it is line oriented.
1343 In addition, forward searches ending at the first character of a line,
1344 and backward searches beginning at the first character in the line,
1345 are corrected to begin or end at the last character of the previous line.
1346 (Note, forward and backward searches can occur for both
1354 If an offset from the matched line is specified (i.e. a trailing
1358 character is followed by a signed offset), the buffer will always
1359 be line oriented (e.g.
1361 will always guarantee a line orientation).
1365 command repeats the previous search, but in the reverse direction.
1368 command repeats the previous search.
1373 commands are used as motion components for the
1375 command, you will not be prompted for the text of the bang command,
1376 instead the previous bang command will be executed.
1379 .QT //<carriage-return> ,
1380 .QT /<carriage-return> ,
1381 .QT ??<carriage-return> ,
1383 .QT ?<carriage-return>
1384 search for the last search RE, in the indicated direction.
1386 Searches may be interrupted using the
1390 Multiple search patterns may be grouped together by delimiting
1391 them with semicolons and zero or more whitespace characters, e.g.
1393 searches forward for
1395 and then, from that location, backwards for
1397 When search patterns are grouped together in this manner,
1398 the search patterns are evaluated left to right with the
1399 final cursor position determined by the last search pattern.
1401 It is also permissible to append a
1403 command to the search strings, e.g.
1405 searches forward for the next occurrence of
1407 and then positions that line in the middle of screen.
1410 Set to the line in which the match occurred.
1412 Set to the first character of the matched string.
1425 Move to the first character in the current line.
1426 It is not an error to use the
1428 command when the cursor is on the first character in the line,
1432 command may be used as the motion component of other
1435 in which case it is an error if the cursor is on the first character
1437 and any text copied into a buffer is character oriented.
1442 Set to the first character in the line.
1454 command on the last line of the screen, using a colon
1457 The command is terminated by a
1458 .LI <carriage-return> ,
1462 character; all of these characters may be escaped by using a
1463 .LI "<literal-next>"
1465 The command is then executed.
1469 command writes to the screen,
1471 will prompt the user for a
1472 .LI <carriage-return>
1477 Large amounts of output from the
1479 command will be paged for the user, and the user prompted for a
1480 .LI <carriage-return>
1484 In some cases, a quit (normally a
1488 may be entered to interrupt the
1494 command finishes, and the user is prompted to resume visual mode,
1495 it is also possible to enter another
1497 character followed by another
1502 The current line is set as described for the
1506 The current column is set as described for the
1510 Affected as described for the
1516 Repeat the last character find
1519 The last character find is one of the
1532 command has not been performed yet.
1536 command may be used as the motion component of other
1538 commands, in which case any text copied into a buffer is
1544 Set to the searched-for character for the
1549 before the character for the
1552 and after the character for the
1559 .IP "[count] < motion"
1561 .Ip "[count] > motion"
1562 Shift lines left or right.
1563 Shift the number of lines in the region specified by the
1569 command) or right (for the
1571 command) by the number of columns specified by the
1574 Only whitespace characters are deleted when shifting left.
1575 Once the first character in the line no longer contains a whitespace
1576 character, the command will succeed,
1577 but the line will not be modified.
1582 Set to the first nonblank character in the line.
1590 Execute a named buffer.
1591 Execute the named buffer as
1594 The buffer may include
1596 commands, too, but they must be expressed as a
1599 If the buffer is line oriented,
1601 characters are logically appended to each line of the buffer.
1602 If the buffer is character oriented,
1604 characters are logically appended to all but the last line in the buffer.
1606 If the buffer name is
1610 then the last buffer executed shall be used.
1611 It is an error to specify
1615 if there were no previous buffer executions.
1616 The text of a buffer may contain a
1619 and it is possible to create infinite loops in this manner.
1622 character may be used to interrupt the loop.)
1625 The current line is set as described for the command(s).
1627 The current column is set as described for the command(s).
1633 Enter input mode, appending the text after the end of the line.
1636 is specified, the text is repeatedly input
1638 more times after input mode is exited.
1641 Set to the last line upon which characters were entered.
1643 Set to the last character entered.
1660 Move the cursor backward to the beginning of a bigword by repeating the
1661 following algorithm: if the current position is at the beginning of a
1662 bigword or the character at the current position cannot be part of a bigword,
1663 move to the first character of the preceding bigword.
1664 Otherwise, move to the first character of the bigword at the current position.
1665 If no preceding bigword exists on the current line, move to the first
1666 character of the last bigword on the first preceding line that contains a
1671 command may be used as the motion component of other
1673 commands, in which case any text copied into a buffer is
1677 Set to the line containing the word selected.
1679 Set to the first character of the word selected.
1684 .IP "[buffer] [count] C"
1685 Change text from the current position to the end-of-line.
1688 is specified, the input text replaces from the current position to
1689 the end-of-line, plus
1694 Set to the last line upon which characters were entered.
1696 Set to the last character entered.
1710 Delete text from the current position to the end-of-line.
1712 It is not an error to execute the
1714 command on an empty line.
1719 Set to the character before the current character, or, column 1 if
1720 the cursor was on column 1.
1729 Move the cursor forward to the end of a bigword by repeating the
1730 following algorithm: if the current position is the end of a
1731 bigword or the character at that position cannot be part of a bigword,
1732 move to the last character of the following bigword.
1733 Otherwise, move to the last character of the bigword at the current
1735 If no succeeding bigword exists on the current line,
1736 move to the last character of the first bigword on the next following
1737 line that contains a bigword.
1741 command may be used as the motion component of other
1743 commands, in which case any text copied into a buffer is
1747 Set to the line containing the word selected.
1749 Set to the last character of the word selected.
1754 .IP "[count] F <character>"
1757 times backward through the current line for
1762 command may be used as the motion component of other
1764 commands, in which case any text copied into a buffer is
1770 Set to the searched-for character.
1778 or the last line of the file if
1784 command is an absolute movement.
1787 command may be used as the motion component of other
1789 commands, in which case any text copied into a buffer is
1795 if specified, otherwise, the last line.
1797 Set to the first nonblank character in the line.
1803 Move to the screen line
1805 lines below the top of the screen.
1809 command is an absolute movement.
1812 command may be used as the motion component of other
1814 commands, in which case any text copied into a buffer is
1820 lines below the top of the screen.
1822 Set to the first nonblank character of the
1830 Enter input mode, inserting the text at the beginning of the line.
1833 is specified, the text input is repeatedly input
1838 Set to the last line upon which characters were entered.
1840 Set to the last character entered.
1851 lines are joined; a minimum of two lines are always joined,
1852 regardless of the value of
1855 If the current line ends with a whitespace character, all whitespace
1856 is stripped from the next line.
1857 Otherwise, if the next line starts with a open parenthesis
1860 Otherwise, if the current line ends with a question mark
1864 or exclamation point
1867 Otherwise, insert a single space.
1869 It is not an error to join lines past the end of the file,
1870 i.e. lines that do not exist.
1875 Set to the character after the last character of the next-to-last
1882 Move to the screen line
1884 lines above the bottom of the screen.
1888 command is an absolute movement.
1891 command may be used as the motion component of other
1893 commands, in which case any text copied into a buffer is
1899 lines above the bottom of the screen.
1901 Set to the first nonblank character of the
1909 Move to the screen line in the middle of the screen.
1913 command is an absolute movement.
1916 command may be used as the motion component of other
1918 commands, in which case any text copied into a buffer is
1925 command was ignored.
1928 Set to the line in the middle of the screen.
1930 Set to the first nonblank character of the
1938 Enter input mode, appending text in a new line above the current line.
1941 is specified, the text input is repeatedly input
1949 command was ignored.
1952 Set to the last line upon which characters were entered.
1954 Set to the last character entered.
1968 Insert text from a buffer.
1969 Text from the buffer (the unnamed buffer by default) is inserted
1970 before the current column or, if the buffer is line oriented,
1971 before the current line.
1974 Set to the lowest numbered line insert,
1975 if the buffer is line oriented, otherwise unchanged.
1977 Set to the first nonblank character of the appended text,
1978 if the buffer is line oriented, otherwise, the last character
1979 of the appended text.
1987 (or visual) mode and switch to
2000 Enter input mode, replacing the characters in the current line.
2003 is specified, the text input is repeatedly input
2007 If the end of the current line is reached, no more characters are
2008 replaced and any further characters input are appended to the line.
2011 Set to the last line upon which characters were entered.
2013 Set to the last character entered.
2026 .IP "[buffer] [count] S"
2032 Set to the last line upon which characters were entered.
2034 Set to the last character entered.
2047 .IP "[count] T <character>"
2051 through the current line for the character
2058 command may be used as the motion component of other
2060 commands, in which case any text copied into a buffer is
2066 Set to the character
2068 the searched-for character.
2074 Restore the current line to its state before the cursor last
2080 The first character in the line.
2089 Move the cursor forward to the beginning of a bigword by repeating the
2090 following algorithm: if the current position is within a bigword or the
2091 character at that position cannot be part of a bigword, move to the first
2092 character of the next bigword.
2093 If no subsequent bigword exists on the current line,
2094 move to the first character of the first bigword on the first following
2095 line that contains a bigword.
2099 command may be used as the motion component of other
2101 commands, in which case any text copied into a buffer is
2105 The line containing the word selected.
2107 The first character of the word selected.
2112 .IP "[buffer] [count] X"
2115 characters before the cursor.
2116 If the number of characters to be deleted is greater than or equal to
2117 the number of characters to the beginning of the line, all of the
2118 characters before the current cursor position, to the beginning of the
2124 Set to the current character minus
2126 or the first character if count is greater than the number of
2127 characters in the line before the cursor.
2132 .IP "[buffer] [count] Y"
2136 lines into the specified buffer.
2147 Write the file and exit
2149 The file is only written if it has been modified since the last
2150 complete write of the file to any file.
2154 command will exit the editor after writing the file,
2155 if there are no further files to edit.
2164 in a row will override this check and the editor will exit,
2165 ignoring any files that have not yet been edited.
2182 command is an absolute movement.
2185 command may be used as the motion component of other
2187 commands, in which case any text copied into a buffer is
2188 character oriented, unless the starting position is column 0,
2189 in which case it is line oriented.
2191 It is an error if the movement is past the beginning of the file.
2194 Set to the previous line that is
2196 section boundaries back,
2197 or the first line of the file if no more section boundaries exist
2198 preceding the current line.
2200 Set to the first nonblank character in the line.
2214 command is an absolute movement.
2217 command may be used as the motion component of other
2219 commands, in which case any text copied into a buffer is
2220 character oriented, unless the starting position is column 0,
2221 in which case it is line oriented.
2223 It is an error if the movement is past the end of the file.
2226 Set to the line that is
2228 section boundaries forward,
2229 or to the last line of the file if no more section
2230 boundaries exist following the current line.
2232 Set to the first nonblank character in the line.
2240 Move to first nonblank character on the current line.
2244 command may be used as the motion component of other
2246 commands, in which case any text copied into a buffer is
2252 Set to the first nonblank character of the current line.
2260 lines, to the first nonblank character.
2263 command may be used as the motion component of other
2265 commands, in which case any text copied into a buffer is
2268 It is not an error to execute the
2270 command when the cursor is on the first character in the line.
2273 The current line plus
2276 The first nonblank character in the line.
2282 Enter input mode, appending the text after the cursor.
2285 is specified, the text input is repeatedly input
2290 Set to the last line upon which characters were entered.
2292 Set to the last character entered.
2309 Move the cursor backward to the beginning of a word by repeating the
2310 following algorithm: if the current position is at the beginning of a word,
2311 move to the first character of the preceding word.
2312 Otherwise, the current position moves to the first character of the word
2313 at the current position.
2314 If no preceding word exists on the current line, move to the first
2315 character of the last word on the first preceding line that contains
2320 command may be used as the motion component of other
2322 commands, in which case any text copied into a buffer is
2326 Set to the line containing the word selected.
2328 Set to the first character of the word selected.
2333 .IP "[buffer] [count] c motion"
2334 Change the region of text specified by the
2338 If only part of a single line is affected, then the last character
2339 being changed is marked with a
2341 Otherwise, the region of text is deleted, and input mode is entered.
2344 Set to the last line upon which characters were entered.
2346 Set to the last character entered.
2359 .IP "[buffer] [count] d motion"
2360 Delete the region of text specified by the
2366 Set to the line where the region starts.
2368 Set to the first character in the line after the last character in the
2370 If no such character exists, set to the last character before the region.
2379 Move the cursor forward to the end of a word by repeating the following
2380 algorithm: if the current position is the end of a word,
2381 move to the last character of the following word.
2382 Otherwise, move to the last character of the word at the current position.
2383 If no succeeding word exists on the current line, move to the last character
2384 of the first word on the next following line that contains a word.
2388 command may be used as the motion component of other
2390 commands, in which case any text copied into a buffer is
2394 Set to the line containing the word selected.
2396 Set to the last character of the word selected.
2401 .IP "[count] f <character>"
2404 times, through the rest of the current line for
2409 command may be used as the motion component of other
2411 commands, in which case any text copied into a buffer is
2417 Set to the searched-for character.
2423 Enter input mode, inserting the text before the cursor.
2426 is specified, the text input is repeatedly input
2431 Set to the last line upon which characters were entered.
2433 Set to the last character entered.
2447 Save the current context (line and column) as
2449 The exact position is referred to by
2451 The line is referred to by
2456 was restricted to lower-case letters.
2458 permits the use of any character.
2469 Enter input mode, appending text in a new line under the current line.
2472 is specified, the text input is repeatedly input
2480 command was ignored.
2483 Set to the last line upon which characters were entered.
2485 Set to the last character entered.
2499 Append text from a buffer.
2500 Text from the buffer (the unnamed buffer by default) is appended
2501 after the current column or, if the buffer is line oriented,
2502 after the current line.
2505 Set to the first line appended, if the buffer is line oriented,
2506 otherwise unchanged.
2508 Set to the first nonblank character of the appended text if the buffer
2509 is line oriented, otherwise, the last character of the appended text.
2514 .IP "[count] r <character>"
2518 characters in the line are replaced with
2520 Replacing characters with
2522 characters results in creating new, empty lines into the file.
2528 the command is cancelled.
2531 Unchanged unless the replacement character is a
2533 in which case it is set to the current line plus
2536 Set to the last character replaced,
2537 unless the replacement character is a
2539 in which case the cursor is in column 1 of the last line inserted.
2544 .IP "[buffer] [count] s"
2547 characters in the current line starting with the current character.
2550 Set to the last line upon which characters were entered.
2552 Set to the last character entered.
2565 .IP "[count] t <character>"
2568 times, through the current line for the character immediately
2574 command may be used as the motion component of other
2576 commands, in which case any text copied into a buffer is
2582 Set to the character
2584 the searched-for character.
2590 Undo the last change made to the file.
2593 command alternates between these two states, and is its own inverse.
2594 When used after an insert that inserted text on more than one line,
2595 the lines are saved in the numeric buffers.
2599 command, when used immediately after the
2601 command, causes the change log to be rolled forward or backward,
2602 depending on the action of the
2607 Set to the position of the first line changed, if the reversal affects
2608 only one line or represents an addition or change; otherwise, the line
2609 preceding the deleted text.
2611 Set to the cursor position before the change was made.
2620 Move the cursor forward to the beginning of a word by repeating the
2621 following algorithm: if the current position is at the
2622 beginning of a word, move to the first character of the next word.
2623 If no subsequent word exists on the current line, move to the first
2624 character of the first word on the first following line that contains
2629 command may be used as the motion component of other
2631 commands, in which case any text copied into a buffer is
2635 Set to the line containing the word selected.
2637 Set to the first character of the word selected.
2642 .IP "[buffer] [count] x"
2646 The deletion is at the current character position.
2647 If the number of characters to be deleted is greater than or equal to
2648 the number of characters to the end of the line, all of the characters
2649 from the current cursor position to the end of the line are deleted.
2654 Unchanged unless the last character in the line is deleted and the cursor
2655 is not already on the first character in the line, in which case it is
2656 set to the previous character.
2661 .IP "[buffer] [count] y motion"
2664 the text region specified by the
2671 Unchanged, unless the region covers more than a single line,
2672 in which case it is set to the line where the region starts.
2674 Unchanged, unless the region covers more than a single line,
2675 in which case it is set to the character were the region starts.
2680 .IP "[count1] z [count2] type"
2681 Redraw the screen with a window
2683 lines long, with line
2685 placed as specified by the
2690 is not specified, it defaults to the current line.
2693 is not specified, it defaults to the current window size.
2697 characters may be used:
2702 is specified, place the line
2704 at the top of the screen.
2705 Otherwise, display the screen after the current screen, similarly to the
2708 .SP <carriage-return>
2711 at the top of the screen.
2715 in the center of the screen.
2719 at the bottom of the screen.
2723 is specified, place the line that is at the top of the screen
2726 is at the bottom of the screen, at the bottom of the screen,
2727 i.e. display the screen before the screen before
2729 Otherwise, display the screen before the current screen, similarly to the
2739 is not specified and the
2741 character was either
2745 in which case it is set to the line before the first line on the
2746 previous screen or the line after the last line on the previous
2747 screen, respectively.
2749 Set to the first nonblank character in the line.
2761 command is an absolute movement.
2764 command may be used as the motion component of other
2766 commands, in which case any text copied into a buffer is
2767 character oriented, unless the starting character is the first
2768 character on its line, in which case it is line oriented.
2771 Set to the line containing the beginning of the previous paragraph.
2773 Set to the first nonblank character in the line.
2783 position on the current line.
2787 command may be used as the motion component of other
2789 commands, in which case any text copied into a buffer is
2791 It is an error to use the
2793 command as a motion component and for the cursor not to move.
2798 Set to the character occupying the column position identified by
2800 if the position exists in the line.
2801 If the column length of the current line is less than
2803 the cursor is moved to the last character in the line.
2815 command is an absolute movement.
2818 command may be used as the motion component of other
2820 commands, in which case any text copied into a buffer is
2821 character oriented, unless the starting character is at or
2822 before any nonblank characters in its line,
2823 in which case it is line oriented.
2826 Set to the line containing the beginning of the next paragraph.
2828 Set to the first nonblank character in the line.
2836 Reverse the case of the next
2839 This is the historic semantic for the
2841 command and it is only in effect if the
2845 Lowercase alphabetic characters are changed to uppercase,
2846 and uppercase characters are changed to lowercase.
2847 No other characters are affected.
2851 command did not take an associated count, nor did it move past the
2852 end of the current line.
2853 As it had no associated motion it was difficult to change the case
2854 of large blocks of text.
2857 if the cursor is on the last character of a line, and there are
2858 more lines in the file, the cursor moves to the next line.
2860 It is not an error to specify a count larger than the number of
2861 characters between the cursor and the end of the file.
2864 Set to the line of the character after
2866 characters, or, end of file.
2868 Set to the character after
2870 characters, or, end-of-file.
2877 .IP "[count] ~ motion"
2878 Reverse the case of the characters in a text region specified by the
2882 Only in effect if the
2886 Lowercase characters are changed to uppercase,
2887 and uppercase characters are changed to lowercase.
2888 No other characters are affected.
2891 Set to the line of the character after the last character in the region.
2893 Set to the character after the last character in the region.
2901 Interrupt the current operation.
2902 Many of the potentially long-running
2904 commands may be interrupted using the terminal interrupt character.
2905 These operations include searches, file reading and writing, filter
2906 operations and map character expansion.
2907 Interrupts are also enabled when running commands outside of
2912 character is used to interrupt while entering an
2914 command, the command is aborted, the cursor returns to its previous
2917 remains in command mode.
2921 character is used to interrupt any
2922 operation, any changes made before the interrupt are left in place.
2925 Dependent on the operation being interrupted.
2927 Dependent on the operation being interrupted.
2930 .SH 1 "Vi Text Input Commands"
2932 The following section describes the commands available in the text
2939 implementations only permitted the characters inserted on the current
2941 In addition, only the
2943 erase character and the
2947 erase strings could erase autoindent characters.
2948 (Autoindent characters include both the characters inserted automatically
2949 at the beginning of an input line as well as characters inserted using the
2952 This implementation permits erasure to continue past the beginning
2953 of the current line, and back to where text input mode was entered.
2954 In addition, autoindent characters may be erased using the standard
2956 For the line and word erase characters, reaching the autoindent
2959 boundary, denoting the end of the current word or line erase.
2960 Repeating the word or line erase key will erase the autoindent characters.
2968 as character and word erase characters, respectively, regardless of
2969 the current terminal settings.
2970 This implementation accepts, in addition to these two characters,
2971 the current terminal characters for those operations.
2974 If the first character of the input is a
2976 the previous input is replayed, as if just entered.
2979 If the previous character on the line was an autoindent character,
2980 erase characters to move the cursor back to the column immediately
2981 after the previous (1-based) column which is a multiple of the
2984 This may result in any number of
2988 characters preceding the cursor being changed.
2992 option is set and the user is entering the first character in the line,
2995 Otherwise, a literal
2997 character is entered.
3000 If the previous character on the line was an autoindent character,
3001 erase all of the autoindent characters on the line.
3002 In addition, the autoindent level is reset to 0.
3005 If the previous character on the line was an autoindent character,
3006 erase all of the autoindent characters on the line.
3007 The autoindent level is not altered.
3014 characters to move the cursor forward to the column immediately
3015 after the next (1-based) column which is a multiple of the
3018 This may result in any number of
3022 characters preceding the cursor being changed.
3028 command to be used unless the cursor was at the first column of a new
3029 line or it was preceded only by autoindent characters.
3031 permits it to be used at any time during insert mode.
3036 Erase the last character.
3037 .KY "<literal-next>"
3038 .IP "<literal-next>"
3039 Quote the next character.
3040 The next character will not be mapped (see the
3042 command for more information)
3043 or interpreted specially.
3046 character will be displayed immediately as a placeholder,
3047 but will be replaced by the next character.
3050 If on the colon command line, and the
3052 edit option is set, behave as described for that option.
3053 Otherwise, if on the colon command line,
3054 execute the command.
3055 Otherwise, if not on the colon command line,
3056 resolve all text input into the file, and return to command mode.
3059 Erase the current line.
3064 Erase the last word.
3065 The definition of word is dependent on the
3071 .IP "<control-X>[0-9A-Fa-f]+"
3072 Insert a character with the specified hexadecimal value into the text.
3073 The value is delimited by any non-hexadecimal character or the input
3074 of the maximum number of characters that can be translated into a single
3078 Interrupt text input mode, returning to command mode.
3081 character is used to interrupt inserting text into the file,
3084 character was used; all text input up to the interruption is
3085 resolved into the file.