Use Vim cs1_taglist

Source: Internet
Author: User
Tags egrep
Use Vim cs1_taglist

1. Installation
Apt-Get install exuberant-ctags cs1_global
Cppcomplete and taglist are to be downloaded from the extended list of www.vim.org.

Taglist:
Http://www.vim.org/scripts/script.php? Script_id = 1, 273
Cppcomplete:
Http://www.vim.org/scripts/script.php? Script_id = 1, 527

Then create a directory

Code:
$ Home/. Vim/plugin

Copy the downloaded cppcomplete. vim and taglist. Vim to $ home/. Vim/plugin.
After global is installed, the latest version 4.8.6 and later has an extension with vim. Copy it to $ home/. Vim/plugin.

After Debian Sid version Global is installed, the extension file is

Code:
/Usr/share/doc/global/examples/gtags.vim.gz
Copy to $ home/. Vim/plugin and decompress the package. decompress the package:

Code:
Gzip-D gtags.vim.gz

Ii. Configuration ~ /. Vimrc

If has ("CSAs ")
Set csprg =/usr/bin/cs.pdf
Set CSTO = 0
Set CST
Set nocsverb
"Add any database in current directory
If filereadable ("cscope. Out ")
CS add cscope. Out
Elseif $ cscope_db! = ""
CS add $ cscope_db
Endif
Set csverb
Set cscopetag
"Set cscopequickfix = s-, G-, D-, T-, e-, F-, I-
Endif

Iii. Load and use

Cssag-r // load the database
CTL + D // exit
CTL + T // exit from the file
Find option string
0 or S: Search for the C symbol
1 Or G: Search Definition
2 or D: Find the function called by this function
3 or C: Find the function that calls the specified function
4 or T: Search for strings
6 or E: Find the egrep Mode
7 or F: Find Files
8 or I: Find the file that contains the specified file

4. Use with ctags:

Load ctags: ctags-R *
4. move the cursor over the kmalloc word,
4.1 press "Ctrl-/s" to bring you to all the menus that reference the function kmalloc and open the file in the current window.

4.2 press "Ctrl-]" to bring you to all the menus implementing the function kmalloc and open the file in the current window.

4.3 press Ctrl-Space S to bring you to all the menus that reference kmalloc and open a new window horizontally.

4.4 press Ctrl-space Ctrl-Space S to bring you to all the menus that reference kmalloc and open a new window vertically.

4.5 The following are the meanings of each key
S --- symbol
G --- globals global variable
C --- CILS calls its own
T --- text reference
E --- egrep for egrep search
F --- file open the file at the cursor
I --- Using DES to find the file name at the cursor where include is located
D --- called

4.6 return to the upper-level window by CTRL-T

5. In addition to using hotkeys, you can also use the command mode to find
5.1 cs f s kmalloc
Equivalent to Ctrl-/s

5.2 scs f s kmalloc
Equivalent to Ctrl-Space S

5.3 vert scs f s kmalloc
Equivalent to Ctrl-space CTRL SPACE S

6. Export cscope_db = ~ /Cscope/csout. Out
In this way, you can run "Vi-T kmalloc" in any directory without finding the database.

5. Use the taglist plug-in of VIM

Real-time browsing of functions and variable definitions. This is a very useful feature. Thousands of variables, for C/C ++, a type error may lead to extremely difficult problems to find and unexpected results during running. Use taglist in vim. In addition, the list of multiple files is combined and can be folded by type for browsing.
The taglist depends on ctags, so you must first install ctags. Otherwise, the taglist cannot be used!

# Unzip taglist.zip-D ~ /. Vim
# Cp DOC/taglist.txt/usr/share/Vim/vim70/doc/
# Cp plugin/taglist. Vim/usr/share/Vim/vim70/plugin/


# Cd/usr/share/Vim/vim70/doc/
(Note: vim70 is my own Vim version number, which may be different for everyone. Change it by yourself)
Run sudo vim, Shift +: To enter the vim command line and use

: Helptags.


To configure the help documentation
Restart vim and use ": tlisttoggle" to open and close the taglist window.
You can use ": Help taglist" to obtain more help information.

Next, let's talk about it ~ /. Vimrc configuration file settings. The following is the settings of my own files.

"Enable syntax highlighting
Syntax on
"Set automatic text encoding Recognition
Set fencs = UTF-8, cp936
"Use the mouse
Set mouse =
"Set highlight search
Set hlsearch
"The matching point is displayed after the input string is entered.
Set incsearch
"The entered command is displayed, which is clear.
Set showcmd
"Tlist internal variable. Function list.
Let tlist_use_right_window = 1
Let tlist_file_fold_auto_close = 1
"Function and Variable list
Map <F4>: tlisttoggle <CR>
"All-Around completion
Inoremap <F8> <c-x> <c-o>
"It's okay. Draw a line with the mouse.
"Noremap <F9>: Call togglesketch () <CR>
Set wildmenu
"Start function variable quick browsing time settings
Set updatetime = 100


Then you can use the taglist in your vim. You only need to click F4 to open or close it!

Enrich my ~ /. Vimrc content is as follows:

Set hlsearch
Set AI
Syntax on
Set number
Set nocompatible
Set columns = 80
Filetype on
Set history = 1000
Set autoindent
Set smartindent
Set tabstop = 4
Set shiftwidth = 4
Set showmatch
Set guioptions-= T
Set VB t_vb =
Set ruler
Set nohls
Set noexpandtab
Set ignorecase
Set mouse =
Set cindent
Set incsearch
Set fencs = UTF-8, cp936

Set showcmd
"Tlist internal variable. Function list.
Let tlist_use_right_window = 1
Let tlist_file_fold_auto_close = 1
"" Function and Variable list
Map <F4>: tlisttoggle <CR>
"" All-Around completion
Inoremap <F8> <c-x> <c-o>
"" It's okay. Draw a line with the mouse.
Noremap <F9>: Call togglesketch () <CR>
Set wildmenu
"" Start function variable quick browsing time settings
Set updatetime = 100
Map <F2>: Split <CR>
Map <F3>: vsplit <CR>
Map <F5>: Q! <CR>
Map <F6>: W! <CR>
Map <F7>: WQ! <CR>

Autocmd filetype Python set omnifunc = pythoncomplete # complete

If has ("CSAs ")
Set csprg =/usr/bin/cs.pdf
Set CSTO = 0
Set CST
Set nocsverb
"Add any database in current directory
If filereadable ("cscope. Out ")
CS add cscope. Out
"Else add database pointed to by Environment
Elseif $ cscope_db! = ""
CS add $ cscope_db
Endif
Set csverb
Set cscopetag
"Set cscopequickfix = s-, G-, D-, T-, e-, F-, I-
Endif

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.