From ca86a91b1090cfafe53cf2244ae7d1625e84f2bf Mon Sep 17 00:00:00 2001 From: Edward Litherland-Smith Date: Mon, 29 Mar 2021 14:31:11 +0100 Subject: [PATCH] Add vim-gitgutter plugin and relevant config Add gitgutter added/modified/removed count to statusbar --- .gitmodules | 3 +++ pack/plugins/start/vim-gitgutter | 1 + vimrc | 12 ++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 160000 pack/plugins/start/vim-gitgutter diff --git a/.gitmodules b/.gitmodules index 7fbd76a2..2ff97855 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,3 +43,6 @@ [submodule "extras/onehalf"] path = extras/onehalf url = https://github.com/sonph/onehalf.git +[submodule "pack/plugins/start/vim-gitgutter"] + path = pack/plugins/start/vim-gitgutter + url = https://github.com/airblade/vim-gitgutter.git diff --git a/pack/plugins/start/vim-gitgutter b/pack/plugins/start/vim-gitgutter new file mode 160000 index 00000000..24cc4778 --- /dev/null +++ b/pack/plugins/start/vim-gitgutter @@ -0,0 +1 @@ +Subproject commit 24cc47789557827209add5881c226243711475ce diff --git a/vimrc b/vimrc index 6cb371e8..56d2627f 100644 --- a/vimrc +++ b/vimrc @@ -8,6 +8,9 @@ set t_TI="" set t_TE="" set t_ut="" +set updatetime=1000 +set signcolumn=yes + colorscheme onehalfdark if exists('+termguicolors') && ($COLORTERM == "24bit" || $COLORTERM == "truecolor") let &t_8f = "\[38;2;%lu;%lu;%lum" @@ -68,6 +71,11 @@ nnoremap b :buffers:buffer set splitbelow set splitright +function! GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('%s +%d ~%d -%d', FugitiveHead(), a, m, r) +endfunction + let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+' let g:python_highlight_all = 1 @@ -91,13 +99,13 @@ let g:lightline.component_type = { \ } let g:lightline.component_function = { - \ 'gitbranch': 'FugitiveHead' + \ 'gitstatus': 'GitStatus' \ } let g:lightline.active = { \ 'left': [ [ 'mode', 'paste' ], - \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ], + \ [ 'gitstatus', 'readonly', 'filename', 'modified' ] ], \ 'right': [ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok', 'lineinfo' ], \ [ 'percent' ], \ [ 'fileformat', 'fileencoding', 'filetype' ] ]