Skip to content

Commit

Permalink
fix: load missing custom cmp ultisnips mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
QuangBaNhatNguyen committed Aug 2, 2024
1 parent 4044017 commit 2be0eda
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
32 changes: 17 additions & 15 deletions autoload/cmp_nvim_ultisnips.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ function! cmp_nvim_ultisnips#setup_treesitter_autocmds()
augroup end
endfunction

" Define silent mappings
function! cmp_nvim_ultisnips#initCustomUltiSnipMappings()
" Define silent mappings

" More info on why CursorMoved is called can be found here:
" https://github.com/SirVer/ultisnips/issues/1295#issuecomment-774056584
imap <silent> <Plug>(cmpu-expand)
\ <C-r>=[UltiSnips#CursorMoved(), UltiSnips#ExpandSnippet()][1]<cr>
" More info on why CursorMoved is called can be found here:
" https://github.com/SirVer/ultisnips/issues/1295#issuecomment-774056584
imap <silent> <Plug>(cmpu-expand)
\ <C-r>=[UltiSnips#CursorMoved(), UltiSnips#ExpandSnippet()][1]<cr>
smap <silent> <Plug>(cmpu-expand)
\ <Esc>:call UltiSnips#ExpandSnippetOrJump()<cr>
smap <silent> <Plug>(cmpu-expand)
\ <Esc>:call UltiSnips#ExpandSnippetOrJump()<cr>
imap <silent> <Plug>(cmpu-jump-forwards)
\ <C-r>=UltiSnips#JumpForwards()<cr>
imap <silent> <Plug>(cmpu-jump-forwards)
\ <C-r>=UltiSnips#JumpForwards()<cr>
smap <silent> <Plug>(cmpu-jump-forwards)
\ <Esc>:call UltiSnips#JumpForwards()<cr>
smap <silent> <Plug>(cmpu-jump-forwards)
\ <Esc>:call UltiSnips#JumpForwards()<cr>
imap <silent> <Plug>(cmpu-jump-backwards)
\ <C-r>=UltiSnips#JumpBackwards()<cr>
imap <silent> <Plug>(cmpu-jump-backwards)
\ <C-r>=UltiSnips#JumpBackwards()<cr>
smap <silent> <Plug>(cmpu-jump-backwards)
\ <Esc>:call UltiSnips#JumpBackwards()<cr>
smap <silent> <Plug>(cmpu-jump-backwards)
\ <Esc>:call UltiSnips#JumpBackwards()<cr>
endfunction
2 changes: 2 additions & 0 deletions lua/cmp_nvim_ultisnips/source.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function source.new(config)
vim.fn["cmp_nvim_ultisnips#setup_treesitter_autocmds"]()
end
end

vim.fn["cmp_nvim_ultisnips#initCustomUltiSnipMappings"]()
return self
end

Expand Down

0 comments on commit 2be0eda

Please sign in to comment.