nvim: Drop vim-fugitive and move to gina
vim-fugitive from Tpope is synchronous on neovim. It is asynchronous on vim when vim-dispatch is available but for neovim it will always be synchronous. Gina is asynchronous by default and does not freeze on large repos like fugitive does. So drop fugitive, other plugins and settings dependent on it. While at it, also add some more good things from git gutter and some shortcuts. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
d879a43b48
commit
f56bb8c5fb
2 changed files with 78 additions and 38 deletions
|
@ -27,18 +27,12 @@ Plug 'tmux-plugins/vim-tmux-focus-events'
|
||||||
Plug 'wellle/tmux-complete.vim'
|
Plug 'wellle/tmux-complete.vim'
|
||||||
" For LaTeX support
|
" For LaTeX support
|
||||||
Plug 'lervag/vimtex'
|
Plug 'lervag/vimtex'
|
||||||
" Primary git support
|
" Git support
|
||||||
Plug 'tpope/vim-fugitive'
|
Plug 'lambdalisue/gina.vim'
|
||||||
" Manage git hunks
|
|
||||||
Plug 'airblade/vim-gitgutter'
|
Plug 'airblade/vim-gitgutter'
|
||||||
" Git blame
|
|
||||||
Plug 'rhysd/git-messenger.vim'
|
Plug 'rhysd/git-messenger.vim'
|
||||||
" Git logs
|
|
||||||
Plug 'rbong/vim-flog'
|
|
||||||
" Handle merge conflicts
|
|
||||||
Plug 'samoshkin/vim-mergetool'
|
Plug 'samoshkin/vim-mergetool'
|
||||||
" Git diffs in quickfix list
|
Plug 'whiteinge/diffconflicts'
|
||||||
Plug 'oguzbilgic/vim-gdiff'
|
|
||||||
" Boost vim command line mode
|
" Boost vim command line mode
|
||||||
Plug 'vim-utils/vim-husk'
|
Plug 'vim-utils/vim-husk'
|
||||||
" GDB
|
" GDB
|
||||||
|
@ -118,7 +112,7 @@ let maplocalleader=","
|
||||||
|
|
||||||
set colorcolumn=80 " Highlight 80th column
|
set colorcolumn=80 " Highlight 80th column
|
||||||
set laststatus=2 " Always show status bar
|
set laststatus=2 " Always show status bar
|
||||||
set updatetime=300 " Let plugins show effects after 500ms
|
set updatetime=100 " Let plugins show effects after 100ms
|
||||||
set mouse-=a " Disable mouse click to go to position
|
set mouse-=a " Disable mouse click to go to position
|
||||||
set encoding=utf-8
|
set encoding=utf-8
|
||||||
set exrc " Allow loading local .nvimrc files
|
set exrc " Allow loading local .nvimrc files
|
||||||
|
@ -219,6 +213,7 @@ nnoremap <Leader>fo :Locate<SPACE>
|
||||||
nnoremap <Leader>fk :Maps<CR>
|
nnoremap <Leader>fk :Maps<CR>
|
||||||
nnoremap <Leader>f/ :Rg<CR>
|
nnoremap <Leader>f/ :Rg<CR>
|
||||||
nnoremap <Leader>fs :exe ':Rg ' . expand('<cword>')<CR>
|
nnoremap <Leader>fs :exe ':Rg ' . expand('<cword>')<CR>
|
||||||
|
nnoremap <Leader>fg :GGrep<SPACE>
|
||||||
imap <C-x><C-w> <Plug>(fzf-complete-word)
|
imap <C-x><C-w> <Plug>(fzf-complete-word)
|
||||||
imap <C-x><C-p> <Plug>(fzf-complete-path)
|
imap <C-x><C-p> <Plug>(fzf-complete-path)
|
||||||
imap <C-x><C-f> <Plug>(fzf-complete-file)
|
imap <C-x><C-f> <Plug>(fzf-complete-file)
|
||||||
|
@ -246,24 +241,27 @@ nnoremap [s :FloatermPrev<CR>
|
||||||
nnoremap ]s :FloatermNext<CR>
|
nnoremap ]s :FloatermNext<CR>
|
||||||
nnoremap st :FloatermToggle<CR>
|
nnoremap st :FloatermToggle<CR>
|
||||||
" For git
|
" For git
|
||||||
nnoremap <Leader>gm :GitMessenger<CR>
|
nnoremap <Leader>gm :GitMessenger<CR>
|
||||||
nnoremap <Leader>gl :0Glog<CR>
|
nnoremap <Leader>glh :Gina log --opener=split<CR>
|
||||||
nnoremap <Leader>gL :Glog<CR>
|
nnoremap <Leader>glv :Gina log --opener=vsplit<CR>
|
||||||
nnoremap <Leader>gd :Gdiff<CR>
|
nnoremap <Leader>gL :Gina log<SPACE>
|
||||||
nnoremap <Leader>gD :Gdiffsplit<CR>
|
nnoremap <Leader>gdh :Gina diff --opener=split<CR>
|
||||||
nnoremap <Leader>gs :Gstatus<CR>
|
nnoremap <Leader>gdv :Gina diff --opener=split<CR>
|
||||||
nnoremap <Leader>gc :Gcommit -v -q --signoff<CR>
|
nnoremap <Leader>gD :Gina diff<SPACE>
|
||||||
nnoremap <Leader>gt :Gcommit -v -q --signoff %:p<CR>
|
nnoremap <Leader>gs :Gina! status<CR>
|
||||||
nnoremap <Leader>gp :Git push<CR>
|
nnoremap <Leader>ghs :Gina status --opener=split<CR>
|
||||||
nnoremap <Leader>gu :Git push -u<SPACE>
|
nnoremap <Leader>gvs :Gina status --opener=vsplit<CR>
|
||||||
nnoremap <Leader>gr :Git remote -v<CR>
|
nnoremap <Leader>gc :Gina commit -v -q --signoff<CR>
|
||||||
nnoremap <Leader>gb :Git branch<SPACE>
|
nnoremap <Leader>gt :Gina commit -v -q --signoff %:p<CR>
|
||||||
nnoremap <Leader>go :Git checkout<SPACE>
|
nnoremap <Leader>gp :Gina push<CR>
|
||||||
nnoremap <Leader>g- :Git stash<CR>:e<CR>
|
nnoremap <Leader>gu :Gina push -u<SPACE>
|
||||||
nnoremap <Leader>g+ :Git stash pop<CR>:e<CR>
|
nnoremap <Leader>gr :Gina remote -v<CR>
|
||||||
nnoremap <Leader>gG :exe ':Ggrep ' . expand('<cword>')<CR>
|
nnoremap <Leader>gb :Gina! branch<CR>
|
||||||
nnoremap <Leader>gF :Ggrep<SPACE>
|
nnoremap <Leader>gB :Gina branch<SPACE>
|
||||||
nnoremap <Leader>gg :GGrep<SPACE>
|
nnoremap <Leader>go :Gina checkout<SPACE>
|
||||||
|
nnoremap <Leader>g- :Gina stash<CR>:e<CR>
|
||||||
|
nnoremap <Leader>g+ :Gina stash<SPACE>
|
||||||
|
" Git merge tool
|
||||||
nnoremap <Leader>ml :MergetoolDiffExchangeLeft<CR>
|
nnoremap <Leader>ml :MergetoolDiffExchangeLeft<CR>
|
||||||
nnoremap <Leader>mr :MergetoolDiffExchangeRight<CR>
|
nnoremap <Leader>mr :MergetoolDiffExchangeRight<CR>
|
||||||
nnoremap <Leader>mu :MergetoolDiffExchangeUp<CR>
|
nnoremap <Leader>mu :MergetoolDiffExchangeUp<CR>
|
||||||
|
@ -273,11 +271,20 @@ nnoremap <Leader>mp :diffput<CR>
|
||||||
" For gitgutter
|
" For gitgutter
|
||||||
nnoremap ]h :GitGutterNextHunk<CR>
|
nnoremap ]h :GitGutterNextHunk<CR>
|
||||||
nnoremap [h :GitGutterPrevHunk<CR>
|
nnoremap [h :GitGutterPrevHunk<CR>
|
||||||
|
nnoremap ]c :call NextHunkAllBuffers()<CR>
|
||||||
|
nnoremap [c :call PrevHunkAllBuffers()<CR>
|
||||||
nnoremap <Leader>sh :GitGutterStageHunk<CR>
|
nnoremap <Leader>sh :GitGutterStageHunk<CR>
|
||||||
nnoremap <Leader>uh :GitGutterUndoHunk<CR>
|
nnoremap <Leader>uh :GitGutterUndoHunk<CR>
|
||||||
nnoremap <Leader>ph :GitGutterPreviewHunk<CR>
|
nnoremap <Leader>ph :GitGutterPreviewHunk<CR>
|
||||||
nnoremap <Leader>qh :GitGutterQuickFix<CR>
|
nnoremap <Leader>qh :GitGutterQuickFix<CR>
|
||||||
nnoremap <Leader>gf :GitGutterFold<CR>
|
nnoremap <Leader>gf :GitGutterFold<CR>
|
||||||
|
omap ih <Plug>(GitGutterTextObjectInnerPending)
|
||||||
|
omap ah <Plug>(GitGutterTextObjectOuterPending)
|
||||||
|
xmap ih <Plug>(GitGutterTextObjectInnerVisual)
|
||||||
|
xmap ah <Plug>(GitGutterTextObjectOuterVisual)
|
||||||
|
" Jump to sections of diff
|
||||||
|
nnoremap { ?^@@<CR>
|
||||||
|
nnoremap } /^@@<CR>
|
||||||
" For Neomake/Neoformat
|
" For Neomake/Neoformat
|
||||||
nnoremap <Leader>nm :Neomake<CR>
|
nnoremap <Leader>nm :Neomake<CR>
|
||||||
nnoremap <Leader>nc :NeomakeClean<CR>
|
nnoremap <Leader>nc :NeomakeClean<CR>
|
||||||
|
@ -538,3 +545,46 @@ function! s:incsearch_config(...) abort
|
||||||
\ 'is_expr': 0
|
\ 'is_expr': 0
|
||||||
\ }), get(a:, 1, {}))
|
\ }), get(a:, 1, {}))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Taken from gitgutter README. Cycles through all hunks in all open buffers.
|
||||||
|
function! NextHunkAllBuffers()
|
||||||
|
let line = line('.')
|
||||||
|
GitGutterNextHunk
|
||||||
|
if line('.') != line
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let bufnr = bufnr('')
|
||||||
|
while 1
|
||||||
|
bnext
|
||||||
|
if bufnr('') == bufnr
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
if !empty(GitGutterGetHunks())
|
||||||
|
1
|
||||||
|
GitGutterNextHunk
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! PrevHunkAllBuffers()
|
||||||
|
let line = line('.')
|
||||||
|
GitGutterPrevHunk
|
||||||
|
if line('.') != line
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let bufnr = bufnr('')
|
||||||
|
while 1
|
||||||
|
bprevious
|
||||||
|
if bufnr('') == bufnr
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
if !empty(GitGutterGetHunks())
|
||||||
|
normal! G
|
||||||
|
GitGutterPrevHunk
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
|
@ -13,14 +13,6 @@ hi User6 guifg=Gray guibg=Black
|
||||||
hi User7 guifg=Gray guibg=Black
|
hi User7 guifg=Gray guibg=Black
|
||||||
hi User8 guifg=DarkYellow guibg=Black
|
hi User8 guifg=DarkYellow guibg=Black
|
||||||
|
|
||||||
function! GitInfo()
|
|
||||||
let git = fugitive#head()
|
|
||||||
if git != ''
|
|
||||||
return ' '.fugitive#head()
|
|
||||||
else
|
|
||||||
return ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" https://nest.pijul.com/tae/setup:master/
|
" https://nest.pijul.com/tae/setup:master/
|
||||||
function! GetCursorPosition()
|
function! GetCursorPosition()
|
||||||
if &buftype == ''
|
if &buftype == ''
|
||||||
|
@ -59,7 +51,6 @@ endfunction
|
||||||
function! ActiveStatus() abort
|
function! ActiveStatus() abort
|
||||||
let statusline=""
|
let statusline=""
|
||||||
let statusline.="%1*\ %{winnr()}\ "
|
let statusline.="%1*\ %{winnr()}\ "
|
||||||
let statusline.="%2*\ %{GitInfo()}"
|
|
||||||
let statusline.="%4*\ %{GitHunkStatus()}"
|
let statusline.="%4*\ %{GitHunkStatus()}"
|
||||||
let statusline.="%2*\ %Y\ "
|
let statusline.="%2*\ %Y\ "
|
||||||
let statusline.="%3*%<%{GetFileDir()}"
|
let statusline.="%3*%<%{GetFileDir()}"
|
||||||
|
@ -71,7 +62,6 @@ endfunction
|
||||||
function! PassiveStatus() abort
|
function! PassiveStatus() abort
|
||||||
let statusline=""
|
let statusline=""
|
||||||
let statusline.="%5*\ %{winnr()}\ "
|
let statusline.="%5*\ %{winnr()}\ "
|
||||||
let statusline.="%6*\ %{GitInfo()}"
|
|
||||||
let statusline.="%8*\ %{GitHunkStatus()}"
|
let statusline.="%8*\ %{GitHunkStatus()}"
|
||||||
let statusline.="%6*\ %Y\ "
|
let statusline.="%6*\ %Y\ "
|
||||||
let statusline.="%7*%<%{GetFileDir()}"
|
let statusline.="%7*%<%{GetFileDir()}"
|
||||||
|
|
Loading…
Reference in a new issue