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-F, CTRL-BScroll forward, backward one screen.
CTRL-D, CTRL-UScroll down, up one-half screen.
CTRL-E, CTRL-YShow one more line at bottom, top of window.
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-L, CTRL-RRedraw screen (without scrolling).

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 before x in current line.
TxSearch back 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