Tab with Deoplete UltiSnips EndWise AutoPairs - dblanken/dotfiles GitHub Wiki
Note that you should be able to do this with almost any other mapping, provided they don't mess with your .
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
let g:UltiSnipsExpandTrigger = "<nop>"
let g:UltiSnipsJumpForwardTrigger = "<Tab>"
let g:UltiSnipsJumpBackwardTrigger = "<S-Tab>"
let g:ulti_expand_or_jump_res = 0
function ExpandSnippetOrCarriageReturn()
let snippet = UltiSnips#ExpandSnippetOrJump()
if g:ulti_expand_or_jump_res > 0
return snippet
else
return "\<CR>"
endif
endfunction
let g:endwise_no_mappings = 1
let g:AutoPairsMapCR = 0
function! s:check_last_char_was_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : <SID>check_last_char_was_space() ? "\<TAB>" : deoplete#mappings#manual_complete()
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <CR> pumvisible() ? "\<C-R>=ExpandSnippetOrCarriageReturn()\<CR>" : "\<CR>\<C-R>=EndwiseDiscretionary()\<CR><C-R>=AutoPairsReturn()\<CR>"
Notice the last inoremap, that is where it then will work with other plugins--you can see that I added EndwiseDiscretionary() and AutoPairsReturn() which is what usually gets called for these.