From be33c0ebd2ebb5d52b4566c9f002874f9f766184 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Thu, 17 Mar 2022 18:57:12 +0000 Subject: git-gutter status, formatting --- vimrc | 62 +++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/vimrc b/vimrc index 47e802e..3601b99 100644 --- a/vimrc +++ b/vimrc @@ -92,36 +92,44 @@ call plug#end() " metals status function! MetalsStatus() abort - return get(g:, 'metals_status', '') + return get(g:, 'metals_status', '') endfunction +" git-gutter status +" +function! GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('+%d ~%d -%d', a, m, r) +endfunction + + function! StatusLine(current, width) - let l:s = '' - - if a:current - let l:s .= crystalline#mode() . crystalline#right_mode_sep('') - else - let l:s .= '%#CrystallineInactive#' - endif - let l:s .= ' %<%f%h%w%m%r ' - - if a:current - let l:s .= crystalline#right_sep('', 'Fill') . ' %{fugitive#statusline()}' - endif - - let l:s .= '%=' - if a:current - let l:s .= ' %{MetalsStatus()} ' - let l:s .= crystalline#left_sep('', 'Fill') . ' %{&paste ?"PASTE ":""}%{&spell?"SPELL ":""}' - let l:s .= crystalline#left_mode_sep('') - endif - if a:width > 80 - let l:s .= ' %{&ft} [%{&fenc!=#""?&fenc:&enc}][%{&ff}] %3(%c%V%) %l/%L %P ' - else - let l:s .= ' ' - endif - - return l:s + let l:s = '' + + if a:current + let l:s .= crystalline#mode() . crystalline#right_mode_sep('') + else + let l:s .= '%#CrystallineInactive#' + endif + let l:s .= ' %<%f%h%w%m%r ' + + if a:current + let l:s .= crystalline#right_sep('', 'Fill') . ' %{fugitive#statusline()}' .' %{GitStatus()}' + endif + + let l:s .= '%=' + if a:current + let l:s .= ' %{MetalsStatus()} ' + let l:s .= crystalline#left_sep('', 'Fill') . ' %{&paste ?"PASTE ":""}%{&spell?"SPELL ":""}' + let l:s .= crystalline#left_mode_sep('') + endif + if a:width > 80 + let l:s .= ' %{&ft} [%{&fenc!=#""?&fenc:&enc}][%{&ff}] %3(%c%V%) %l/%L %P ' + else + let l:s .= ' ' + endif + + return l:s endfunction let g:crystalline_enable_sep = 1 -- cgit v1.2.3