-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_statusline.backup
129 lines (117 loc) · 3.49 KB
/
my_statusline.backup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
" Statusline configuration
" (https://medium.com/@kadek/the-last-statusline-for-vim-a613048959b2)
"------------------------------------------------------------------------------
" [MODE]
" let g:currentmode={
\ 'n' : 'Normal ',
\ 'no' : 'N·Operator Pending ',
\ 'v' : 'Visual ',
\ 'V' : 'V·Line ',
\ '^V' : 'V·Block ',
\ 's' : 'Select ',
\ 'S' : 'S·Line ',
\ '^S' : 'S·Block ',
\ 'i' : 'Insert ',
\ 'R' : 'Replace ',
\ 'Rv' : 'V·Replace ',
\ 'c' : 'Command ',
\ 'cv' : 'Vim Ex ',
\ 'ce' : 'Ex ',
\ 'r' : 'Prompt ',
\ 'rm' : 'More ',
\ 'r?': 'Confirm ',
\ '!' : 'Shell ',
\ 't' : 'Terminal '
\}
"
" Function: return current mode
" abort -> function will abort soon as an error is detected
function! ModeCurrent() abort
let l:modecurrent = mode()
" use get() -> fails safely, since ^V doesn't seem to register
" 3rd arg is used when return of mode() == 0, which is case with ^V
" thus, ^V fails -> returns 0 -> replaced with 'V Block'
let l:modelist = toupper(get(g:currentmode, l:modecurrent, 'V·Block '))
let l:current_status_mode = l:modelist
return l:current_status_mode
endfunction
" Paste: [PASTE]
function! PasteForStatusline()
let paste_status = &paste
if paste_status == 1
return " [paste] "
else
return ""
endif
endfunction
" [GIT]
" from https://shapeshed.com/vim-statuslines/#showing-data
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
function! StatuslineGit()
let l:branchname = GitBranch()
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
endfunction
" [ALE]
"
function! LinterStatus() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? 'OK' : printf(
\ '%dW %dE',
\ all_non_errors,
\ all_errors
\)
endfunction
" [START OF STATUSLINE]"
set statusline=
set statusline+=\ %*
" Mode
set statusline+=%2*-\ %{ModeCurrent()}-
set statusline+=%*
" Buffer number
" set statusline+=\ Buf:\ %n
" Encoding
"set statusline+=\ %{(&fenc!=''?&fenc:&enc)}
" Current time, when buffer saved
" set statusline+=\ %{strftime('%R', getftime(expand('%')))}
set statusline+=\ %y
" Help file
"set statusline+=\ %h
set statusline+=\ %q
set statusline+=\ %w
" Filename
set statusline+=\ %f
set statusline+=\ %m
" Readonly
set statusline+=\ %r
set statusline+=%{PasteForStatusline()}
" Right justified
set statusline+=%=
"set statusline+=%1*\ %f
"set statusline+=\ >>
set statusline+=%1*\ %{tagbar#currenttag('%s','','f')}
" Line, lines, percentage
set statusline+=%*\ %l
set statusline+=\/%L\ \|\ %c\ \|
set statusline+=\ %p%%
set statusline+=%3*%{StatuslineGit()}%*
set statusline+=\ %{LinterStatus()}
" [END OF STATUSLINE]"
" [COLORS]
" Orange
hi User1 guifg=#FF8000 guibg=#504945
" Green
hi User2 guifg=#DEE511 guibg=#504945
augroup AUGInsertMode
autocmd! InsertLeave * hi User2 guifg=#DEE511 guibg=#504945
autocmd! InsertEnter * hi User2 guifg=#FF0000 guibg=#504945
augroup END
" Pink
hi User3 guifg=#EA7E93 guibg=#504945
" Always dark-grey statusline
augroup AUGColorScheme
autocmd! ColorScheme * highlight StatusLine ctermbg=darkgray cterm=NONE guibg=darkgray gui=NONE
augroup END