]> git.rmz.io Git - dotfiles.git/blobdiff - vim/vimrc
nvim: provide type annotations for LazyPluginSpecs
[dotfiles.git] / vim / vimrc
index d92ec16041e94bf344717a7c951de10c2cc6849c..9fd4ae506530ef6ed32513d0ef5baa4aadf7e18a 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -70,7 +70,28 @@ Plug 'tpope/vim-speeddating'
 Plug 'tpope/vim-surround'  "investigate vim-sandwich
 Plug 'tpope/vim-unimpaired'
 Plug 'tweekmonster/spellrotate.vim'
-Plug 'valloric/youcompleteme', { 'do': './install.py --clangd-completer --clang-completer' }
+if !has("nvim")
+  " Plug 'valloric/youcompleteme' {{{2
+  Plug 'valloric/youcompleteme',
+        \{ 'do': './install.py --clangd-completer --clang-completer' }
+  let g:ycm_clangd_binary_path = 'clangd'   " use clangd in path
+  let g:ycm_clangd_args = ['--clang-tidy']
+  let g:ycm_extra_conf_vim_data = ['getcwd()']
+  let g:ycm_add_preview_to_completeopt = 1
+  let g:ycm_complete_in_comments = 1
+  let g:ycm_complete_in_strings  = 1
+  let g:ycm_autoclose_preview_window_after_insertion = 0
+
+  let g:ycm_language_server =
+        \ [
+        \   {
+        \     'name': 'haskell',
+        \     'cmdline': [ 'haskell-language-server-wrapper', '--lsp' ],
+        \     'filetypes': [ 'haskell', 'lhaskell'  ]
+        \   },
+        \ ]
+  " }}}
+endif
 Plug 'vim-scripts/mediawiki.vim'
 Plug 'vim-scripts/replacewithregister'
 Plug 'vim-scripts/yankring.vim'
@@ -95,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'
@@ -247,6 +301,7 @@ set shortmess+=T    " truncate other messages in the middle
 set shortmess+=W    " don't give 'written' or '[w]' when writing a file
 set shortmess+=A    " ignore swapfile warning
 set shortmess+=I    " no splash screen
+set shortmess+=c    " don't give |ins-completion-menu| messages
 
 " editing text {{{2
 set backspace=indent,eol,start  " allow backspacing over everything in insert mode
@@ -264,6 +319,7 @@ set formatoptions+=t    " Auto-wrap text using textwidth
 set formatoptions-=o    " Do not insert comment leader after hitting o or O in normal mode
 
 set nrformats-=octal    " don't inc/dec octal numbers with ^[AX]
+set nrformats+=unsigned " treat all numbers as unsigned
 
 set complete=.       " scan the current buffer ( 'wrapscan' is ignored)
 set complete+=w      " scan buffers from other windows
@@ -315,6 +371,7 @@ set backupskip+=.netrc          " skip netrc
 set backupskip+=/dev/shm/pass*  " skip passwordstore files
 
 set undofile                    " persistent undo history
+set undolevels=10000            " moar undos
 if !has('nvim')
   set undodir=$XDG_CACHE_HOME/vim/undo//
 endif
@@ -352,6 +409,7 @@ set wildignore+=*.orig                           " Merge resolution files
 " running make and jumping to errors {{{2
 set makeprg=make\ -w     " print changing directories
 
+set grepformat=%f:%l:%c:%m
 set grepprg=ag\ --vimgrep\ $*
 
 " language specific {{{2
@@ -744,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', {
@@ -842,24 +868,6 @@ function! YRRunAfterMaps()
     nnoremap Y   :<C-U>YRYankCount 'y$'<CR>
 endfunction
 
-" youcompleteme {{{2
-let g:ycm_clangd_binary_path = 'clangd'   " use clangd in path
-let g:ycm_clangd_args = ['--clang-tidy']
-let g:ycm_extra_conf_vim_data = ['getcwd()']
-let g:ycm_add_preview_to_completeopt = 1
-let g:ycm_complete_in_comments = 1
-let g:ycm_complete_in_strings  = 1
-let g:ycm_autoclose_preview_window_after_insertion = 0
-
-let g:ycm_language_server =
-    \ [
-    \   {
-    \     'name': 'haskell',
-    \     'cmdline': [ 'haskell-language-server-wrapper', '--lsp' ],
-    \     'filetypes': [ 'haskell', 'lhaskell'  ]
-    \   },
-    \ ]
-
 " vim-easy-align {{{2
 " start interactive EasyAlign in visual mode
 vmap <Enter>   <Esc>:echohl WarningMsg \| echo "EasyAlign mapped to \16<leader>a now" \| echohl None<CR>