aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMax Christian Pohle2019-10-09 20:17:28 +0200
committerMax Christian Pohle2019-10-09 20:17:28 +0200
commitba1f099db5afeedb323c05127df1cc34df85ec85 (patch)
treeaede4dc1a8d2f8d9fbd07c4639c59dfe999ca2d3 /plugin
parenteccf27e61a9a2864f25a1bebb6383a30efab83d3 (diff)
downloadvim-ba1f099db5afeedb323c05127df1cc34df85ec85.tar.bz2
vim-ba1f099db5afeedb323c05127df1cc34df85ec85.zip
Further refactored statusline and splash
Diffstat (limited to 'plugin')
-rw-r--r--plugin/max-splash.vim2
-rw-r--r--plugin/statusline.vim79
2 files changed, 42 insertions, 39 deletions
diff --git a/plugin/max-splash.vim b/plugin/max-splash.vim
index 6b5e70d..bc578e1 100644
--- a/plugin/max-splash.vim
+++ b/plugin/max-splash.vim
@@ -19,7 +19,7 @@ if empty(argv())
19 \ map(copy(v:oldfiles), 19 \ map(copy(v:oldfiles),
20 \ {_, p->expand(p)}), 'v:val =~ "'.getcwd().'/"'), 'filereadable(v:val)'), 20 \ {_, p->expand(p)}), 'v:val =~ "'.getcwd().'/"'), 'filereadable(v:val)'),
21 \ {_, p->{'filename': fnamemodify(p, ':.')}}) 21 \ {_, p->{'filename': fnamemodify(p, ':.')}})
22 \ }) | lopen | only | setfiletype qf 22 \ }) | exec ':lopen '.getloclist(0, {'size' : 1}).size | setfiletype qf | wincmd w
23endif 23endif
24 24
25" http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:caddexpr 25" http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:caddexpr
diff --git a/plugin/statusline.vim b/plugin/statusline.vim
index db2bc28..dc98a71 100644
--- a/plugin/statusline.vim
+++ b/plugin/statusline.vim
@@ -1,3 +1,5 @@
1scriptencoding utf-8
2
1augroup MAX_FANCYLINE 3augroup MAX_FANCYLINE
2 set noshowmode | " mode would otherwise be shown twice- in lightline and below. We want to deactivate one. 4 set noshowmode | " mode would otherwise be shown twice- in lightline and below. We want to deactivate one.
3 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
@@ -9,28 +11,28 @@ augroup MAX_FANCYLINE
9 let g:symbol_branch = '' 11 let g:symbol_branch = ''
10 let g:symbol_screen_edge = '░' 12 let g:symbol_screen_edge = '░'
11 13
12 if &term == "linux" 14 if &term ==? 'linux'
13 let g:group_active = "StatusLineTerm" 15 let g:group_active = 'StatusLineTerm'
14 let g:group_inactive = "StatusLineTermNC" 16 let g:group_inactive = 'StatusLineTermNC'
15 let g:group_tabline = "StatusLineTerm" 17 let g:group_tabline = 'StatusLineTerm'
16 else 18 else
17 let g:group_active = "StatusLine" 19 let g:group_active = 'StatusLine'
18 let g:group_inactive = "StatusLineNC" 20 let g:group_inactive = 'StatusLineNC'
19 " let g:group_tabline = "TabLine" 21 " let g:group_tabline = 'TabLine'
20 let g:group_tabline = "StatusLine" 22 let g:group_tabline = 'StatusLine'
21 endif 23 endif
22 24
23 " this function reverts foreground color and background color of a given 25 " this function reverts foreground color and background color of a given
24 " highlight group and returns the name of a newly created _invert group 26 " highlight group and returns the name of a newly created _invert group
25 function! CreateInvertGroup(highlight_group) 27 function! CreateInvertGroup(highlight_group)
26 if(synIDattr(hlID(a:highlight_group), "reverse")==1) 28 if(synIDattr(hlID(a:highlight_group), 'reverse')==1)
27 let w:color=synIDattr(hlID(a:highlight_group), "fg#") 29 let w:color=synIDattr(hlID(a:highlight_group), 'fg#')
28 else 30 else
29 let w:color=synIDattr(hlID(a:highlight_group), "bg#") 31 let w:color=synIDattr(hlID(a:highlight_group), 'bg#')
30 endif 32 endif
31 33
32 let l:retval=a:highlight_group.'_invert' 34 let l:retval=a:highlight_group.'_invert'
33 if(exists('w:color') && w:color == '') 35 if(exists('w:color') && w:color ==# '')
34 let w:color = 'NONE' 36 let w:color = 'NONE'
35 endif 37 endif
36 silent! exec 'highlight '.l:retval.' guifg='.w:color.' ctermfg='.w:color 38 silent! exec 'highlight '.l:retval.' guifg='.w:color.' ctermfg='.w:color
@@ -44,7 +46,7 @@ augroup MAX_FANCYLINE
44 \ 'i' : 'insert', 46 \ 'i' : 'insert',
45 \ 'R' : 'replace', 47 \ 'R' : 'replace',
46 \ 'v' : 'visual', 48 \ 'v' : 'visual',
47 \ "V" : 'visual line', 49 \ 'V' : 'visual line',
48 \ "\<C-V>" : 'visual block', 50 \ "\<C-V>" : 'visual block',
49 \ 'c' : 'command', 51 \ 'c' : 'command',
50 \ 's' : 'select', 52 \ 's' : 'select',
@@ -53,33 +55,35 @@ augroup MAX_FANCYLINE
53 \ 't' : 'terminal' 55 \ 't' : 'terminal'
54 \ }, mode(), mode()) 56 \ }, mode(), mode())
55 return '' 57 return ''
56 \ ."%#StatusLineHighlight#" 58 \ .'%#StatusLineHighlight#'
57 \ ."%#".a:highlight_group."#" 59 \ .'%#'.a:highlight_group.'#'
58 \ .g:symbol_screen_edge.' ' 60 \ .g:symbol_screen_edge
59 \ ."%{(&readonly\ ?\ '\ \ 🔒'\ :\ '')}" 61 \ .'%(%w%h%q%)'.' '.l:mode.' '.g:status_sym_sep_start
60 \ ."%{(&modified\ ?\ '\ \ 💾'\ :\ '')}" 62 \ .'%{argc() > 1 ? " ".(argidx() + 1).":".argc()." ".g:status_sym_sep_start : ""}'
61 \ ."%(%w%h%q%)".l:mode.' '.g:status_sym_sep_start 63 \ .'%{haslocaldir() ? fnamemodify(getcwd(), ":.:~")." " :""}'
62 \ ."%{(argc()>1\ ?\ ' '.(argidx()+1).':'.argc().' '.g:status_sym_sep_start:'')}" 64 \ .'%{&readonly ? " 🔒" : ""}'
63 \ ."%{(haslocaldir() ?\ fnamemodify(getcwd(),\ ':.').'/ '\ \:'')}\ " 65 \ .'%{&modified ? " 💾 " : ""}'
64 \ ."%{winbufnr(0).': '}" 66 \ .'%{winbufnr(0)." "}'
65 \ ."%{bufname('%')==''?'':substitute(bufname('%'),\ '^'.getcwd(-1).'/*',\ '',\ '')}" 67 \ .'%{bufname("%") == "" ? "" : fnamemodify(expand("%"), ":~:.")}'
66 \ ."%{(&titlestring\ ?\ has('nvim')?b:term_title:expand(&titlestring):'')\ }" 68 \ .'%{&titlestring ? has("nvim") ? b:term_title:expand(&titlestring) : "" }'
69 \ .'%{exists("w:quickfix_title") ? w:quickfix_title : ""}'
67 \ .' ' 70 \ .' '
68 \ ."%#".l:invert_group."#" 71 \ .'%#'.l:invert_group.'#'
69 \ .g:status_sym_end 72 \ .g:status_sym_end
70 \ .'%<' 73 \ .'%<'
71 \ .'' 74 \ .''
72 \ ."%=" 75 \ .'%='
73 \ .'' 76 \ .''
74 \ ."%#".l:invert_group."#" 77 \ .'%#'.l:invert_group.'#'
75 \ .g:status_sym_start 78 \ .g:status_sym_start
76 \ ."%#".a:highlight_group."#".' ' 79 \ .'%#'.a:highlight_group.'#'.' '
77 \ ."%{&buftype==''?'':&buftype.' '.g:status_sym_sep_end.' '}" 80 \ .'%{&buftype == "" ? "" : &buftype." ".g:status_sym_sep_end." "}'
78 \ ."%{&filetype==''?'':&filetype.' '.g:status_sym_sep_end.' '}" 81 \ .'%{&filetype == "" ? "" :&filetype." ".g:status_sym_sep_end." "}'
79 \ ."%{(&spell\ ?\ &spelllang.' '.g:status_sym_sep_end\ :\ '')}" 82 \ .'%{&spell ? &spelllang." ".g:status_sym_sep_end : ""}'
80 \ ."%{(&fileencoding=~'^$\\|^utf\-8$'?'':&fileencoding.' '.g:status_sym_sep_end.' ')}" 83 \ .'%{&fileencoding =~ "^$\\|^utf\-8$" ? "" : &fileencoding." ".g:status_sym_sep_end." "}'
81 \ ."%{(&fileformat=~'^$\\|^unix$'?'':&fileformat.' '.g:status_sym_sep_end)}" 84 \ .'%{&fileformat =~ "^$\\|^unix$" ? "" : &fileformat." ".g:status_sym_sep_end}'
82 \ ."%cx%-l: " 85 \ .' '
86 \ .'%cx%-l: '
83 \ .g:status_sym_sep_end 87 \ .g:status_sym_sep_end
84 \ .' ' 88 \ .' '
85 \ .'%p%% ' 89 \ .'%p%% '
@@ -95,9 +99,9 @@ augroup MAX_FANCYLINE
95 \ .' ' 99 \ .' '
96 \ .'%#'.a:highlight_group.'#' 100 \ .'%#'.a:highlight_group.'#'
97 \ .'%-2( %)' 101 \ .'%-2( %)'
98 \ .'%{getcwd(-1)}' 102 \ .'%{fnamemodify(getcwd(-1), ":~")}'
99 \ .' ' 103 \ .' '
100 \ ."%{FugitiveHead()==''?'':g:status_sym_sep_start.' '.g:symbol_branch.' '.FugitiveHead()}" 104 \ .'%{FugitiveHead() == "" ? "" : g:status_sym_sep_start." ".g:symbol_branch." ".FugitiveHead()}'
101 \ .' ' 105 \ .' '
102 \ .'%#'.l:invert_group.'#' 106 \ .'%#'.l:invert_group.'#'
103 \ .g:status_sym_end 107 \ .g:status_sym_end
@@ -116,8 +120,7 @@ augroup MAX_FANCYLINE
116 \ .'%{tabpagenr()}/%{tabpagenr()}' 120 \ .'%{tabpagenr()}/%{tabpagenr()}'
117 \ .' ' 121 \ .' '
118 \ .g:symbol_screen_edge 122 \ .g:symbol_screen_edge
119 \ ."%##" 123 \ .'%##'
120 \ ."" " end
121 endfunction 124 endfunction
122 125
123 function! ApplyColorScheme() 126 function! ApplyColorScheme()
..