UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 8.1 Review of vi OperationsChapter 8
The vi Editor
Next: 8.3 Edit Commands
 

8.2 Movement Commands

A number preceding a command repeats the movement. Movement commands are also objects for change, delete, and yank operations.

8.2.1 Character

h, j, k, lLeft, down, up, right (<-, -v, -^, ->).
SpacebarRight.

8.2.2 Text

w, W, b, BForward, backward by word.
e, EEnd of word.
), (Beginning of next, current sentence.
}, {Beginning of next, current paragraph.
]], [[Beginning of next, current section.

8.2.3 Lines

0, $First, last position of current line.
^First nonblank character of current line.
+, -First character of next, previous line.
ReturnFirst character of next line.
n|Column n of current line.
HTop line of screen.
MMiddle line of screen.
LLast line of screen.
nHn lines after top line.
nLn lines before last line.

8.2.4 Screens

CTRL-FScroll forward, backward one screen.
CTRL-B
CTRL-DScroll down, up one-half screen.
CTRL-U
CTRL-EShow one more line at bottom, top of window.
CTRL-Y
z ReturnReposition line with cursor to top of screen.
z.Reposition line with cursor to middle of screen.
z-Reposition line with cursor to bottom of screen.
CTRL-LRedraw screen (without scrolling).
CTRL-R

8.2.5 Searches

/textSearch forward for text.
nRepeat previous search.
NRepeat search in opposite direction.
/Repeat forward search.
?Repeat previous search backward.
?textSearch backward for text.
/text/+nGo to line n after text.
?text?-nGo to line n before text.
%Find match of current parenthesis, brace, or bracket.
fxMove search forward to x on current line.
FxMove search backward to x on current line.
txSearch forward to character before x in current line.
TxSearch backward to character after x in current line.
,Reverse search direction of last f, F, t, or T.
;Repeat last character search (f, F, t, or T).

8.2.6 Line Numbering

CTRL-GDisplay current line number.
nGMove to line number n.
GMove to last line in file.
:nMove to line number n.

8.2.7 Marking Position

mxMark current position with character x.
`xMove cursor to mark x.
'xMove to start of line containing x.
``Return to previous mark (or to location prior to a search).
''Like above, but return to start of line.


Previous: 8.1 Review of vi OperationsUNIX in a Nutshell: System V EditionNext: 8.3 Edit Commands
8.1 Review of vi OperationsBook Index8.3 Edit Commands

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System