Note: The prefix ':' indicates the vim command (command mode), and the prefix '$' indicates the shell command,
CTRL + W, CTRL + Shift + 6, no prefix
All are keyboard keys in normal mode.
Basic insertion and modification:
A. Insert the cursor at the next character;
I insert at the current cursor;
Insert at the end of line;
O create a new row under the cursor and insert it;
Enter R to replace one character;
Enter R to replace all characters;
'. The cursor is positioned at the last modification;
U undo
Redo
: E! Undo all changes.
File Search and replacement:
*, # Search for the same word (if set hlsearch is enabled,
All matching words are automatically highlighted)
[[
/DEST query the next one by N; n query the previous one;
? DeST reverse lookup;
: #,# S/old/new/g replace all the old rows with new
: % S/old/new/g Replace the entire file globally, old-> new;
: S/old/new only replaces the next matched string
: S/old/new/g to replace the old-> new;
File cursor location:
% Parentheses
CTRL + G display current row number
Linenum + G jump to a line
G to the last line
H to the first line
^ Jump to the beginning of the line
$ Jump to the end of a row
FX moves to the next/previous word starting with x
[[Skip to the first column {(usually the beginning of the function)
] Jump to the next {
{Skip to a blank line
} Jump to the next empty line
When the GD cursor locates on a local variable, it jumps to its definition;
When using csflood, run at the top level of the source file
$ Cscope-indexer generates the cscope tags, then searches for definitions of various data types, and then uses
Return to the original position of the cursor.
Shell:
:! Using name: Use the shell command named name temporarily
: Sh returns to shell temporarily (exit returns to the vim editing interface)
Multi-file operations:
$ VI file1 file2 read multiple files at a time (all wildcards of shell are supported)
: SP file open the file from a new horizontal split window
: VD file open file from a new vertical separation window
: N,: n switch between files in the current window
Switch between two files in the current window
: Sex opens the directory browser in the new split window
: Ls: list the files currently being edited
: B x the current window jumps to the buffer of file X (: ls to list serial numbers)
: B file: the current window jumps to the File Buffer whose file name contains "File ".
+ Quick Switch across multiple windows (CTRL + W twice)
Others:
In insert mode, the words/structures used for syntax are automatically completed.
Common settings:
$ CP/usr/share/Vim/vim70/vimrc_example.vim ~ /. Vimrc
The above is a basic setting
: Set hlsearch highlight/and? Command to find the result;
: Set num: displays the row number of each row.
If you want to use the VI syntax color when logging on to fterm, set termtype
Xterm-color, or $ export term = xterm-color should also be ......
This article is from the chinaunix blog. If you want to view the original text, click:Http://blog.chinaunix.net/u/24174/showart_175131.html