2.10 Other Vi Commands

Miscellaneous Vi commands are collected here.

Z Z

Exit Emacs. If modified buffers exist, you will be asked whether you wish to save them or not (save-buffers-kill-emacs).

! motion-command format-command
n ! ! format-command

The region determined by the motion command motion-command will be given to the shell command format-command and the region will be replaced by its output. If a count is given, it will be passed to motion-command. For example, ‘3!Gsort’ will sort the region between point and the 3rd line. If ! is used instead of motion-command then n lines will be processed by format-command (vip-command-argument).

J

Join two lines. Given count, join that many lines. A space will be inserted at each junction (vip-join-lines).

< motion-command
n < <

Shift region determined by the motion command motion-command to left by shift-width (default is 8). If < is used instead of motion-command then shift n lines
(vip-command-argument).

> motion-command
n > >

Shift region determined by the motion command motion-command to right by shift-width (default is 8). If < is used instead of motion-command then shift n lines
(vip-command-argument).

= motion-command

Indent region determined by the motion command motion-command. If = is used instead of motion-command then indent n lines (vip-command-argument).

*

Call last remembered keyboard macro.

#

A new vi operator. See Some New Commands, for more details.

The following keys are reserved for future extensions, and currently assigned to a function that just beeps (vip-nil).

&, @, U, [, ], _, q, ~

VIP uses a special local keymap to interpret key strokes you enter in vi mode. The following keys are bound to nil in the keymap. Therefore, these keys are interpreted by the global keymap of Emacs. We give below a short description of the functions bound to these keys in the global keymap. See GNU Emacs Manual for details.

C-@

Set mark and push previous mark on mark ring (set-mark-command).

TAB

Indent line for current major mode (indent-for-tab-command).

C-j

Insert a newline, and maybe indent according to mode.

C-k

Kill the rest of the current line; before a newline, kill the newline. With a numeric argument, kill that many lines from point. Negative arguments kill lines backward (kill-line).

C-l

Clear the screen and reprint everything (recenter).

n C-p

Move cursor vertically up n lines (previous-line).

C-q

Read next input character and insert it. Useful for inserting control characters
(quoted-insert).

C-r

Search backward incrementally (isearch-backward).

C-s

Search forward incrementally (isearch-forward).

n C-t

Interchange characters around point, moving forward one character. With count n, take character before point and drag it forward past n other characters. If no argument and at end of line, the previous two characters are exchanged (transpose-chars).

n C-v

Scroll text upward n lines. If n is not given, scroll near full screen (scroll-up).

C-w

Kill between point and mark. The text is save in the kill ring. The command P or p can retrieve it from kill ring (kill-region).