]> git.rmz.io Git - dotfiles.git/blobdiff - vim/vimrc
nvim: replace replacewithregister and sort with mini.operators
[dotfiles.git] / vim / vimrc
index bd479a7e36b08063dcef2a22933e5ea16d1d0b2c..8cf8255d8e5f13c6580a70b1e1072390f8c8f805 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -201,9 +201,15 @@ if !has("nvim")
   " staging
   Plug 'puremourning/vimspector' " replaced by lsp {{{2
     let g:vimspector_enable_mappings = 'HUMAN'
-  " }}}
   Plug 'vim-scripts/syntaxrange' " replaced by treesitter {{{2
-  " }}}
+  Plug 'vim-scripts/replacewithregister' " replaced by mini.operators {{{2
+  " sort operator replaced by mini.operaters {{{2
+  function! SortLinesOpFunc(...)
+    '[,']sort
+  endfunction
+  nnoremap <silent> gs :<C-U>set operatorfunc=SortLinesOpFunc<CR>g@
+  vnoremap <silent> gs :sort<cr>
+  " }}}2
 endif
 
 Plug 'alepez/vim-gtest'
@@ -239,14 +245,15 @@ Plug 'tpope/vim-abolish'
 Plug 'tpope/vim-characterize'
 " Plug 'tpope/vim-endwise' " TODO: delete?
 Plug 'tpope/vim-eunuch'
-Plug 'tpope/vim-fugitive'
+Plug 'tpope/vim-fugitive'  " {{{2
+let g:fugitive_legacy_commands = v:false
+"}}}
 Plug 'tpope/vim-repeat'
 Plug 'tpope/vim-scriptease'
 Plug 'tpope/vim-speeddating'
 Plug 'tpope/vim-unimpaired'
 Plug 'tweekmonster/spellrotate.vim'
 " Plug 'vim-scripts/mediawiki.vim' " TODO: delete?
-Plug 'vim-scripts/replacewithregister' " FIXME: is overridden by lsp
 Plug 'wincent/loupe'
 
 " text objects
@@ -451,7 +458,9 @@ set shiftround                  " round to 'shiftwidth' for "<<" and ">>"
 set expandtab                   " expand <Tab> to spaces in Insert mode
 set autoindent
 
-set pastetoggle=<F11>           " key sequence to toggle paste mode
+if !has('nvim')
+  set pastetoggle=<F11>           " key sequence to toggle paste mode
+endif
 
 " folding {{{2
 set foldmethod=marker           " folding type
@@ -563,34 +572,37 @@ augroup ft_stdin
     au StdinReadPost * :set buftype=nofile
 augroup END
 
-" Jump to last known cursor position {{{2
-augroup last_loc
+if !has("nvim")
+  " autocmds that already exist in neovim
+  " Jump to last known cursor position {{{2
+  augroup last_loc
+      au!
+      " blacklist certain filetype
+      let blacklist = ['gitcommit']
+      autocmd BufReadPost *
+                  \ if index(blacklist, &ft) < 0 && line("'\"") > 1 && line("'\"") <= line("$") |
+                  \   exe "normal! g`\"" |
+                  \ endif
+  augroup END
+
+  " Check for file modifications automatically {{{2
+  " (current buffer only)
+  " Use :NoAutoChecktime to disable it (uses b:autochecktime)
+  fun! MyAutoCheckTime()
+    " only check timestamp for normal files
+    if &buftype != '' | return | endif
+    if ! exists('b:autochecktime') || b:autochecktime
+      checktime %
+      let b:autochecktime = 1
+    endif
+  endfun
+  augroup MyAutoChecktime
     au!
-    " blacklist certain filetype
-    let blacklist = ['gitcommit']
-    autocmd BufReadPost *
-                \ if index(blacklist, &ft) < 0 && line("'\"") > 1 && line("'\"") <= line("$") |
-                \   exe "normal! g`\"" |
-                \ endif
-augroup END
-
-" Check for file modifications automatically {{{2
-" (current buffer only)
-" Use :NoAutoChecktime to disable it (uses b:autochecktime)
-fun! MyAutoCheckTime()
-  " only check timestamp for normal files
-  if &buftype != '' | return | endif
-  if ! exists('b:autochecktime') || b:autochecktime
-    checktime %
-    let b:autochecktime = 1
-  endif
-endfun
-augroup MyAutoChecktime
-  au!
-  au FocusGained,BufEnter,CursorHold,InsertEnter * call MyAutoCheckTime()
-augroup END
-command! NoAutoChecktime let b:autochecktime=0
-command! ToggleAutoChecktime let b:autochecktime=!get(b:, 'autochecktime', 0) | echom "b:autochecktime:" b:autochecktime
+    au FocusGained,BufEnter,CursorHold,InsertEnter * call MyAutoCheckTime()
+  augroup END
+  command! NoAutoChecktime let b:autochecktime=0
+  command! ToggleAutoChecktime let b:autochecktime=!get(b:, 'autochecktime', 0) | echom "b:autochecktime:" b:autochecktime
+endif
 
 " bindings {{{1
 
@@ -821,11 +833,9 @@ command! GToggle GitToggle
 nnoremap <silent> <leader>gs :GitToggle<CR>
 
 nnoremap <silent> <leader>gd :Gdiffsplit<CR>
-nnoremap <silent> <leader>gc :echohl WarningMsg \| echo "use \<leader>gcc instead" \| echohl None<CR> 
 nnoremap <silent> <leader>gcc :tab G commit -v<CR>
 nnoremap <silent> <leader>gca :tab G commit -v --amend<CR>
 nnoremap          <leader>gcf :tab G commit -v --fixup=
-nnoremap <silent> <leader>gp :echohl WarningMsg \| echo "use \<leader>gpp instead" \| echohl None<CR> 
 nnoremap <silent> <leader>gpp :Git push \| copen<CR>
 nnoremap <silent> <leader>gpf :Git push --force-with-lease \| copen<CR>
 nnoremap <silent> <leader>gll :Git pull<CR>
@@ -920,13 +930,6 @@ if !exists(":DiffOrig")
                   \ | wincmd p | diffthis
 endif
 
-" sort operator {{{2
-function! SortLinesOpFunc(...)
-  '[,']sort
-endfunction
-nnoremap <silent> gs :<C-U>set operatorfunc=SortLinesOpFunc<CR>g@
-vnoremap <silent> gs :sort<cr>
-
 " edit configs  {{{2
 " TODO: populate location list with both .vim and .lua files
 " TODO: create file if it doesn't exist in nvim or vim rtps