vimdictionarycscope

nmap key maps not working with Vim/Cscope


I'm using vim(7.3) with cscope in ubuntu. :cs find commands work fine, but I want to use some key bindings, so I download cscope_maps.vim and install it according to the tutorial here. However, no matter which place I put the vim file in, none of the key maps defined in the file work! For example I got one of the mapping as :

nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>

When I moved the cursor on a c symbol and pressed [CTRL]+[\]+s, nothing happened!

Does anyone know the reason and how to solve it?

Thanks.


Solution

  • Try to isolate the problem. First, while running vim, try something like

    :nmap , :echo "hello"<CR>
    

    and then type ,. Assuming that works, try the key combination you actually want, instead of ,. (When you write [CTRL]+[\]+s, you are using the CTRL and \ keys at the same time, right?) If that works, then try the actual cscope command from the tutorial.

    Next, try adding a simple nmap command to your vimrc file. Does that work?

    You should be able to load the script with

    :source path/to/cscope_maps.vim
    

    If that works, but simply dropping the file in your plugin directory did not, try

    :set runtimepath?
    

    to see which directories are being searched for plugins, and read

    :help load-plugins
    

    (Step 4 under :help startup) for other reasons they might not be loaded.