Linux-vim Common Commands

Source: Internet
Author: User
Tags imap prototype definition tag name tagname egrep

Vim Common commands

"," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
H Move left one
L Move Right One
K Move up one
J Move Down one

0 cursor to the beginning of the current line
$ cursor to the end of the current line
^ The cursor moves to the first non-space/tab character on the current line

W cursor moves to the beginning of the next word
e cursor moves to the ending of the next word
b cursor moves to the first word of the previous word

"," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

yy or Y copy the entire line of the cursor
y^ copied to the beginning of the line of the cursor, excluding the cursor position character
y$ copied to the end of the line where the cursor is located, including the cursor position character
YG Copy to end of file
Y1G copy to top of file
Nyy the n rows at which the cursor is copied.

"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

P (lowercase) paste to Cursor
P (uppercase) Paste to the front of the cursor

"," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

X (lowercase) Delete cursor before one character
X (uppercase) Delete cursor after one character
DD deletes the entire line of the cursor
DW Delete a word where the cursor is located
DG Delete the cursor line to the end of the file
DGG delete the cursor line to the top of the file
D Delete to the end of the line, including the character at the cursor
D0 Delete to the beginning of the line, excluding the character at the cursor

"" "" "" "" Undo "" "" "" "

U save before Undo
Ctrl+r Redo Redo

"" "" "" "Find" "" "" "" "" "

/string is equivalent to find, starting at the cursor starting down to find string n find the next n find the previous
? string from the cursor up to find n Find the previous n Find Next

"" "" "" "Mapping" "" "" "" ""

Nmap: Maps a key in normal mode, which takes effect only in normal mode.
Example: Nmap, S:source $VIM/_vimrc<cr>
Description: Binding ", S" in normal mode mapped to ": Source $VIM/_vimrc<cr>" command, i.e. re-read configuration
File _VIMRC.
:
IMAP: Maps a key in insert mode, which only takes effect in the insert mode.
Example: IMAP <F11>: R c:\boot.ini<cr>
Description: The bind F11 in insert mode is mapped to the ": R c:\boot.ini<cr>" command, which reads the C:\Boot.ini file to the current location.

VMAP: Maps a key in visual mode and only in visual mode does this command take effect.
Example: Vmap SB "zbi<b><c-r>z</b><esc>
Note: After selecting the text, press SB, and before and after the selected text will be added <b> and </b> respectively.
Re-example: Vmap g/y/<c-r> "<cr>
Description: Map "g/" This key combination to match the selected word and give it a highlight.

Map: Keys bound with map are valid for normal, Insert, visual, and command-line modes.
Example: Map <F5>: Ls<cr>:e #
Description: Map the F5 key so that pressing F5 displays the buffer of the currently editable file and prompts you to enter the line number of buffer.

Detailed reference http://blog.csdn.net/linux_kernel_fan/article/details/18894253

"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
"" "Switch in the Window" ""
CTRL+W+W switch in the multi-window sequence
Ctrl+w+h switch to the left window
Ctrl+w+l switch to the right window
Ctrl+w+k
Ctrl+w+j

"" "Change the size of the window" "" "
: res[ize] +n adds n rows to the current window
: Res[ize]-n Ibid. opposite

: Vertical res[ize] +n increase the width of the n column
: Vertical Res[ize]-n Ibid. opposite

ctrl+w+= make all windows equal width, equal height
n+ctrl+w+ + Increase n Row height
n+ctrl+w+-ditto opposite

n+ctrl+w+> Increase N Column width
n+ctrl+w+< Ibid. opposite

"," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "

Ctrl-r
"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
< cr> jump to the position defined by tag under the cursor, double-click the tag function with the mouse
<space> display the prototype definition of tag under cursor
o display the cursor under tag in a newly opened window
U update tag in taglist window
s change sort mode, toggle between sort by name and sort by order
x taglist window zooms in and out to make it easier to see longer tags
+ Open a folding, with Zo
-Fold the tag together with ZC
* Open all folds, with ZR
= Fold all tags together with ZM

% jump to match the parentheses to go

Sometimes I don't know how to match {}
[[Jumps to the previous code block (' {' must have a single line)
]] to jump to the next block of code

GD jumps to local variable definition
' Jump to the place where the cursor was last docked, is two ', not a '
MX settings bookmark, x is a-Z 26 letter
' x jump to the bookmark ("'" is 1 left button)

Enter v mode to indent multiple lines
> Increase Indent, "x>" to increase indentation for the following x rows in the current row
< contrary to the above

CTRL +] jumps to the label at the cursor line
Ctrl+t jumps back to the previous label
Ctrl+o Return to previous label
ctrl+w+] New window displays the current cursor under the label, the cursor jumps to the label (: Close can close the new window)

: Tag tagname replaces the current window file with the file containing the tag
: Stag tagname split the current window and the cursor jumps to the label (: Split And:tag tagname)
: Tnext jumps to other matches of the same label
: Tselect tagname Displays a list of tgname, and then jumps to the specified tagname label by entering a match number
: TFirst jumps to the first matching label
: [Count]tprevious forward [count] matches a label at
: [Count]tnext backward [count] matches a label at
: Tlast matches last label

: Tag write_<tab> Auto complement remainder
: Tag/block the "/" in front of the tag name tells Vim that this is not a deterministic label name but a pattern, and then finds all
Match block tags
:p Tag tagname Open the preview window to display the TagName label
Close the preview window:p close
:p edit filename in the preview window, editing the specified file
:p Search word finds the current file and any files that contain word, and displays the matching word in the preview window (seldom used,
And it's easy to search for word inside the note)

"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Cscope "" "" "" "" "" "" "" "" "" "" "" "" "" "
1. Cscope cmd parameters

-r: Searching for code in the subtree when building an index file
-B: Only the index file is generated and does not enter the Cscope interface
-Q: Generate Cscope.in.out and cscope.po.out files to speed up cscope indexing
-K: The/usr/include directory is not searched when the index file is generated
-I: If the file name of the saved files list is not cscope.files, you need to add this option to tell Cscope where to find the source file column
Table. You can use "-" to indicate that a list of files is obtained by standard input.
-I dir: Find header file in directory indicated by-i option
-U: Scan all files, regenerate cross-index files
-C: Ignore case when searching
-P Path: Add a path to a file represented by a relative path, so that you can use it without switching to the directory where your database file is located.

2.: cscope Find cmd params

S: Find the C language symbol, that is, find the function name, macro, enumeration value and other occurrences of the place
G: Find the location defined by functions, macros, enumerations, and similar functions provided by ctags
D: Find functions called by this function
C: Find functions that call this function
T: finds the specified string
E: Find Egrep mode, equivalent to Egrep function, but find much faster
F: Find and open files, like Vim's find function
I: Find article A that contains this document

"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""



"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Omnicppcomplete "


"," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "

Vim configuration follow up, please wait

by Wushang 2014/05

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.