Vim Advanced Usage Tips second article

Source: Internet
Author: User

I posted my use of vim configuration and plug-in configuration, these things can only be a script stack, no discussion of efficient code reading development.

Let's write the frequently used commands, and start with the Configure F-Series shortcut keys.

f+ N Shortcut key configuration

F1 basically when help, this seemingly can not be terminal help use,

F2 displays or does not display line numbers, which are displayed by default, which is useful when you need to copy some operations.

F3 display, or do not wrap the display, in some, such as the makefile command longer can be used to quickly modify the things in it, the default is no line break

F4 List of functions for outgoing files (tagbartoggle)

F5 paste Mode Paste_mode switch, used for formatted code paste, because of the intelligent indentation of our VIM configuration, this switch can be copied on the Web page of the formatted things are not vim indentation OH

F6 close syntax can speed up the presentation of large files

F9 this defines a function to parse the engineering directory with Gtags, which is about the same as the Ctags analysis, it is said to be able to brake the update, but I use less

F12 This is the integration of Ctags, cscope two functions, as long as you want to build the root directory of the project by F12 wait for a while you can use the Cscope command (this is more powerful)

The above shortcut keys can be changed in the. VIMRC script in my previous article according to your custom F12 button I configured the resolution of the whole, if you do not need a full resolution, please modify the Do_cstag () configuration in the. vimrc

Do not know how to configure please Google, Bing, Baidu.

After executing F9 or F12 You can use the Cscope command to read the code (the execution of the F9 will need to be closed when the Open is OK because I do F9 after the completion of the self-loading problem)

If you have a configuration that can be loaded automatically please leave a message for me.

Operation Shortcut Key Configuration

1. How the Cscope command executes

Enter shift+ in browse mode: then enter CS F to keep up with the string you're looking for. This is where you find the string you typed in your parsing engineering directory so file location

Of course, this type of input is still a bit of a hassle. We configured shortcut keys:

After the cursor is moved to the string in the code

    1. Press ctrl+/First and then

    2. C: Find the location where the function was called

    3. D: Find out which functions the function called

    4. E: Find the specified regular expression

    5. F: Find the specified file

    6. G: Find the defined location of the specified identifier

    7. I: Find out where the file is contained

    8. S: find where to use the specified identifier

    9. T: finds the specified text string

2. Multi-window and switch

Press CTRL + W first and then

W: Change up and down two windows

V: Turn around two windows

O: Revert back to a window

Switch between windows with CTRL +

H: Move to the Left

L: Move to the right

J: Move to the bottom

K: Move to Top

3. Switch between files has been opened

In browse mode, enter SHIFT +: Enter B 5 to jump to the Android.mk file, or you can switch directly using the TAB key (this window appears after opening multiple files)

4. Quickly move lines of code

J (Move Down) K (Move up one row) H (move left column) L (move right one column) in browse mode

Shift + H (move to beginning) SHIFT + L (move to end of line) GG (moves to file start) shift+g (move to file end) SHIFT + f (scroll down one screen) SHIFT + B (top up one screen)

First enter a number and then SHIFT + g (jump directly to that line) W (move back one string) B (move forward a string)

5. Copy Delete

Shift + V (select row) Ctrl + V (select column) and enter y (copy) d (delete) yy (row copy) dd (row delete) digit + yy (multi-line copy) digit + DD (multiline delete)

6. Find Replacements

Shift + * Current string (string highlighting) n (next occurrence position) SHIFT + N (last occurrence position)

%s/string1/string2/g Command mode replaces all string1 in this article with the question string2

Basically the usual functions are listed below we talk about Youcompleteme code auto-completion

The first time to get blog update reminders, as well as more technical information sharing, welcome to the personal public platform: Programmer Interaction Alliance (Coder_online), sweep the QR code below or search number Coder_online can pay attention to, We can communicate online.

Excerpt from: http://www.cnblogs.com/yistn/p/4383474.html

Vim Advanced Usage Tips second article

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.