Skip to content

Compatibility with delimitMate (<CR> conflict) #136

pera opened this Issue Apr 13, 2012 · 6 comments

3 participants

pera commented Apr 13, 2012

Hi, I am not sure if you can do something to fix this problem but there is a conflict with delimitMate when you try to expand {} using <CR>
Maybe you could add an option for change the default mapping.. or maybe there is some "smart" way to have this mapping coexisting but depending on the context (eg <CR> is needed by clang_complete only when the menu is opened)

Meanwhile my dirty way to solve this was: inoremap <expr> <buffer> <S-CR> <SID>HandlePossibleSelectionEnter()


pera commented May 18, 2012

Ok I found a better way to solve this:

line 88: inoremap <expr> <buffer> <CR> <SID>HandlePossibleSelectionEnter()

" Based on
if maparg('<CR>','i') =~ '<Plug>delimitMateCR'
    exe "inoremap <expr> <buffer> <CR> ".maparg('<CR>', 'i')."<SID>HandlePossibleSelectionEnter()"
    inoremap <expr> <buffer> <CR> <SID>HandlePossibleSelectionEnter()

(sorry for being lazy and not pulling this code... could somebody else do it?)

xaizek commented May 18, 2012

Nice, thanks. This thing annoyed me too. It works great, but I think it's too specific. Do you think we can check just for existence of mapping with if maparg('<CR>','i') != '' ? I know it works, but maybe it's a bad idea to do so?

pera commented May 18, 2012

yeah I was thinking the same, but I wasn't sure neither :x I mean, maybe you can just concatenate the maparg (without any conditional block) because it will gives you an empty string anyway...

@xaizek xaizek added a commit that closed this issue May 26, 2012
@xaizek xaizek Preserve existing <CR> mappings in insert mode
Closes #136. Thanks to @pera.
@xaizek xaizek closed this in f6ced73 May 26, 2012
xaizek commented May 26, 2012

Thanks again, I didn't find any issues and changed mapping of the Enter key.

yshui commented May 27, 2012

This doesn't work well with neocomplcache mapping:

inoremap <expr><CR>  neocomplcache#smart_close_popup()

Result in a E15: Invalid expression

@xaizek xaizek reopened this May 27, 2012
xaizek commented May 27, 2012

After trying to make it work I must admit that I do not understand how the code in endwise works and how we can combine delimitMate, endwise and clang_complete mappings of the Enter key. So I reverted my previous commit and reopened the issue. I'll get back to this later, when I have more free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.