How to make vim the source insight under Linux

Source: Internet
Author: User
Tags switch case

Written by: Rongshiko

Email: [Email protected]

2016-01-06

As we all know, the source insight under Windows is the artifact that reads project code, and its magic is that you can search for the definition of the function or variable according to the function name or variable currently referred to by the mouse, and also

Shows which files also contain the function definition, and can also display a list of variables and functions in the current file. Therefore, it is particularly suitable for large project code reading and management under Windows with source insight. But Linux can't

Install source insight, and vim and Emacs are Linux under the editing code artifact, its VIM function can be extended through a series of plug-ins, very convenient, and are open source, through an afternoon toss, and finally completed a simple and strong

Large vim environment to build, of course, their own in order to cultivate the ability of the code, and do not install the function plug-ins, toss after the following:

I use the ubuntu14.03lts version, the reason is not used 14.10 is because many of the domestic software source does not support this version of the upgrade, when you installed the ubuntu, the default already installed VI, this time, you have to install the first

Vim, enter the following command at the terminal:

sudo apt-get install vim

At this point, you can use the following command to detect if the installation was successful:

Vim--version

Then there is the installation of the plug-in, here are the main reference to the following three blog posts:

Make your vim a lightweight and powerful IDE

Transforming VIM Programming source Insight

Vim taglist Plug-in installation and configuration

Before installing the plug-in, the first to install ctags, because the plugin taglist is based on tags files, need to ctags to generate tags files. install ctags under Ubuntu as long as you enter the following command in the terminal:

sudo apt-get Install Ctags

Then, I installed the vim plugin in the following order:

    1. taglist plug-in

taglist Plug-in effect is like the upper-left window, which shows the variables and functions in the current file, first go to the online address to download the taglist plug-in, after downloading the taglist_45.zip, there are two directories, respectively , Doc

and plugin, each of the two directories to copy files into the vim directory of the doc and plugin can, this operation you need to find the extracted files, and then in the terminal input:

CP doc/taglist.txt/usr/share/vim/vim74/doc/CP plugin/taglist.vim/usr/share/vim/vim74/plugin/

At the same time you can set your own vim parameters, enter in the terminal:

Vim ~/.VIMRC

In this file, enter:

//Syntax HighlightingSyntax on//Show Line NumbersSet Number//Auto Indent and C language style indentationSetautoindentSetcindent//Indent WidthSettabstop=4Setsofttabstop=4SetShiftwidth=4//It is recommended that the Expandtab option be turned on, the tab extension will be automatically blank, and the code indentation will be more beautiful set Expandtab//switch case Alignment styleSetCINO=G0,:0//Set TagListLet tlist_show_one_file=1   //Show only tags for the current fileLet Tlist_winwidth= -        //Set taglist widthLet tlist_exit_onlywindow=1  //taglist window is the last window, exit vimLet tlist_use_left_window=1 //Display the TagList window on the left side of the vim window    

2. SRCEXPL plug-in

The plug-in is a search function, is the following box, you can go to the online address to download, the installation process with the taglist plug-in, the two directories below the files copied to the vim of the doc and plugin, and then

Modify your own vim under the . vimrc file, how to modify it, the open source plugin gives a specific example, you can refer to its official open source address.

3. Trinity Plug-in

The plugin contains Nerd_tree.vim and Trinity.vim.

< Span lang= "en-US" >       nerd_tree is the rightmost function box in the implementation diagram. is to implement the file tree this function, and this trinity file has a trinity.vim, is to achieve three function box fast switch function. Can be used from the online address

Contained After extracting this file, there will be Nerd_tree.vim Trinity.vim the two plugins, directly copied to the vim installation directory under the plugin folder can be, and then modify the /.VIMRC file. How to modify can refer to its official GitHub URL.

After modifying the effect is F8 open close all function box,F9 open close sourceexplorer function box, the rest are related key control related function box. You can define the function keys yourself. F10 Another feature is the more

if the new ctags content is changed, the code is saved after you press F10 to update ctags. Of course, if you add set Mouse=a, you can use the mouse with vim.

At this point you first in the project directory after the execution of Ctags-r, and then use vim to open a file, press F8 (open all the function box ), try is not the same as the source insight.

To go to the file in the Preview box, double-click the mouse in the preview box and press SPACEBAR to return.

At this point, you can achieve the effect.

How to make vim the source insight under Linux

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.