jsfaint / gen_tags.vim

Async plugin for vim and neovim to ease the use of ctags/gtags
https://vim.sourceforge.io/scripts/script.php?script_id=5499
MIT License
312 stars 42 forks source link

gtags keymapping is not working #52

Closed maxtcy closed 6 years ago

maxtcy commented 6 years ago

Hi Sir, i am using [gen_tags.vim].commit = '29ce12c' . below is my gen_tags setting in vimrc Enabe gtags and try to use the keymapping of cscope . image

However, when i press below keymaping there is no response. The keymapping is OK as using ':map' in vim. See below screenshot image

While press "Ctrl+\+c" , it only shows below meesage. image

As try to use ":cs show" to see whether the connection of cscope is working or not , showing below message

/abc/project/vendor/proprietary/mtkcam/.git/tags_dir/GTAGS image

gtags related data as below : The data size seems like normal . image

However, the keymap of "ctrl+]" and "ctrl+t" is working as expected.

Because i need the other function of cscope with gtags. can you help me identify what the probelm it is ?

Regards,

jsfaint commented 6 years ago

The mapping works out-of-box without any setting. The map ctrl+\ c is a combo key, you can't press the 3 keys in same time You need to press ctrl+\ first, A symbol will show in the right bottom corner image Then release ctrl and \, and press c

maxtcy commented 6 years ago

Hi Sir,

What kind of information do you need to debug this problem? Since i also replace the "ctrl+\+c" with echo message , i could see the message i add. But not the cscope function.

Regards,

jsfaint commented 6 years ago

Sorry for my bad English, maybe I'm not describe this clearly.

The map triggering step as below:

  1. Press down ctrl and hold it
  2. Press \
  3. Release these two keys
  4. Press c

You MUST release ctrl key before press c, it's feature of vim mapping. Because the map is <C-\>c not <C-\><C-C>

The message shows up because of ctrl+c is a special key in vim. If you press ctrl+c directly, you will see the message image

jsfaint commented 6 years ago

Do you try any other mapping? Some GTAGSLABEL don't support caller or reference function(like ctags and pygments). Maybe you should remove all your settings in vimrc and try again.

You can also run the cscope command directly

:cs find c <cword>
maxtcy commented 6 years ago

Hi Sir,

I try to use command in vim, like you mentioned, :cs find c <cword>. I could oberve the quickfix window pop with corresponding searching result.

jsfaint commented 6 years ago

Did you set cscopequickfix in your vimrc? By default cscope will not use quickfix window.

                        *cscopequickfix* *csqf* *E469*
'cscopequickfix' specifies whether to use quickfix window to show cscope
results.  This is a list of comma-separated values. Each item consists of
|cscope-find| command (s, g, d, c, t, e, f, i or a) and flag (+, - or 0).
'+' indicates that results must be appended to quickfix window,
'-' implies previous results clearance, '0' or command absence - don't use
quickfix.  Search is performed from start until first command occurrence.
The default value is "" (don't use quickfix anyway).  The following value
seems to be useful: >
    :set cscopequickfix=s-,c-,d-,i-,t-,e-,a-

Everything works fine on my side, with 3 different machine and different OS.

maxtcy commented 6 years ago

Do you mean you add cscopequickfix in your vimrc? And everything is working fine. If so, can you share your vimrc for reference ??

Besides, can you confirm the usage of my g:gen_tags#ctags_opts usage? For multiple property to setup for ctags, using g:gen_tags#ctags_opts += xxxx is OK or not

jsfaint commented 6 years ago

All my vimcfg is in here https://github.com/jsfaint/nvimcfg And the plugin list is https://github.com/jsfaint/nvimcfg/blob/master/plugin.vim Nothing special config for gen_tags.vim

And g:gen_tags#ctags_opts is a string, it looks vim don't support += operation for script. Only list support += operation

jsfaint commented 6 years ago

The string concatenation opeartor is . You need to modify your code into

let g:gen_tags#ctags_opts = 'xxx '
let g:gen_tags#ctags_opts .= 'xxx '
let g:gen_tags#ctags_opts .= 'xxx '