Vim builds ide

Source: Internet
Author: User
Tags autoload prototype definition

1. First install the plug-in Manager Pathogen

Install~/.vim/autoload/pathogen.vim

mkdir -p ~/.vim/autoload ~/.vim/bundle && curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
Create a. vimrc file in the centos home directory and add:
execute pathogen#infect()syntax onfiletype plugin indent on
View pathogen installation documentation: https://github.com/tpope/vim-pathogen

2. Install nerdtree

To download and install the nerdtree plug-in, you only need to enter ~ /. Vim/bundle/directory, and then execute the following command:
Git clone http://github.com/scrooloose/nerdtree.git
After the download is complete, you will see ~ /. Vim/bundle/directory will have a new directory: nerdtree

To uninstall the plug-in, you only need ~ /. Vim/bundle/directory: Delete the nerdtree directory!
To update the plug-in to the latest version, you only need to enter the directory ~ /. Vim/bundle/nerdtree/and execute the following command:
Git pull Origin

Easy to use:

Global commands

  • : Nerdtree [<start-directory >|< bookmark>]
    • Open a new nerdtree.
    • If no parameter exists, the current directory is the root directory.
    • If a start directory or bookmarks exist, the start directory or bookmarks are the root directory.
  • : Nerdtreefrombookmark <bookmark>
    • Open a new nerdtree with bookmarks
  • : Nerdtreetoggle [<start-directory> | <bookmark>]
    • Switch the nerdtree
  • : Nerdtreemirror
    • Share an existing nerdtree
  • : Nerdtreeclose
    • Disable tree
  • : Nerdtreefind
    • Search for the current file in the tree
  • : Nerdtreecwd
    • Change the root of the tree to the current directory.
View More: http://www.cnblogs.com/summericeyl/p/3502479.html


3. Install the supertab plug-in

The supertab plug-in is used to make the tab key on the keyboard more convenient for auto-completion and context prompt functions. In ~ Download and install the plug-in the/. Vim/bundle/directory:

Git clone https://github.com/ervandew/supertab.git

After installation, you can directly use the auto-completion function in Vim. For example, use Vim to open. in the c file, to declare a variable of the unsigned int type, you only need to enter the unsi and press the tab key to automatically complete the keyword, which is very useful.


4. Install syntastic

If you need to program in more than one language, it is sometimes very easy to confuse the syntax between different languages. Fortunately, syntastic will help you check and tell you whether parentheses or square brackets should be added or if you forget a semicolon somewhere.

cd ~/.vim/bundle && \git clone https://github.com/scrooloose/syntastic.git
Start: helptags

Detailed installation process: https://github.com/scrooloose/syntastic


5. InstallTagbar

The tagbar can be used as a substitute for the taglist ~ Run the following command to install the/. Vim/bundle/directory:

git clone https://github.com/majutsushi/tagbar.git  


You can also set the shortcut key in the vimrc file:

nmap <F2> :TagbarToggle<CR>let g:tagbar_ctags_bin='/usr/bin/ctags'let g:tagbar_width=30autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen()

Run ": tlist" on the vim command line to open the taglist window. Run ": tlist" again to close the window.

CTRL + WW switching between left and right windows

In taglistWindow, You can use the following shortcut keys:


<CR> jump to the position defined by the tag under the cursor. Double-click the tag with the mouse.
O display the tag under the cursor in a new window
<Space> display the prototype definition of the tag under the cursor
U update the tag in the taglist window
S. Change the sorting method and switch between name-based and order-based.
The X taglist window is zoomed in and out to facilitate viewing long tags.
+ Open a fold, same as Zo
-Fold the tag, same as ZC
* Open all folds, same as Zr
= Fold all tags, same as ZM
[[Jump to the previous file
] Jump to the next file
Q: Close the taglist window.
<F1> Show Help

If the mouse clicks in VIM is invalid, go ~ /. Add this sentence under vimrc: Set mouse = A "always use mouse


"Common configuration options 』

-The tlist_ctags_cmd option is used to specify the location of your exuberant ctags program. If it is not in the path defined by your path variable, you need to use this option to set it;

-If you do not want to display tags in multiple files at the same time, set tlist_show_one_file to 1. By default, tags in multiple files are displayed;

-If tlist_sort_type is set to "name", the taglist can be sorted by Tag name. By default, the tag is sorted by the order in which the file appears. Sort by TAG range (namespace or class). The todo list that has been added to the taglist is not supported yet;

-If you exit Vim when you want to use the taglist window as the last window, set tlist_exit_onlywindow to 1;

-If you want to display the taglist window on the right, set tlist_use_right_window to 1. It is displayed on the left by default.

-In gvim, if you want to display the taglist menu, set tlist_show_menu to 1. You can use tlist_max_submenu_items and tlist_max_tag_length to control the number of menu entries and the length of the displayed tag name;

-By default, When you double-click a tag, it will jump to the defined position of the tag. If you want to click the tag, set tlist_use_singleclick to 1;

-If you want to open the taglist window automatically after Vim is started, set tlist_auto_open to 1;

-If you want to automatically close the taglist window after selecting a tag, set tlist_close_on_select to 1;

-When the tag of multiple files is displayed at the same time, set tlist_file_fold_auto_close to 1, so that the taglist displays only the tag of the current file, and the tags of other files are collapsed.

-When Using tlisttoggle to open the taglist window, if you want to focus on the taglist window, set tlist_gainfocus_on_toggleopen to 1;

-If you want the taglist to always parse the tag in the file, set tlist_process_file_always to 1 regardless of whether the taglist window is opened;

-Tlist_winheight and tlist_winwidth can be used to set the height and width of the taglist window. Tlist_use_horiz_window: 1. Set the horizontal display of the taglist window;


Usage: In ~ /. In the vimrc file, add the options to be set in a format similar to the one mentioned above.

For example, if you click a tag to jump to the location defined by the tag, add the following sentence to the file:

Let tlist_use_singleclick = 1



The final configuration of my. vimrc is as follows:

execute pathogen#infect()syntax onfiletype plugin indent onnmap <F2> :TagbarToggle<CR>let g:tagbar_ctags_bin='/usr/bin/ctags'let g:tagbar_width=30autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen()set mouse=a  " always use mouse  



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.