nvim-treesitter / completion-treesitter

Treesitter source for completion-nvim and more
161 stars 5 forks source link

Don't use 'gn' as default map #2

Closed milisims closed 4 years ago

milisims commented 4 years ago

gn is a very useful textobject already, and there is neither a way to override the object nor a <Plug> mapping to use instead.

Many plugins check for a definition to some <Plug> mapping before overwriting built in functions, something like

if empty(hasmapto(`<Plug>(completion-treesitter-gn)`))
  map gn <Plug>(completion-treesitter-gn)  " of course, use the correct mapping cmd
endif

Which would allow the user to simply overwrite the default via a mapping of their own.

vigoux commented 4 years ago

Oh sorry for that, I'm going to modify it to only map to <Plug> mappings. The problem is that it could be practical to have some default mappings, and I have some propositions (all not already mapped):

What is you opinion about this ?

milisims commented 4 years ago

How about gr? Good mnemonic, for 'grow', and I'm not sure I have every used gr, but I don't know how universal that is. Pretty sure it has no visual mode function, as well. gt<char> feels awkward for inducing a delay on switching tabs in normal mode, unless these are visual mode only.

Otherwise, gz seems empty, and I'm not sure about the utility of gm/gM, and gh seems thoroughly useless to me. Plenty of other g<char> mappings seem available too.

vigoux commented 4 years ago

I adopted the gr suggestion, and integrated the piece of code for <Plug> snippet, it should behave, as nicely now !