]> git.rmz.io Git - dotfiles.git/commitdiff
vim: do not Plug UltiSnips in nvim
authorSamir Benmendil <me@rmz.io>
Tue, 11 Apr 2023 15:46:02 +0000 (16:46 +0100)
committerSamir Benmendil <me@rmz.io>
Tue, 31 Oct 2023 23:08:51 +0000 (23:08 +0000)
There's LuaSnips.

vim/vimrc

index d94c7c23a259dbd0d8263cc109dc76976ff27b9b..9fd4ae506530ef6ed32513d0ef5baa4aadf7e18a 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -116,9 +116,42 @@ endif
 
 "}}}
 
-" snippets
-Plug 'sirver/ultisnips'
-Plug 'honza/vim-snippets'
+if !has("nvim")
+  Plug 'sirver/ultisnips' " {{{
+  Plug 'honza/vim-snippets'
+
+  let g:UltiSnipsEditSplit = 'vertical'
+  let g:UltiSnipsSnippetDirectories = [ expand("$XDG_CONFIG_HOME/vim/ultisnips") ]
+  if has('fname_case')
+    let g:UltiSnipsSnippetDirectories = ["UltiSnips", "ultisnips"]
+  endif
+  let g:UltiSnipsExpandTrigger       = "<tab>"
+  let g:UltiSnipsJumpForwardTrigger  = "<tab>"
+  let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
+  
+  " UltiSnips completion function that tries to expand a snippet. If there's no
+  " snippet for expanding, it checks for completion window and if it's shown,
+  " selects first element. If there's no completion window it tries to jump to
+  " next placeholder. If there's no placeholder it just returns TAB key
+  " https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411
+  function! g:UltiSnips_Complete()
+      call UltiSnips#ExpandSnippet()
+      if g:ulti_expand_res == 0
+          if pumvisible()
+              return "\<C-n>"
+          else
+              call UltiSnips#JumpForwards()
+              if g:ulti_jump_forwards_res == 0
+                 return "\<TAB>"
+              endif
+          endif
+      endif
+      return ""
+  endfunction
+  au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
+  let g:UltiSnipsListSnippets="<c-e>"
+"}}}
+endif
 
 " text objects
 Plug 'kana/vim-textobj-user'
@@ -769,38 +802,6 @@ let g:tcomment_textobject_inlinecomment = 'gic'
 let g:tcomment#filetype#guess = 0
 "let g:tcomment#options = {'whitespace' : 'no'}
 
-" ultisnips {{{2
-let g:UltiSnipsEditSplit = 'vertical'
-let g:UltiSnipsSnippetDirectories = [ expand("$XDG_CONFIG_HOME/vim/ultisnips") ]
-if has('fname_case')
-  let g:UltiSnipsSnippetDirectories = ["UltiSnips", "ultisnips"]
-endif
-let g:UltiSnipsExpandTrigger       = "<tab>"
-let g:UltiSnipsJumpForwardTrigger  = "<tab>"
-let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
-
-" UltiSnips completion function that tries to expand a snippet. If there's no
-" snippet for expanding, it checks for completion window and if it's shown,
-" selects first element. If there's no completion window it tries to jump to
-" next placeholder. If there's no placeholder it just returns TAB key
-" https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411
-function! g:UltiSnips_Complete()
-    call UltiSnips#ExpandSnippet()
-    if g:ulti_expand_res == 0
-        if pumvisible()
-            return "\<C-n>"
-        else
-            call UltiSnips#JumpForwards()
-            if g:ulti_jump_forwards_res == 0
-               return "\<TAB>"
-            endif
-        endif
-    endif
-    return ""
-endfunction
-au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
-let g:UltiSnipsListSnippets="<c-e>"
-
 " unite {{{2
 call unite#filters#matcher_default#use(['matcher_fuzzy'])
 call unite#custom#profile('default', 'context', {