Reading large code, we often need to open a lot of code files, search for various definitions. Windows used to use the IDE's friends, when moving to Linux may feel very uncomfortable, can not find the right reading tools. In fact, the almighty vim can be achieved. The configuration of vim+ctags+taglist is described below.
Installing Ctags
Ubuntu source provides the installation of Ctags.
sudo apt-get install ctags
Installing TagList
Download:
http://vim.sourceforge.net/scripts/download_script.php?src_id=6416
Copy to Ubuntu and use the command to extract:
-d ~/.vim
You should get it after decompression. / d o c And /PLugin 。 Two directories then install into vim
cp ~/.vim/doc/taglist.txt /usr/share/vim/vim74/doc/cp ~/.vim/plugin/taglist.vim /usr/share/vim/vim74/plugin/
Then start vim, Command mode input
:helptags /usr/share/vim/vim74/doc/
After that, we can use
:help taglist.txt
command to view the TagList help documentation.
After that, modify i m r c File.
Add the following content:
"""""""""Ctags"""""""""set tags=tags"""""""""taglist"""""""""1let Tlist_Sort_Type="name"let Tlist_Exist_OnlyWindow =1‘/usr/bin/ctags‘11
Later, you only need to enter the source directory at the top level
Generate the tags file, and then use VIM to open your C file, you can use the shortcut key to jump.
Use Ctr and two times W to switch between the side window and the main window.
Ctrl + ] //跳入定义 Ctrl + T //调回
Generate System tags for ctags
As you can see above, ctags only supports macros, variables and functions defined in the source file, but the basic functions and system functions we call are not able to jump.
Use the following command to generate the system header file tags
ctags -I __THROW --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p --fields=+S -f ~/.vim/systags /usr/include /usr/local/include
Finally, set up your ~/.VIMRC and add a line:
set tags+=~/.vim/systags
You can enjoy the functions of system library function jump and so on.
Ubuntu vim+ ctags (includes system functions) + taglist configuration