Name

vim — stdin  stdout  - file  -- opt  --help  --version

Synopsis

vim [options] [files]

vim is an enhanced version of the old standard Unix editor vi. To invoke the editor in a new X window, run:

$ gvim

To run in a existing shell window:

$ vim

To run the vim tutorial, run:

$ vimtutor

vim is a mode-based editor. It operates in two modes, insert and normal. Insert mode is for entering text in the usual manner, while normal mode is for running commands like “delete a line” or copy/paste. For basic keystrokes in normal mode, see Table 1-1.

Table 1-1. Basic keystrokes in emacs and vim

Task

emacs

vim

Type text

Just type

Type i, then any text, and finally ESC

Save and quit

^x^s then ^x^c

:wq

Quit without saving

^x^c

Respond “no” when asked to save buffers

:q!

Save

^x^s

:w

Save As

^x^w

:w filename

Undo

^/ or ^x u

u

Suspend editor (not in X)

^z

^z

Switch to edit mode

(N/A)

ESC

Switch to command mode

M-x

:

Abort command in progress

^g

ESC

Move forward

^f or right arrow

l or right arrow

Move backward

^b or left arrow

h or left arrow

Move up

^p or up arrow

k or up arrow

Move down

^n or down arrow

j or down arrow

Move to next word

M-f

w

Move to previous word

M-b

b

Move to beginning of line

^a

0

Move to end of line

^e

$

Move down one screen

^v

^f

Move up one screen

M-v

^b

Move to beginning of buffer

M-<

gg

Move to end of buffer

M->

G

Delete next character

^d

x

Delete previous character

BACKSPACE

X

Delete next word

M-d

de

Delete previous word

M-BACKSPACE

db

Delete current line

^a^k

dd

Delete to end of line

^k

d$

Define region (type this keystroke to mark the beginning of the region, then move the cursor to the end of the desired region)

^ Space bar

v

Cut region

^w

d

Copy region

M-w

y

Paste region

^y

p

Get help

^h

:help

View the manual

^h i

:help

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.120.109