Disable maps in cscope_maps
dblume

dblume commited on 2024-09-16 16:58:11
Showing 1 changed files, with 8 additions and 1 deletions.


Turns out cscope_maps by default remaps two shortcuts I use:

1. <leader>c , which I use for clipboard yank, is the default <prefix>
   sequence for cscope_maps. (So you could quickly <leader>c,s to search for
   the token under the cursor instead of :Cs find s <cword>.)
2. <C-]>, the :tag shortcut gets remapped to :Cstag, which was
   determined to be worse. Tried with https://git.dlma.com/testcode.git,
   searching for the following from main.cpp:
   * test_cpp14: One hit, should just jump to it.
   * f: Multiple local in main.cpp and then in main_helper.cpp too.
... ...
@@ -35,6 +35,7 @@ set title titlestring=%f%m\ -\ nvim
35 35
 " Otherwise make explicit commands "+yy "+y "+Y (or * instead of + as needed)
36 36
 " N.B. Don't use unnamed register for clipboard (set clipboard=unnamed)
37 37
 "      Delete operations would overwrite clipboard before pasting.
38
+" Also N.B. cscope_maps might assign <leader>c to its prefix.
38 39
 nnoremap <leader>c "+
39 40
 vnoremap <leader>c "+
40 41
 
... ...
@@ -100,6 +101,7 @@ au InsertLeave * hi statusline term=bold,reverse cterm=bold,reverse ctermfg=23 c
100 101
 set mouse=  " neovim defaults to nvi
101 102
 
102 103
 " Make c-] show a list of tags, or jump straight if only single tag
104
+" Note cscope_maps plugin might map c-].
103 105
 nnoremap <c-]> g<c-]>
104 106
 vnoremap <c-]> g<c-]>
105 107
 nnoremap g<c-]> <c-]>
... ...
@@ -438,5 +440,10 @@ let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowTo
438 440
 
439 441
 " See https://wiki.dlma.com/neovim#cscope
440 442
 lua << EOF
441
-  require('cscope_maps').setup()
443
+  require('cscope_maps').setup({ 
444
+    disable_maps = true, -- Mapping C-] to :Cstag <cword> worse than :tag <cword>
445
+-- Alternatively, if we liked the mappings, then customise these two:
446
+--    skip_input_prompt = true,
447
+--    cscope = { skip_picker_for_single_result = true },
448
+  })
442 449
 EOF
443 450