Use Cscope in Vim to find where to call, define functions, and variables. __ function

Source: Internet
Author: User
Tags function definition

Http://www.sudu.cn/info/html/edu/20060102/294929.html

In Vim used for a while ctags, is indeed a drawback. Ctags can only find where the function is defined based on the call to the function, and you cannot find where the function is defined by where it is called
The function. So he learned the cscope. Cscope on the home page that it has unquestioned Unix ancestry, which was developed at Bell Labs as early as the PDP-11 era. It's mine
Linux is SuSE10.0, the system has cscope software.
One, will
Http://cscope.sourceforge.net/cscope_maps.vim
Save As file ~/.vim/plugin/cscope_maps.vim
Second, because Cscope will "CTRL + Space" as the mapping key, but this will bring up the input method, so the ~/.vim/plugin/cscope_maps.vim file is replaced (or you do not have the map of your favorite shortcuts)
Third, enter the C language source code directory, the establishment of symbol table:
Mishuang@msh:~/linux/linux0.11/source-0.11> Cscope-r
Ctr-d exit, the current directory will be more than one file Cscope.out, this file is much more than tags.
Iv. use of the guide
1 Use the following command to go directly to the main function definition where, if there are multiple, enter the index number, carriage return.
Mishuang@msh:~/linux/linux0.11/source-0.11> Vi-t Main
2 to rest the cursor on a function or variable, "CTRL +]", will jump directly to the place where the function is defined.
3 Put the cursor on a function or variable, "ctrl+\" and then enter S, so that all calls, define the function of the place, enter the index number, return can be.
4 put the cursor on a function or variable, and then enter S, so that all the calls, define the function of the place, enter the index number, return to the horizontal way in another window display.
5 Put the cursor on a function or variable, and then enter S, so that all the calls, define the function of the place, enter the index number, the carriage return will be vertical in another window display.
6) Ctrl+t back to the original jump before the place, press two consecutive "" can go back.
Report:
Vim split window operation
: Split horizontal (up and down) split window
: Vsplit or Ctrl-w v vertical (left or right) split window
: New horizontal Split window, create empty file
: Vnew Vertical Split window, create empty file
Vim Multi-window Operation command
: Qall Exit All windows
: Wall Save All windows
: Wqall or: Xall Save and exit all windows
: wqall! or: Xall. Save and exit all windows, if some files are read-only, do not need to set write permissions first
: qall! Force exit All Windows
Ctrl-w W to move between windows
Ctrl-w O Close all other windows
Reference documents:
1)
Http://cscope.sourceforge.net
2)
Http://cscope.sourceforge.net/cscope_vim_tutorial.html
3)
~/.vimrc
4)
The improvement of the ~/.VIMRC

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.