2

I am using VIM 7.0 on RHEL release 5.4, and downloaded cscope plugin from: http://cscope.sourceforge.net/cscope_maps.vim

and copied it to path(one instance at a time): ~/.vim/plugin/cscope_maps.vim & /usr/share/vim/vim70/autoload

and generated cscope -qbR from root dir of source files, & opening *.C files from same dir.

According to this(point 5) & cscope_maps.vim, I should be able to do keyword search by multiple keystroke: CTRL-\ <option> or CTRL-@ <option> by placing the cursor under the keyword as we do for ctags. But I am able to access the cscope keyword search only through the vim's command line argument (ie., :cs f d or :cs f c) and not with multiple key stroke shortcut.

I've also tried pasting all the contents of cscope_maps.vim to ~/.vimrc, but it didn't help

Is there something I am doing wrong/ any other way to make it work?

DragonX
  • 371
  • 2
  • 6
  • 18
  • As you can see in `cscope_maps.vim` it didn't talk about `VIM7` so please check syntax of that script in `VIM7`. like here: http://vimdoc.sourceforge.net/htmldoc/usr_41.html – mortymacs Jun 16 '14 at 12:30
  • Vim 7.0 is from 2006 and _very_ outdated. It should be possible to install the latest version 7.4; if you can't find a proper package for your distribution, it's also not very difficult to [compile](http://www.vim.org/download.php) (e.g. from the Mercurial sources) on Linux. – Ingo Karkat Jun 16 '14 at 12:38
  • @MortezaIpo yes nothing mentioned about `VIM7`, but i assumed for all `VIM6+` the `cscope_maps.vim` file to be placed in VIM's plugin folder? – DragonX Jun 16 '14 at 12:52
  • @Ingo Karkat do I need to recompile latest `VIM` and `cscope` or only `VIM` would do? Right now I am using both `VIM` and `cscope` as included in `RHEL5` package – DragonX Jun 16 '14 at 12:58
  • @DragonX if you check http://www.vim.org/scripts/script.php?script_id=51 , in the `vim version` it supports `vim 6` – mortymacs Jun 16 '14 at 13:00
  • My comment was just a general note on that you're missing out on many enhancements and bug fixed with Vim 7.0; your problem is probably unrelated. – Ingo Karkat Jun 16 '14 at 13:04
  • @MortezaIpo yes, but I am using `VIM7`. As mentioned in link above, cscope's native GUI works fine, but not the point 4. Isn't it true that the higher versions of VIM has inbuilt support by default? – DragonX Jun 16 '14 at 13:13
  • @DragonX yes , maybe it support. – mortymacs Jun 16 '14 at 13:16

4 Answers4

1

As described in the plugin's documentation, copy the plugin to

~/.vim/plugin/cscope_maps.vim

The autoload directory you've chosen is wrong, this is for plugins' on-demand functionality.

Also, /usr/share/vim/vim70/ is owned by the default Vim package, don't touch anything there (in general), or you'll run into problems when reinstalling / upgrading packages! If you do need to have a system-wide plugin, check :help runtimepath and find / add a proper location that you own on the system.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • the path `~/.vim/plugin` didn't exist so I created one and pasted the `cscope_maps.vim` file in it, and removed the same from `autoload` path, but still no luck – DragonX Jun 16 '14 at 13:30
  • 1
    Does it appear in `:scriptnames`? Does `:echo has("cscope")` yield `1`? Do the mappings appear in `:nmap `? – Ingo Karkat Jun 16 '14 at 13:50
  • 1
    yes, it does appear as `7: /root/.vim/plugin/cscope_maps.vim` when i do `:scriptnames` & also doing `:echo has("cscope")` yields `1`. And for `:nmap ` i got `No mapping found` in VIM's cmd prompt – DragonX Jun 17 '14 at 09:13
  • Strange, so the plugin is sourced, but the mappings aren't defined. You could run this with `:set verbose=20`, or try changing the mappings inside the plugin, or adding `:echomsg "here"` debug information. – Ingo Karkat Jun 17 '14 at 09:51
  • cscope is mapping `` only to check the function definition and not ``. The plugin has key binding `` definitions, right? or some modification in plugin required? – DragonX Jun 17 '14 at 11:41
  • Right, `` is built-in. – Ingo Karkat Jun 17 '14 at 11:44
  • yes, but using `` in cscope doesn't jump from definition to calling function, this doesn't make sense as this can be also done via `ctags` – DragonX Jun 17 '14 at 11:50
1

Probably your code base is other then .c files. I was facing same issue as my code base includes c and c++ both. I was trying with c++ functions and was facing same issue you mentioned. Hint- Build cscope data base with all required files.

0

Probably, you are missing the CSCOPE_DB environment variable - i.e, it should point to the valid cscope.out file

To check, once you are in vim, run :echo $CSCOPE_DB, mine shows: /home/me/views/myrepo/cscope.out

Ani
  • 1,448
  • 1
  • 16
  • 38
  • i checked, `env` is not set. so I export `CSCOPE_DB` myself to the particular `~/src/cscope.out` file, even then its not working – DragonX Jun 16 '14 at 12:56
0

I had the same problem with cscope and Vim 7.4. I could solve it in Arch uncommenting in cscope_maps.vim the bellow lines:

set timeoutlen=4000
set ttimeout

BTW I followed this tutorial to install cscope vim plugin on Arch: https://wiki.archlinux.org/index.php/vim#cscope

Lord_Rafa
  • 33
  • 7