ncm2-ultisnips icon indicating copy to clipboard operation
ncm2-ultisnips copied to clipboard

vimrc example is wrong

Open xiamaz opened this issue 7 years ago • 1 comments

Current vimrc example will not behave as expected.

Expected behavior

Expansions are triggered with enter key. Tab key will scroll through completion list if configured to do so.

Actual behavior

Expansions are triggered with tab key. Enter key will do nothing.

Fix

In the current example one line is commented out. This needs to be activated to work.

xiamaz avatar Oct 24 '18 09:10 xiamaz

@xiamaz Solve part of my issue. But only this still printed a string instead of call the ncm2_ultisnips#expand_or() function. gif1

So, I put this <buffer> argument on <CR> mapping, like:

inoremap <silent> <buffer> <expr> <CR> ncm2_ultisnips#expand_or("\<CR>", 'n')

gif2 And works like a charm.

So, thanks for your tip!

Edit:

I noticed that when I'm inside a project folder, such as a Rails project, the "print string" behavior still persists. What I did was delegate the mapping to a autocmd rule.

autocmd BufNewFile,BufRead * inoremap <silent> <buffer> <expr> <cr> ncm2_ultisnips#expand_or("\<CR>", 'n')

Works great to me. :+1:

sinetoami avatar Nov 21 '18 21:11 sinetoami