Repository navigation
Expand file tree
/
Copy pathstatusline.vim
More file actions
67 lines (58 loc) 路 1.97 KB
/
Copy pathstatusline.vim
File metadata and controls
67 lines (58 loc) 路 1.97 KB
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
scriptencoding utf-8
"------------------------------------------------------------------------------
" STATUS LINE CUSTOMIZATION
"------------------------------------------------------------------------------
function! StatusLine(mode) abort
let l:line=''
" help or man pages
if &filetype ==# 'help' || &filetype ==# 'man'
let l:line.=' %#StatusLineNC# ['. &filetype .'] %f '
return l:line
endif
" active
if a:mode ==# 'active'
let l:line.='%6*%{statusline#gitInfo()}'
let l:line.='%<'
let l:line.=statusline#filepath()
let l:line.='%4* %{statusline#fileSize()}%*'
let l:line.='%5*'
let l:line.=' %{statusline#readOnly()} %w%*'
let l:line.='%9* %=%*'
let l:line.='%{statusline#getMode()} %*'
if &paste
let l:line.='%#ErrorMsg#%{" '. functions#GetIcon('paste') .' "}%*'
endif
if &spell
let l:line.='%#WarningMsg#%{" '. functions#GetIcon('spell') .' "}%*'
endif
let l:line.=statusline#LinterStatus()
if exists('*statusline#statusDiagnostic')
let l:line.='%4* %*'
let l:line.=statusline#statusDiagnostic()
endif
let l:line.='%4* '. &filetype " %y will have [] around the test & %Y is uppercase so &filetype gives me what I want
if &fileformat !=# 'unix'
let l:line.='%4* %{&ff}%*'
endif
if &fileencoding !=# 'utf-8'
let l:line.='%4* %{&fenc}%*'
endif
let l:line.='%4* %{statusline#rhs()}%* '
else
" inactive
let l:line.='%#StatusLineNC#'
let l:line.='%f'
endif
let l:line.='%*'
return l:line
endfunction
set statusline=%!StatusLine('active')
augroup MyStatusLine
autocmd!
autocmd WinEnter * setl statusline=%!StatusLine('active')
autocmd WinLeave * setl statusline=%!StatusLine('inactive')
if exists('#TextChangedI')
autocmd TextChanged,TextChangedI * call statusline#getMode()
endif
autocmd BufWinEnter,BufWritePost,FileWritePost,WinEnter,InsertEnter,InsertLeave,CmdWinEnter,CmdWinLeave,ColorScheme * call statusline#getMode()
augroup END