aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMax Christian Pohle2021-10-09 02:23:44 +0200
committerMax Christian Pohle2021-10-09 02:23:44 +0200
commitbf4fadce4d57396ccbadd0493cac294fe6c69b90 (patch)
treeab731a40012ee2db10d8291bc75608c2fca3d025 /plugin
parent37c0222c1eb00d2ea88ca4bf8f732b71d6bcf986 (diff)
downloadvim-fancy-line-master.tar.bz2
vim-fancy-line-master.zip
Git branch system call was too slow: fixedHEADmaster
Diffstat (limited to 'plugin')
-rwxr-xr-xplugin/vim-fancy-line.vim13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugin/vim-fancy-line.vim b/plugin/vim-fancy-line.vim
index bfa5e1c..5cb0877 100755
--- a/plugin/vim-fancy-line.vim
+++ b/plugin/vim-fancy-line.vim
@@ -5,6 +5,7 @@ augroup MAX_FANCY_LINE
5 set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split 5 set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split
6 6
7 7
8
8 if (&term ==? 'linux') 9 if (&term ==? 'linux')
9 let g:group_active = 'StatusLineTerm' 10 let g:group_active = 'StatusLineTerm'
10 let g:group_inactive = 'StatusLineTermNC' 11 let g:group_inactive = 'StatusLineTermNC'
@@ -27,6 +28,14 @@ augroup MAX_FANCY_LINE
27 let g:symbol_screen_edge = '░' 28 let g:symbol_screen_edge = '░'
28 endif 29 endif
29 30
31 """ shell calls are expensive. We only want to read the name of a Git
32 """ branch if there is a chance, that it has changed.
33 let s:git_branch = ""
34 function! s:updateGitBranchName()
35 let s:git_branch = systemlist('git branch --show-current')
36 let s:git_branch = (v:shell_error || s:git_branch == []) ? "" : g:status_sym_sep_start . ' ' . g:symbol_branch . ' ' . s:git_branch[0]
37 endfunction
38 autocmd DirChanged,BufRead * call s:updateGitBranchName()
30 39
31 " this function reverts foreground color and background color of a given 40 " this function reverts foreground color and background color of a given
32 " highlight group and returns the name of a newly created _invert group 41 " highlight group and returns the name of a newly created _invert group
@@ -108,8 +117,6 @@ augroup MAX_FANCY_LINE
108 117
109 function! UpdateTabline(highlight_group) 118 function! UpdateTabline(highlight_group)
110 let l:invert_group = CreateInvertGroup(a:highlight_group) 119 let l:invert_group = CreateInvertGroup(a:highlight_group)
111 let l:git_branch = systemlist('git branch --show-current')
112 let l:git_branch = (v:shell_error || l:git_branch == []) ? "" : g:status_sym_sep_start . ' ' . g:symbol_branch . ' ' . l:git_branch[0]
113 120
114 return '' 121 return ''
115 \ .'%#'.a:highlight_group.'#' 122 \ .'%#'.a:highlight_group.'#'
@@ -119,7 +126,7 @@ augroup MAX_FANCY_LINE
119 \ .'%-2( %)' 126 \ .'%-2( %)'
120 \ .'%{fnamemodify(getcwd(-1), ":~")}' 127 \ .'%{fnamemodify(getcwd(-1), ":~")}'
121 \ .' ' 128 \ .' '
122 \ .l:git_branch 129 \ .s:git_branch
123 \ .' ' 130 \ .' '
124 \ .'%#'.l:invert_group.'#' 131 \ .'%#'.l:invert_group.'#'
125 \ .g:status_sym_end 132 \ .g:status_sym_end
..