From 9e36bdf1a060a2ffcb0172eb42e954c475ec3f70 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Tue, 20 Nov 2018 23:56:02 +0100 Subject: Improved Tab/Statusline, e.g. fixed spacing also added gh for c files, guess what that does ;) --- after/syntax/c.vim | 6 +++++ plugin/statusline.vim | 62 ++++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/after/syntax/c.vim b/after/syntax/c.vim index 0bacea0..cbdd42b 100644 --- a/after/syntax/c.vim +++ b/after/syntax/c.vim @@ -29,6 +29,12 @@ let g:load_doxygen_syntax=1 set formatoptions+=j " Where it makes sense, remove a comment leader when joining lines. set formatoptions+=1 " Don't break a line after a one-letter word. + + +" open a corresponding header file +nnorem gh :execute 'edit '.findfile(substitute(expand('%:t'),'\.[ch]$','.h','')) + + " multiple single line comments in a row " broken! " syn region myCComment start="/\*" end="\*/" fold keepend transparent diff --git a/plugin/statusline.vim b/plugin/statusline.vim index 98fc4a9..7bcc963 100644 --- a/plugin/statusline.vim +++ b/plugin/statusline.vim @@ -2,22 +2,26 @@ augroup MAX_FANCYLINE set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split - let g:status_sym_start = '' - let g:status_sym_end = '' - let g:status_sym_sep_start = '' - let g:status_sym_sep_end = '' - let g:symbol_branch = '' + let g:status_sym_start = '' + let g:status_sym_end = '' + let g:status_sym_sep_start = '᎒' + let g:status_sym_sep_end = '᎒' + let g:symbol_branch = '' if &term == "linux" - let g:symbol_branch = '' + let g:status_sym_start = '' + let g:status_sym_end = '' + let g:status_sym_sep_start = '' + let g:status_sym_sep_end = '' + let g:symbol_branch = '' - let g:group_active = "StatusLineTerm" - let g:group_inactive = "StatusLineTermNC" - let g:group_tabline = "StatusLineTerm" + let g:group_active = "StatusLineTerm" + let g:group_inactive = "StatusLineTermNC" + let g:group_tabline = "StatusLineTerm" else - let g:group_active = "StatusLine" - let g:group_inactive = "StatusLineNC" - let g:group_tabline = "TabLine" + let g:group_active = "StatusLine" + let g:group_inactive = "StatusLineNC" + let g:group_tabline = "TabLine" endif " this function reverts foreground color and background color of a given @@ -55,14 +59,14 @@ augroup MAX_FANCYLINE return '' \ ."%#StatusLineHighlight#" \ ."%#".a:highlight_group."#" - \ ."%(%w%h%q%)".' '.l:mode.' '.g:status_sym_sep_start.' ' - \ ."%{(argc()>0\ ?\ argidx()+1.':'.argc().' '.g:status_sym_sep_start.' '\ :\ '')}" - \ ."%{winbufnr(0).' '.g:status_sym_sep_start}" \ ."%{(&readonly\ ?\ '\ \ 🔒'\ :\ '')}" - \ ."%{(&modified\ ?\ '\ \ '.nr2char(0xF0C7).'\ '\ :\ '')\ }" - \ ."%{(haslocaldir() ?\ fnamemodify(getcwd(),\ ':.').' '.nr2char(0xe0b1)\ \:\ '')}\ " - \ ."%{(&buftype\ ==\ \"terminal\"\ ?\ has('nvim')?b:term_title:expand(&titlestring)\ :\ substitute(expand('%:p'),\ '^'.getcwd(-1).'/*',\ '',\ ''))\ }" - \ ."%1(%)" + \ ."%{(&modified\ ?\ '\ \ '\ :\ '')}" + \ ."%(%w%h%q%)".' '.l:mode.' ' + \ ."%{(argc()>0\ ?\ argidx()+1.':'.argc().' '.g:status_sym_sep_start.' '\ :\ '')}" + \ ."%{(haslocaldir() ?\ g:status_sym_sep_start.' '.fnamemodify(getcwd(),\ ':.').'/ '\ \:\ '')}\ " + \ ."%{bufname('%')==''?'':g:status_sym_sep_start.' '.substitute(bufname('%'),\ '^'.getcwd(-1).'/*',\ '',\ '').' '}" + \ ."%{(&titlestring\ ?\ has('nvim')?b:term_title:expand(&titlestring):'')\ }" + \ ."%{g:status_sym_sep_start.' '.winbufnr(0).' '}" \ ."%#".l:invert_group."#" \ .g:status_sym_end \ .'' @@ -71,26 +75,24 @@ augroup MAX_FANCYLINE \ ."%#".l:invert_group."#" \ .g:status_sym_start \ ."%#".a:highlight_group."#" - \ ."%1(%)" - \ ."%{(&filetype\ !=\ ''\ ?\ &filetype\ :\ &buftype)}" - \ ."%(\ %{g:status_sym_sep_end}\ %)" + \ ."%{&buftype==''?'':' '.&buftype.' '.g:status_sym_sep_start.' '}" + \ ."%{&filetype==''?'':' '.&filetype.' '.g:status_sym_sep_start.' '}" \ ."%{(&spell\ ?\ &spelllang.' '.g:status_sym_sep_end\ :\ '')}" - \ ."%{(&fileencoding\ !=\ ''\ ?\ &fileencoding.' '.g:status_sym_sep_end.' '\ :\ '')}" - \ ."%{(&fileformat\ !=\ ''\ ?\ ' '.&fileformat.' '\ :\ '')}" - \ .g:status_sym_sep_end.' ' - \ ."%4l:%-3c" + \ ."%{(&fileencoding=~'^$\\|^utf\-8$'?'':&fileencoding.' '.g:status_sym_sep_end.' ')}" + \ ."%{(&fileformat=~'^$\\|^unix$'?'':&fileformat.' '.g:status_sym_sep_end)}" + \ ."%l:%-3c" \ .g:status_sym_sep_end.' ' - \ ."%-3p%%" + \ ."%p%% " endfunction function! UpdateTabline(highlight_group) let l:invert_group = CreateInvertGroup(a:highlight_group) + let l:git_branch = FugitiveHead() return '' \ ."%#".a:highlight_group."#" \ ."%3( \ %)\ " \ ."%{getcwd(-1)}\ " - \ .g:status_sym_sep_start.' ' - \ ."%(\ ".g:symbol_branch."\ %{fugitive#head()}\ %)" + \ ."%{FugitiveHead()==''?'':g:status_sym_sep_start.' '.g:symbol_branch.' '.FugitiveHead().' '}" \ ."%#".l:invert_group."#" \ .g:status_sym_end \ .'' @@ -102,7 +104,7 @@ augroup MAX_FANCYLINE \ ."%3(\ %)" \ ."%(%{v:servername}\ %{v:this_session}%)" \ .g:status_sym_sep_end.' ' - \ ."%(\ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)" + \ ."%(\ \ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)" \ ."%##" \ ."" " end endfunction -- cgit v1.2.3