Vim is a powerful editor that I use mostly with her as an edit file, and also has a cow who makes her play the Super IDE. But... It always feels like this is a powerful brain to use, such as my little rookie or just be honest with a dedicated IDE. The following is a list of my frequently used vim commands:
Note: command with a colon in the bottom row mode
Mode
The Vim editor can be divided into 3 modes, namely command mode, insert mode, and bottom line mode, which are in command mode for the newly opened file.
To enter the bottom line mode from the command mode:
#输入冒号:
Enter command mode from the bottom line mode:
#按下Esc键Esc
To enter insert mode from command mode:
#在光标左侧输入i # Enter a# at the beginning of the line of the cursor and enter i# at the end of the row of the cursor a# enter a new line below the line where the cursor is located o# create a new line at the top of the line where the cursor is located o
To enter command mode from Insert mode:
#按下Esc键Esc
Content editing
Cursor Movement:
#左移h # Move Right l# Move Down J # Move up K
Select text:
+ v# selects the entire contents of the current file GGVG
Copy text:
#复制选中的内容y
#复制光标所在的单词
yw# Copy the selected contents to the system pasteboard by copying the line yy# the cursor+y
Paste text:
#把默认寄存器中的内容粘贴到光标后面p # Paste the contents of the default register into the front of the cursor p# paste the contents of the system clipboard behind the cursor; +p# Paste the contents of the system Clipboard into the front of the cursor; +p
Delete:
#删除一行 DD #删除光标所在的单词dw # Delete the character after the cursor x# delete the character in front of the cursor x# Remove from the cursor position to the wardrobe x^#从光标位置删除到行尾x $ #从光标所在行往后删2行2xx
Undo/Redo:
#撤销u
+ R:redo
File operations
Exit/Save:
#退出: q# Force quit (discard changes): Q! #保存并退出: wq:x# force Save and exit: Wq! : x!
To open a new file:
: e file_name
Save As:
:W file_name
Display multiple files at the same time:
:split: Vsplit
Switch between multiple files:
+ h/j/k/+ ww
Find and replace
General Search:
#在命令模式下, input slash + What to look for, support regular expression /text# next match n# previous match n
General Replacement:
#把第一个匹配词替换, replace the first matching old_text with new_text:s/old_text/new_text# replaceall matching words, replacing all matching old_text with new_text:s /old_text/new_text/g
Reprint Please specify source: http://www.cnblogs.com/keitsi/p/5829958.html
Vim Common commands