[Ctags/csags/project installation and use] Add new wings to the god editor vim, ctagsvim

Source: Internet
Author: User
Tags xslt egrep

[Ctags/csags/project installation and use] Add new wings to the god editor vim, ctagsvim

 

Address of this Article

 

Sharing outline:

1. Install

2. Use cscope

3. Use project

 

 

 

1. Install

1.1) linux (installed in yum)

    

yum -y install cscope  

1.2) linux (unbuntu installation)

sudo apt-get install cscope

1.3) installation on mac

-- First install ctags: http://blog.sina.com.cn/s/blog_6b33a91301012fgw.html download ctags link -- then install csags: http://blog.sina.com.cn/s/blog_6b33a91301012fh1.html download csags link 1.4) project management plug-in project installation -- now link: http://download.csdn.net/download/mybelief321/5683201 unzip project-1.4.1.tar.gz ~ /. Vim directory, only keep the doc and plugin two directories [installation] reference link: http://blog.csdn.net/mybelief321/article/details/9220063 http://blog.163.com/023_dns/blog/static/118727366201212261255290/ [use] reference link: http://blog.csdn.net/clevercode/article/details/51363050

 

 

2. Use

  

2.1) add files to be indexed (*. php, *. js, *. css. *. sh)

$ cd /home/test/myWork$ find /home/test/myWork -name "*.js" -o -name "*.sh" -o -name "*.php"   > /home/test/myWork/cscope.files

 


2.2) Create an index file (A cssag. out file will be generated)

 

$ cd /home/test/myWork$ cscope -b 

 


2.3) Use

2.3.1 manually load the cssag. out library

  

:cs add /home/test/myWork/cscope.out

 

 

2.3.2 ~ /. Load in vimrc

  

$ vim ~/.vimrcif has("cscope") && filereadable("/usr/bin/cscope")   set csprg=/usr/bin/cscope   set csto=0   set cst    set nocsverb   " add any database in current directory   if filereadable("/home/test/myWork/cscope.out")      cs add /home/test/myWork/cscope.out   endifendif

 


2.3.3 view database

  

:cs show

 



2.4) find command

: Cs f s ---- find the C language symbol, that is, find the place where the function name, Macro, and enumeration value appear
: Cs f g ---- find the locations defined by functions, macros, and enumeration, similar to the functions provided by ctags
: Cs f d ---- find the function called by this function
: Cs f c ---- find the function that calls this function
: Cs f t ---- find the specified string
: Cs f e ---- find the egrep mode, which is equivalent to the egrep function, but the search speed is much faster.
: Cs f ---- find and open the file, similar to the find function of vim
: Cs f I ---- find the text that contains this file

2.5) Jump

Ctrl +] will jump to the definition of the variable or function where the cursor is located
Ctrl + T return
 
: Set csto = 0

The value of 'csto 'determines the |: cstag | query order. If 'csto 'is set to 0, cssag data will be preferentially searched. If cssag does not return a match, then the tag file will be searched. Otherwise, the search order is the opposite. The default value is 0.

 

3. Use project

  

3.1) First Use

If the project address is/home/test/myWork.

Enter the vim command in the command line, enter Project, and create a Project in \ C. (Note: \ CUppercase C)

    

$ vim :Project 

 



\ C. Enter the Name of the Entry: myWork



Enter the Absolute Directory to Load:/home/test/myWork


Enter the CD parameter:/home/test/myWork



Enter the File Filter :*. csv *. php *. js *. sh *. SQL *. conf *. xslt *. xml *. avatar *. tpl *. dev *. prd crontab. **. cfg. **. html *. htm *. intftest *. vim *. plx *. txt



Save

: W



 

3.2) use again

Method 1

$ Vim

: Project


Method 2

$ Vim-c 'Project/home/test/. vimprojects'


3.3) Add a project

3.3.1) add it to an existing project. If necessary, add it to the/home/test/myWork project. Add the conn folder to the db directory.

A) $ vim-c 'Project/home/test/. vimprojects'


B) move the cursor to the.txt line under the db directory. Connwill be created under a.txt.



C) command mode input: \ C. Add conn

Enter the Name of the Entry: conn

Enter the Directory to Load: conn

Enter the CD parameter:

Enter the File Filter:



3.3.2) Add a new project

You only need to move the cursor to the last line. Create a project in accordance with section 4.1.


(3.4 )~ /. Vimprojects

 

The document directories of all projects are saved in ~ /. Vimprojects. The format is as follows:

 


myWork=/home/test/myWork CD=/home/test/myWork filter="*.csv *.php *.js *.sh *.sql *.conf *.xslt *.xml *.avatar *.tpl *.dev *.prd crontab.* *.cfg.* *.html *.htm *.intftest *.vim *.plx *.txt" {   index.php   config=config {   }   css=css {   }   db=db {    a.txt    conn=conn {     mysql.php    }    b.txt   }  }  myWork2=/home/test/myWork2 CD=/home/test/myWork2 {   a.txt   b.txt  }  

 

 

3.5) Other operations

After the project plug-in is started, the corresponding commands are supported. Input in normal mode (case sensitive ):


\ R updates the folding object based on the project filter.
\ R Recursive Execution \ r.
\ C creates a project. This does not include subdirectories in the specified directory.
\ C recursively executes \ c, including all subdirectories in the specified directory.
<Return> open the file; open or close the fold.
<S-Return> Shift + Return
\ S is the same as <Return> opening a file. The horizontal split window is displayed when the file is opened.
\ S loads all files to the current window. The current window is horizontally split and all files are displayed.
<C-Return> Ctrl + Return
\ O open the specified file to a window and close all other windows,
<M-Return> Alt + Return
\ V only opens the file, and the cursor remains in the project list.
<CTRL-Up>
\ <Up> move the text or collapse it to the top line of the current cursor.
<CTRL-Down>
\ <Down> move the text or collapse it to the next line of the current cursor.
\ I displays the complete folding parameters and inheritance parameters of the cursor in the status bar.
\ I displays the complete path of the file in the status bar.
\ L load all files at the current project layer to the current vim. During the loading process, any button will stop.
\ L load files in the current project and sub-projects to the current vim. Exercise caution.
\ G executes grep at the current project layer.
\ G executes grep at the current project layer and sub-projects.
<F12> when the flag 'G' is used in the variable g: proj_flags, this key is used to open and close the project window.


For other operations, see project.txt.

 


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.