您的位置:首页 > 其它

Vim Editor Assistant

2017-03-26 11:33 183 查看

Start vi Editor

vi file
// Opens 'file' in vi, or creates a file named 'file' if it does not exist.


vi file1 file2
// Opens files sequentially.


view file
// OPens 'file' in read-only mode.


vi -R file
// Opens 'file' in read-only mode.


vi -r file
// Recovers 'file' after system crash.


vi + file
// Opens 'file' at last line.


Exit vi Editor

ZZ
// Saves changes and exits.


:x
// Saves changes and exits.


:wq
// Saves changes and exits.


:w
// Saves changes.


:q
// Quit.


:q!
// Quit without saving changes.


:wq file
// Saves as 'file' and exits.


Insert, append

i
// Insert text before cursor.


I
// Insert text at beginning of current line.


a
// Append text after cursor.


A
// Append text at the end of current line.


o
// Open and insert text in new line below current line.


O
// Open and insert text ine new line above current line.


r
// Replace single character at cursor position.


R
// Replace multiple character starting with character at cursor position.


s
// Substitute a single character.


S
// Substitute entire line.


Delete

x
// Deletes a single character at cursor position.


X
// Deletes a single character before cursor positon.


dw
// Deletes from cursor position to next word.


dd
// Deletes entire line cursor is on.


D
// Deletes remainder of line, starting at cursor position.


[Ctrl] u
// Deletes from cursor to beginning of line.


d$
// Deletes from cursor to end of line.


d^
// Deletes to first character in line, preserving indentation.


ndd
// Deletes n number of lines (2dd deletes 2 lines).


nx
// Deletes n number of characters, starting with character under cursor (2x deletes 2 characters).


Yank, Copy

yw
// Yank word.


yy
// Yank current line.


:y
// Yank current line.


y^
// Yank from cursor to first character of line.


y0
// Yank from cursor to beginning of line.


y$
// Yank from cursor to end of line.


Y
// Yank current line.


nyy or nY
// Yank n number of lines (2yy or 2Y copies 2lines).


Paste

p
// Paste after cursor.


P
// Paste before cursor.


Search

/word
// Search forward for 'word'.


?
// Repeats previous '/' search.


n
// Repeat last search in same direction.


N
// Repeat last search in opposite direction.


*
// Search forward for word under the cursor.


#
// Search backward for word under the cursor.


fx
// Search forward for next 'x' on same line.


Fx
// Search backward for previous 'x' on same line.


tx
// Search forwark for character before next 'x'.


Tx
// Search backward for character after previous 'x' on same line.


Move cursor

H
// Move to highest visible line on screen (top line).


M
// Move to middle of screen (center).


L
// Move to lowest visible line on screen (bottom line).


l
// Move right.


h
// Move left.


K
Move up.


j
Move down.


^
// Move to first character on current line.


$
// Move to last column on current line.


0
// Move to first column on current line.


+
// Move to first character on next line.


-
// Move to first character on previous line


w
// Move to beginning of next word.


b
// Move to beginning of previous word.


(
// Move to beginning of current sentence.

)
// Move to beginning of next sentence.


{
// Move a paragraph back.

}
// Move a paragraph forward.


G
// Move to first character on last line.

gg
// Move to first character on first line.


Move screen

[Ctrl] d
// Move backward half screen.

[Ctrl] f
// Move backward full screen.

[Ctrl] u
// Move forword half screen.

[Ctrl] b
// Move forward full screen.

[Ctrl] e
// Move up one line.

[Ctrl] y
// Move down one line.


G
// Move to last line in file.

nG
// Move to n number line.


Other

.
// Repeat last edit command.


u
// Undo last change.

U
// Undo all changes on line.


[Ctrl] g
// Show current filename and line count.


:f
// Show current filename and line count.


:f filename
// Rename current file to 'filename'.


:cd dirname
// Change directory to 'dirname'.


~
// Change character case.


:.=
// Show current line number.


:=
// Show total number of lines.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  vim