saner statusline

This commit is contained in:
2018-01-13 11:53:44 +01:00
parent e73065c38e
commit a48b24909d

View File

@@ -17,10 +17,15 @@ function! GetFilePath()
elseif strlen(filename) < winwidth(filename) - 40 elseif strlen(filename) < winwidth(filename) - 40
return filename return filename
endif endif
let dirpath=split(@%, '\/') if has('win32')
let sep = '\'
else
let sep = '/'
endif
let dirpath=split(@%, sep)
let result = '' let result = ''
if expand('%:p') == filename if filename[0] == sep
let result .= '/' let result .= sep
endif endif
for direntry in dirpath[:-2] for direntry in dirpath[:-2]
let result .= direntry[0] . '/' let result .= direntry[0] . '/'
@@ -33,12 +38,12 @@ set statusline=
set statusline+=%w%q%h "Is it help/preview/loclist? set statusline+=%w%q%h "Is it help/preview/loclist?
set statusline+=%{GetGitStatus()} "Is it git? set statusline+=%{GetGitStatus()} "Is it git?
set statusline+=\ set statusline+=\
set statusline+=%{GetFilePath()} "What's the filename? set statusline+=%< "Trim here
set statusline+=%{GetFilePath()} "What's the filename? (nicely adjusted)
set statusline+=%m%r "Is it modifiable/readonly? set statusline+=%m%r "Is it modifiable/readonly?
set statusline+=[%LL] "How many lines? set statusline+=[%LL] "How many lines?
set statusline+=%= "Go to the right ----> set statusline+=%= "Go to the right ---->
set statusline+=\ set statusline+=\
set statusline+=%< "Trim here
set statusline+=%{&fileencoding?&fileencoding:&encoding} set statusline+=%{&fileencoding?&fileencoding:&encoding}
set statusline+=\|%{&fileformat} "Unix/Win? set statusline+=\|%{&fileformat} "Unix/Win?
set statusline+=%y "What's the type of the file? set statusline+=%y "What's the type of the file?