Townk / vim-autoclose

This plugin for Vim enable an auto-close chars feature for you. For instance if you type an '(', ``autoclose`` will automatically insert a ')' and put the cursor between than.
http://townk.github.com/vim-autoclose/
501 stars 66 forks source link

conflict with YouCompleteMe #65

Open gergap opened 9 years ago

gergap commented 9 years ago

Hi

1st conflict: Returning to normal mode when YCM popup is shown and ESC is pressed. This can be fixed by adding let g:AutoClosePumvisible = {"ENTER": "", "ESC": ""} to .vimrc as described here: https://github.com/Valloric/YouCompleteMe/issues/9

2nd conflict: When in insert mode and pressing Cursor Up/Down it inserts some text like "pumvisible() ? ...". I could fix this here by uncommenting the "inoremaps" in line 471 and 473:

            if len(l:pvisiblemap)
                "exec "inoremap <buffer> <silent> <expr> " . key . " pumvisible() ? '" . l:pvisiblemap . "' : '<C-R>=<SID>FlushBuffer()<CR>" . l:currentmap . "'"
            else
                "exec "inoremap <buffer> <silent> " . key . "  <C-R>=<SID>FlushBuffer()<CR>" . l:currentmap
            endif

I don't know what this was for and what sideeffects it has to remove these mappings. Anyway, it works for me now. Maybe you can fix this upstream, so that your plugin works together with YouCompleteMe.

regards, Gerhard.

Mule52 commented 8 years ago

I am running into this exact same problem. When using AutoClose in vim insert mode, I create a JavaScript function and add my first "{" and AutoClose adds the second one "}" to match it. I then hit my enter key to give my function a new line, then I click on my up arrow to return to where I want to type my text, once I click that up arrow, I get all that pumvisible() text inserted into my file.

Is there a way to ignore the mapping of and for AutoClose? I am not sure what else to do.

Thanks.

IlikePepsi commented 8 years ago

I had the same issue with some strange text inserted hitting the arrow keys. Also after installation of YouCompleteMe. For me replacing all the imap with inoremap statements in /plugin/AutoClose.vim line 29-36 seems to fix the issue.

Kind regards.

fatso83 commented 7 years ago

The official tips from YCM is to just use Raimondi/delimitMate

Alternatively let g:AutoClosePumvisible = {"ENTER": "", "ESC": ""} ref

MuhammetFevziBayiroglu commented 6 years ago

llikePepsi I had the same issue but it only started after I installed nerdtree and opened a second file from the tree, opening it in a new tab. Every time I pressed the up or down key in insert mode it would insert weird text like " Pumvisible() ... It looked like it was from one of the plugins .vim files. And thanks a lot for sharing your fix, spent half the day trying to fix it, couldn't find it anywhere on the internet.

ghost commented 5 years ago

@gergap @Mule52 @IlikePepsi @fatso83 @MuhammetFevziBayiroglu I have forked the project and made a number of modifications that will improve compatibility with autocompletion plugins like YouCompleteMe. Maybe my modifications can help improve your experience with AutoClose. You can find the project at: https://github.com/whitehatzero/vim-autoclose