1. Download the compiled cscope.exe file in windows.
To
Http://sourceforge.net/projects/mslk/files/Cscope/
Download the latest cscope-15.7.zip and decompress it to copy the three extracted files to your gvim.exe directory.
For example, my website is D: \ Vim \ vim73.
2. generate necessary files
Run cmd cd to your php project folder. For example, my directory is D: \ PHPnow \ htdocs \ drupal.
Run dir/s/B *. php *. inc *. module> cscope. files
This command will generate a cssag. files File
You can open it and check that it is a list of files that meet the SEARCH Command above.
The drupal function is defined in the. php. inc. module extension files, so I want to search for these three files.
General projects only need to search for. php.
Both dir/s/B *. php> cs.pdf. files *. The wildcard is not interpreted.
3. Run cs1_ B.
A csproducer. out file is generated under the folder.
4. Modify the vim configuration file _ vimrc
Join
"Cscope positioning function depends on this file. Now it can be loaded and run with commands in vim: cs help
Cs a D: \ PHPnow \ htdocs \ drupal \ cs.pdf. out
"Search function definition location
Map <C-g>: cs find g <C-R> = expand ("<cword>") <CR>
Save and exit vim and re-open vim
When you need to view the function definition position, place the cursor on the function name and press ctrl + g vim at the bottom.
: Cs find g Function Name
Then press the Enter key to go to the position defined by the function. Return to the previous position and press ctrl + o.
In addition, do not use shortcut keys for queries
Query under vim command
: Cs find s function_name: find the C language symbol, that is, find the place where the function name, Macro, and enumeration value appear
: Cs find g function_name: find the locations defined by functions, macros, and enumeration, similar to the functions provided by ctags.
: Cs find d function_name: find the function called by this function
: Cs find c function_name: find the function that calls this function
: Cs find t function_name find the specified string
: Cs find e function_name: find the egrep mode, which is equivalent to the egrep function, but the search speed is much faster.
: Cs find f function_name find and open the file, similar to the find function of vim
: Cs find I function_name: find the file containing this file