ubuntu14.04 configuration. Linux View source code artifact, Ctags+vim

Source: Internet
Author: User

How to view the source code under Linux: I used to install a source insight from Linux, but it needs to be installed here to install this wine.

combination of Ctags+vim :

Today, another tool for viewing source code under Linux is. A combination of Ctags+vim.

If the Vim tool is not installed. Can be installed using sudo apt-get install vim .

If the Ctags tool is not installed. You can install it using the sudo apt-get install ctags .


You can not configure the Apt-get source if you do. Or if there is no VIM configuration, you can refer to the following resources:

http://blog.csdn.net/shaohuazuo/article/details/41721647


Here's how to use the Ctags and VIM tools. And make some simple configurations.


First step: After the installation is complete ctags. The path to the source code needs to be entered. Use the Ctags-r command to generate the Ctags file.

Here is the example of Linux source code: This is the linux3.5 source on the computer/home/zshh/work/driver/kernel/linux35
Go to the directory. Use

<pre name= "code" class= "HTML" >[email protected]:~/work/driver/kernel/linux35_tiny4412$ ctags-r  

A tags file is generated after completion.

Step two: You need to set the path to the Ctags file to add a line to the/USR/SHARE/VIM/VIMRC file.

Vim/usr/share/vim/vimrc  


Add the following configuration:
Set Tag =/home/zshh/work/driver/kernel/linux35/tags

Step three: Simple to use.

cd/home/zshh/work/driver/kernel/linux35

Vim-t Memset will open the Memset source code file directly.

First enter VIM and then retrieve
$>vim
In vim, enter command line mode and type the following:
: Ta memset
At this point, Vim automatically jumps to the location defined by the memset. If you have more than one definition, Ctags displays multiple number options by default, typing the number you want to see;

Some ctags will display the first definition directly, and if the definition is not what we want to find, you can swap with the Tselect command:
: Tselect memset

Retrieving with cursor position
When editing a file with Vim, first position the cursor to the definition you want to view, as follows:
Ctrl +]//View definition
Ctrl + O//return
The above two commands support recursive operation





 

ubuntu14.04 configuration. Linux View source code artifact, Ctags+vim

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.