Raimondi / delimitMate

Vim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
http://www.vim.org/scripts/script.php?script_id=2754
1.98k stars 117 forks source link

<C-h> shadowing my YCM mapping #204

Closed perrin4869 closed 8 years ago

perrin4869 commented 9 years ago

It is probably a problem with the order in which plugins are loaded but delimitMate keeps shadowing the mapping I configured for YCM and I can't manage to unmap it. The result of running :verbose imap <C-h> is:

i  <C-H>        @<Plug>delimitMateBS
        Last set from ~/dotfiles/vim/bundle/delimitMate/plugin/delimitMate.vim
i  <C-H>       * <C-X><C-O><C-P>
        Last set from ~/dotfiles/vim/bundle/YouCompleteMe/autoload/youcompleteme.vim

The other weird thing I found looking at delimitMate.vim was the following:

    if maparg('<BS>'. 'i') == ''
      silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS
    endif
    if maparg('<C-h>'. 'i') == ''
      silent! imap <unique> <buffer> <C-h> <Plug>delimitMateBS
    endif

For some reason maparg isn't using commas to separate its arguments but dots. Changing them to commas didn't fix the issue though. Thanks!

qstrahl commented 9 years ago

Those aren't separate arguments; that dot is the string concatenation operator.

On Mon, 26 Jan 2015 13:27 Julian Grinblat notifications@github.com wrote:

It is probably a problem with the order in which plugins are loaded but delimitMate keeps shadowing the mapping I configured for YCM and I can't manage to unmap it. The result of running :verbose imap is:

i @delimitMateBS Last set from ~/dotfiles/vim/bundle/delimitMate/plugin/delimitMate.vim i * Last set from ~/dotfiles/vim/bundle/YouCompleteMe/autoload/youcompleteme.vim

The other weird thing I found looking at delimitMate.vim was the following:

if maparg('<BS>'. 'i') == ''
  silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS
endif
if maparg('<C-h>'. 'i') == ''
  silent! imap <unique> <buffer> <C-h> <Plug>delimitMateBS
endif

For some reason maparg isn't using commas to separate its arguments but dots. Changing them to commas didn't fix the issue though. Thanks!

— Reply to this email directly or view it on GitHub https://github.com/Raimondi/delimitMate/issues/204.

perrin4869 commented 9 years ago

The thing is, wasn't the intended purpose to check if <C-h> is already mapped in insert mode? That is not accomplished if you concatenate strings...

RGBD commented 9 years ago

Hi there. it seems to be a hidden bug, however, does not change the behavior of the plugin itself. See my pull request for more. I'm not sure, if it will fix the issue, since i could not reproduce it myself.

Raimondi commented 9 years ago

That is a typo, I have already merged RGBD's PR and I can't reproduce the issue.

perrin4869 commented 9 years ago

I noticed that on some files (for example, java files) the issue still persists... Javascript files for example seem to work fine. I don't know why some files work and others don't. Maybe it's the order in which the plugins are loaded. I don't know how to reproduce this either... but I think it might be a good idea to rework how delimitMate handles mapping by making it configurable with global and local variables, as in ycm or ultisnips or easymotion, since that works like charm and does not depend on the order that the scripts are loaded and it's more... elegant:

let g:ycm_key_invoke_completion = '<C-h>'

or ultisnips:

 let g:UltiSnipsExpandTrigger="<c-e>"¬

I think I could put together a pull request for this For now though it might be a good idea to just remove the mapping altogether though since it's not even documented and I see no reason why it's there in the first place.