Configure vim in windows and use cssag to implement php function locating

Source: Internet
Author: User
Tags drupal egrep

 

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

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.