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

Expand_cr not working. #111

Closed sddhrthrt closed 11 years ago

sddhrthrt commented 11 years ago

I installed spf13-vim and then added delimitMate because no other comes nearly close to delimitMate.

But i cannot get the expand_cr working, which is annoying.

I have vim 7.3.429, and I have set

inoremap <Tab> <C-R>=delimitMate#JumpAny("\<C-Tab>")<CR>
let g:delimitMate_expand_cr=1
let g:delimitMate_expand_space=1

in my .vimrc.

Raimondi commented 11 years ago

I'm sorry it took me this long to reply. What's the output of the following commands:

:verb imap <Space>
:verb imap <CR>
sddhrthrt commented 11 years ago

i @delimitMateSpace Last set from ~/dotfiles/vim/bundle/delimitMate/plugin/delimitMate.vim i * pumvisible() ? neocomplcache#close_popup() : "" Last set from ~/.vimrc

On Tue, Dec 18, 2012 at 9:39 PM, Israel Chauca Fuentes < notifications@github.com> wrote:

I'm sorry it took me this long to reply. What's the output of the following commands:

:verb imap :verb imap

— Reply to this email directly or view it on GitHubhttps://github.com/Raimondi/delimitMate/issues/111#issuecomment-11492957.

Raimondi commented 11 years ago

That's why, <CR> is being mapped in your vimrc. Try replacing that mapping in your vimrc with the following:

imap <expr> <CR> pumvisible() ? neocomplcache#close_popup() : '<Plug>delimitMateCR'

Updated the mapping as noted by @slindberg

slindberg commented 11 years ago

To anyone that runs across this thread and tries the <expr> mapping solution, the plugin mapping currently begins with a lowercase 'd'. With the above, the mapping can't resolve and <Plug>DelimitMateCR gets inserted into your buffer. It should probably be:

imap <expr> <CR> pumvisible() ? neocomplcache#close_popup() : '<Plug>delimitMateCR'
Raimondi commented 11 years ago

I have updated the mapping, glad you saw that.

sddhrthrt commented 11 years ago

no problems :)

On Sat, Feb 9, 2013 at 10:23 AM, Israel Chauca Fuentes < notifications@github.com> wrote:

I have updated the mapping, glad you saw that.

— Reply to this email directly or view it on GitHubhttps://github.com/Raimondi/delimitMate/issues/111#issuecomment-13326465..

artfulrobot commented 8 years ago

With neocomplete I now need to use this:

imap <expr> <CR> pumvisible() 
                 \ ? "\<C-y>\<CR>"
                 \ : '<Plug>delimitMateCR'

(I also learnt that inoremap won't work here.)

ktilcu commented 7 years ago

I wanted to add to this issue for others that may get here like I did. delimitMate_expand_cr wasn't working for me because vim-endwise remapped <CR>. The troubleshooting command :verb imap <CR> made it very clear the endwise had last mapped the action.

suxur commented 2 years ago

@ktilcu https://github.com/tpope/vim-endwise/issues/133#issuecomment-1087777576

Adding this to your ~/.vimrc should fix the issue.

if empty(maparg('<CR>', 'i'))
  imap <CR> <Plug>delimitMateCR
endif