Use Vim for IDE

Source: Internet
Author: User

 

Emacs has been used intermittently for several years, but still feels unskillful. It mainly involves Automatic completion and automatic prompt, and it feels too complicated in Emacs. Try Vim today to see if it is convenient.

After gvim is installed in Windows or Linux, copy the taglist, minibuffer, and omnicppcomplete plug-ins
Vim plug-in directory (Linux can be placed under. Vim in the user directory, windows can be placed under vimfiles in the Vim installation directory), and then restart gvim plug-in
It automatically takes effect.

Minibuffer: when multiple buffers are opened in the same vim, minibuffer automatically opens a small buffer at the top of the buffer. Each buffer is displayed one by one. You can directly double-click the buffer to switch between the two buffers.

Both taglist and omnicppcomplete require the support of ctags. You can use apt to install the taglist and omnicppcomplete in Linux, or download the source code to compile and install it yourself. For Windows, you can download the officially compiled version to the vim installation directory.

Taglist: As long as Vim can find the ctags command in the path, taglist can be run successfully by executing the command tlist.
. After the taglist is started, opening a source code file will automatically display the file tag list in the taglist buffer on the left side. You can jump between tags by mouse or keyboard.

Omnicomplete is a built-in plug-in of VIM, used to implement code automatic prompts (can implement C, but cannot implement C ++ automatic prompts), first generate ctags for the project
Run the ctags-R command to generate the ctags file, and then run the following command in VIM: Set
Tags + =/path/to/ctags Add the generated ctags file to the ctags list, then press the C-X after the struct. Or->, the C-O will pop up a prompt
List. In addition to C-X, C-I and other options, specific to see the document. The default automatic prompt will display detailed information with a small buffer. You can use the set
Completeopt = longest, menu to show only one detailed menu to save the screen space.

Omnicppcomplete: the built-in omnicomplete cannot implement automatic prompts for C ++, and another plug-in is required for C ++.
Omnicppcomplete help. After omnicppcomplete is installed, restart Vim. omnicppcomplete automatically registers the C ++ Language
Prompt. However, the ctags file generated by ctags-R is not enough for C ++. You need to use ctags-C ++-kinds = + P
-Fields = + IAS
-Extra = + q is used to generate the ctags file. It will add some special information of C ++. In this case, omnicppcomplete can be automatically prompted for C ++. And
Omnicppcomplete will be in C ++ into. Or-> when the automatic pop-up prompt, do not need to press the C-X, C-O, so it is more convenient. Of course, in the absence of. or
-> The place where the prompt is needed can still be pressed to C-X, c-o.

Automatic jump: After the ctags file is available, you can also achieve automatic jump in VIM by moving the cursor to the variable to jump, press Ctrl-], will automatically jump to the corresponding definition according to the content of the ctags file, and then press the CTRL-T will jump to the original location.

The keys automatically completed in the buffer in BTW: Vim are CTRL-N, similar to the M-/function in Emacs.

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.