sponsor Vim development Vim logo Vim Book Ad

cscope.vim : create/update/connect cscope database smartly.

 script karma  Rating 117/48, Downloaded by 6962  Comments, bugs, improvements  Vim wiki

created by
brook hong
script type
# Introduction
Cscove(new name for this plugin, since cscope.vim is used too widely.) is a
smart cscope helper for vim.

It will try to find a proper cscope database for current file, then connect to
it. If there is no proper cscope database for current file, you are prompted to
specify a folder with a string like --

    Can not find proper cscope db, please input a path to create cscope db for.

Then the plugin will create cscope database for you, connect to it, and find
what you want. The found result will be listed in a location list window. Next
time when you open the same file or other file that the cscope database can be
used for, the plugin will connect to the cscope database automatically. You
need not take care of anything about cscope database.

When you have a file edited/added in those folders for which cscope databases
have been created, cscove will automatically update the corresponding database.

Cscove frees you from creating/connecting/updating cscope database, let you
focus on code browsing.

# Example settings
The default key mappings has been removed from the plugin itself, since users
may prefer different choices.
So to use the plugin, you must define your own key mappings first.

Below is the minimum key mappings.

    nnoremap <leader>fa :call cscope#findInteractive(expand('<cword>'))<CR>
    nnoremap <leader>l :call ToggleLocationList()<CR>

Some optional key mappings to search directly.

    " s: Find this C symbol
    nnoremap  <leader>fs :call cscope#find('s', expand('<cword>'))<CR>
    " g: Find this definition
    nnoremap  <leader>fg :call cscope#find('g', expand('<cword>'))<CR>
    " d: Find functions called by this function
    nnoremap  <leader>fd :call cscope#find('d', expand('<cword>'))<CR>
    " c: Find functions calling this function
    nnoremap  <leader>fc :call cscope#find('c', expand('<cword>'))<CR>
    " t: Find this text string
    nnoremap  <leader>ft :call cscope#find('t', expand('<cword>'))<CR>
    " e: Find this egrep pattern
    nnoremap  <leader>fe :call cscope#find('e', expand('<cword>'))<CR>
    " f: Find this file
    nnoremap  <leader>ff :call cscope#find('f', expand('<cword>'))<CR>
    " i: Find files #including this file
    nnoremap  <leader>fi :call cscope#find('i', expand('<cword>'))<CR>

# Screencast
Please note that line number changes in location list after file saved.
install details
Just unzip the zip file to your VIM file path, usually to be ~/.vim.


Bundle 'brookhong/cscope.vim'

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
cscope.zip 2.0 2015-03-23 7.2 brook hong 1. auto update cscope database after files edited/added
2. add an interactive interfce: cscope#findInteractive
3. remove default key mappings
4. remove unnecessary commands
5. update help doc
cscope.zip 1.01 2012-05-31 7.2 brook hong minor fix of CscopeFind
cscope.zip 1.0 2012-05-23 7.2 brook hong Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github