Skip to content

Instantly share code, notes, and snippets.

@willopez
Last active August 29, 2015 14:12
Show Gist options
  • Save willopez/c39ee9547866e4e02b48 to your computer and use it in GitHub Desktop.
Save willopez/c39ee9547866e4e02b48 to your computer and use it in GitHub Desktop.
Vim Snippets expand trigger functon
function! Neoj()
if pumvisible() == 1
return "\<C-n>"
else
call UltiSnips#JumpForwards()
if g:ulti_jump_forwards_res == 0
return "\<C-j>"
endif
return ""
endif
endfunction
function! Neok()
if pumvisible() == 1
return "\<C-p>"
else
call UltiSnips#JumpBackwards()
if g:ulti_jump_backwards_res == 0
return "\<C-k>"
endif
return ""
endif
endfunction
let g:UltiSnipsJumpForwardTrigger = "<nop>"
let g:UltiSnipsJumpBackwardTrigger = "<nop>"
inoremap <silent> <C-j> <C-R>=Neoj()<CR>
snoremap <silent> <C-j> <Esc>:call UltiSnips#JumpForwards()<CR>
inoremap <silent> <C-k> <C-R>=Neok()<CR>
snoremap <silent> <C-k> <Esc>:call UltiSnips#JumpBackwards()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment