项目作者: ronakg

项目描述 :
Vim plugin for super fast Cscope/GNU GLOBAL results navigation using quickfix window
高级语言: Vim script
项目地址: git://github.com/ronakg/quickr-cscope.vim.git
创建时间: 2016-04-21T23:11:16Z
项目社区:https://github.com/ronakg/quickr-cscope.vim

开源协议:

下载


quickr-cscope.vim

Vim plugin for super fast Cscope results navigation using quickfix window.

Features

quickr-cscope.vim provides faster access to
Cscope database search queries within Vim.
Each type of Cscope query is just a keystroke away. Results are shown in a
quickfix window ready for
faster navigation. Paired with excellent quickfix-reflector.vim
plugin, quickr-cscope.vim is a powerful tool for project navigation and
refactoring.

Biggest advantage of using this plugin is, it prevents the
quickfix to jump to first result automatically. Thus preventing it to spoil
your open buffer list.

  • Quickly search for symbol, function name, file name, assignments under the cursor
  • Quickly search for visually selected text
  • Search results are shown in quickfix window, which is way more flexible for
    navigation compared to Cscope’s fixed list
  • Search term can be navigated using n and N in quickfix window for faster
    movement
  • Find the Cscope database and load automatically on startup
  • Also works with GNU GLOBAL database

Installation

This plugin follows the standard runtime path structure, and as such it can be
installed with a variety of plugin managers:

  • Plug
    • Plug 'ronakg/quickr-cscope.vim'
  • NeoBundle
    • NeoBundle 'ronakg/quickr-cscope.vim'
  • Vundle
    • Plugin 'ronakg/quickr-cscope.vim'
  • Pathogen
    • git clone https://github.com/ronakg/quickr-cscope.vim ~/.vim/bundle/quickr-cscope.vim
  • Manual
    • Copy all the files in to your ~/.vim directory

Default Key maps

  1. <leader>s : Search for all symbol occurances of word under the cursor
  2. <leader>g : Search for global definition of the word under the cursor
  3. <leader>c : Search for all callers of the function name under the cursor
  4. <leader>f : Search for all files matching filename under the cursor
  5. <leader>i : Search for all files including filename under the cursor
  6. <leader>t : Search for text matching word under the cursor/visualy selected text
  7. <leader>e : Enter an egrep patter for searching
  8. <leader>d : Search all the functions called by funtion name under the cursor
  9. <leader>a : Search all the places where the symbol under the cursor is assigned a value

P.S.: \ is the leader key by default. So the mappings are \s, \g, \c, etc. unless <leader> key is mapped to something else.

Customization

Disable default key mappings

If you want to use your own key mappings, you can disable the default key
mappings by adding following to your ~/.vimrc file.

  1. let g:quickr_cscope_keymaps = 0

Define custom key mappings

Use following <plug>s to your own liking:

  1. <plug>(quickr_cscope_symbols)
  2. <plug>(quickr_cscope_global)
  3. <plug>(quickr_cscope_callers)
  4. <plug>(quickr_cscope_files)
  5. <plug>(quickr_cscope_includes)
  6. <plug>(quickr_cscope_text)
  7. <plug>(quickr_cscope_egrep)
  8. <plug>(quickr_cscope_functions)
  9. <plug>(quickr_cscope_assignments)

There are 2 more additional <plug>s available for global defintion to open the result in
a horizontal or vertical split.

  1. <plug>(quickr_cscope_global_split)
  2. <plug>(quickr_cscope_global_vert_split)

For example:

  1. nmap <C-s> <plug>(quickr_cscope_symbols)
  2. nmap <C-g>s <plug>(quickr_cscope_global_split)
  3. nmap <C-g>v <plug>(quickr_cscope_global_vert_split)

Use GNU GLOBAL instead of Cscope

If you want to use GNU GLOBAL for searching your codebase, it can be done by
define following in your ~/.vimrc.

  1. let g:quickr_cscope_program = "gtags-cscope"
  2. let g:quickr_cscope_db_file = "GTAGS"

Disable automatic search and load of Cscope database

If you’re already using another Cscope plugin that loads the database, you can
disable this feature of the plugin by adding following to your ~/.vimrc.

  1. let g:quickr_cscope_autoload_db = 0

FAQ

I’m not able to use Ctrl-T to go back in tag stack like I used to before.

When you use quickfix to view results of a Cscope query, those results
are not passed to taglist. You need to use Ctrl-o (jumplist) to go back to
where you were from a result.

When there are multiple matches for global definition, it doesn’t open in quickfix window.

By default global definitions are not shown in quickfix window. This
behavior can be set by setting g:quickr_cscope_use_qf_g to 1.

  1. let g:quickr_cscope_use_qf_g = 1

License

Copyright (c) Ronak Gandhi. Distributed under the same terms as Vim itself. See
:help license