Src:
http://janpenguin.wikispaces.com/cscope+installation
Notes:
[sp@14'2/18] in vi
(1)cs f t -> find specific text
(2) ctrl-] -> jump in specific function
(3) ctrl-t -> jump out to previous
--------------------------------------------------
Debian Squeeze:
I tried to install ctags but it did not work out well. Do I need to try it again?
By the way, cscope installation went smoothly according to the instruction followed by.
Before you install cscope, make sure your Vim supports cscope. Type 'vim --version' and check it has +cscope option on. +quickfix is another option that is used in Vim.
To install cscope,
$ sudo aptitude install cscope
Source: http://www.swaroopch.com/notes/Vim_en:Programmers_Editor
When I executed number 4, it showed the following message. I thought it was a bug but it wasn't.
I did few things to fix weird run-time error of cscope. The key maps defined on cscope plugin file wouldn't work apparently.
I add following codes in ~/.vimrc
Create csope.files that cscope will read to create cscope.out file. For example, I create cscope.files in the parent directory of 'expansion'.
$ find /home/penguin/Workshop/expansion -name '*.py' > /home/penguin/Workshop/cscope.files
It makes a list of all python source files in expansion and subdirectories.
Create a database file.
$ cscope -b
Set CSCOPE_DB environment variable by giving [path]/cscope.out file. In my case, I added
"export CSCOPE_DB=~/Workshop/cscope.out" in ~/.bashrc file.
Open a python file, run commands and keys that described on the cscope_maps.vim. It should search functions, variables, and switch back and forth across .py files.
To add another taglist for another project, create cscope database in the project directory. Start vim and run cscope command as below. (Source:http://www.koch.ro/blog/index.php?/archives/63-VIM-an-a-PHP-IDE.html#autocompletition)
: cscope add project_dir/cscope.out project_dir
I tried to install ctags but it did not work out well. Do I need to try it again?
By the way, cscope installation went smoothly according to the instruction followed by.
Before you install cscope, make sure your Vim supports cscope. Type 'vim --version' and check it has +cscope option on. +quickfix is another option that is used in Vim.
To install cscope,
$ sudo aptitude install cscope
Source: http://www.swaroopch.com/notes/Vim_en:Programmers_Editor
- Copy cscope_maps.vim to your ~/.vim/plugin/directory.
- Switch to your source code directory and run cscope -R -b to 'b'uild the database 'r'ecursively for all subdirectories.
- Restart Vim and open a source code file.
- Run :cscope show to confirm that there is a cscope connection created.
- Run :cscope find symbol foo to locate the symbol foo. You can shorten this command to :cs f s foo.
- Find this definition - :cs f g
- Find functions called by this function - :cs f d
- Find functions calling this function - :cs f c
- Find this text string - :cs f t
- Find this egrep pattern - :cs f e
When I executed number 4, it showed the following message. I thought it was a bug but it wasn't.
ERROR(prog, 'missing file') raise Exception('-1') else: arg['i'] = a1 raise Exception('1') (options, args) = parser.parse_args() if options.show: arg['s'] = options.show if options.other: cscope commands: add : Add a new database (Usage: add file|dir [pre-path] [flags]) find : Query for a pattern (Usage: find c|d|e|f|g|i|s|t name) c: Find functions calling this function d: Find functions called by this function e: Find this egrep pattern f: Find this file g: Find this definition i: Find files #including this file s: Find this C symbol t: Find assignments to help : Show this message (Usage: help) kill : Kill a connection (Usage: kill #) reset: Reinit all connections (Usage: reset) show : Show connections (Usage: show)
I did few things to fix weird run-time error of cscope. The key maps defined on cscope plugin file wouldn't work apparently.
I add following codes in ~/.vimrc
if has('cscope') set cscopetag cscopeverbose if has('quickfix') set cscopequickfix=s-,c-,d-,i-,t-,e- endif cnoreabbrev csa cs add cnoreabbrev csf cs find cnoreabbrev csk cs kill cnoreabbrev csr cs reset cnoreabbrev css cs show cnoreabbrev csh cs help command -nargs=0 Cscope cs add $VIMSRC/src/cscope.out $VIMSRC/src endif
Create csope.files that cscope will read to create cscope.out file. For example, I create cscope.files in the parent directory of 'expansion'.
$ find /home/penguin/Workshop/expansion -name '*.py' > /home/penguin/Workshop/cscope.files
It makes a list of all python source files in expansion and subdirectories.
Create a database file.
$ cscope -b
Set CSCOPE_DB environment variable by giving [path]/cscope.out file. In my case, I added
"export CSCOPE_DB=~/Workshop/cscope.out" in ~/.bashrc file.
Open a python file, run commands and keys that described on the cscope_maps.vim. It should search functions, variables, and switch back and forth across .py files.
To add another taglist for another project, create cscope database in the project directory. Start vim and run cscope command as below. (Source:http://www.koch.ro/blog/index.php?/archives/63-VIM-an-a-PHP-IDE.html#autocompletition)
: cscope add project_dir/cscope.out project_dir
沒有留言:
張貼留言