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 E492: Not an editor command: ^M
- [Editor][001][vim]VIM的辅助工具们
- 【iOS开发-38】为什么在用storyboard打开Assistant Editor时默认是.m文件?
- 解决vim E492: Not an editor command: ^M
- vim :An Advanced Text Editor
- [Linux Shell] vim editor quit without content leave on the screen
- VIM 101: a quick-and-dirty guide to our favorite free file editor
- vim editor config
- Hex Editor in Linux —— hte —— VIM
- 跟我一起学习VIM - The Life Changing Editor
- 跟我一起学习VIM - The Life Changing Editor
- Xcode4中利用Assistant editor关联面板操作完成了什么?
- 跟我一起学习VIM - The Life Changing Editor
- Hacking Vim: A Cookbook to get the Most out of the Latest Vim Editor
- spf13-vim – The Ultimate Distribution for Vim Editor
- 跟我一起学习VIM - The Life Changing Editor
- vim - Run python code in vim editor
- RHCE033 Unit9 vim: An Advanced Text Editor
- VI/VIM text editor 12 Powerful Find and Replace Examples
- RHCE033 Unit9 vim: An Advanced Text Editor