summaryrefslogtreecommitdiff
path: root/vim/.vim/after/plugin/status.vim
blob: efa7eb31bbcec8d1b4f5a465a9a2bc40ed783f3b (plain)
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
" Depends on vim-flagship
set showtabline=2
let g:tabprefix = ""
let g:tablabel = "%N%{flagship#tabmodified()} %{TabCwd(v:lnum) != '' ? pathshorten(TabCwd(v:lnum)) : ''}"
let g:flagship_skip = 'FugitiveStatusline'

function! Mixed_indent()
    let l:spaces=search('\v(^ +)','n')
    let l:tabs=search('\v(^\t+)','n')
    return (l:spaces * l:tabs > 0)
endfunction

function! GlobalCwd()
    return getcwd(-1, -1)
endfunction

function! TabCwd(number)
    if haslocaldir(-1, a:number)
        return getcwd(-1, a:number)
    endif
    return ""
endfunction

function! WinCwd()
    if haslocaldir(0)
        return getcwd()
    endif
    return ""
endfunction

let g:active_window=1
autocmd WinEnter * let g:active_window=winnr()

augroup myflags
    let status_line_bg = synIDattr(hlID("StatusLine"), "fg")
    let status_line_fg = synIDattr(hlID("StatusLine"), "bg")
    exe "highlight MyGlobals ctermfg=255 ctermbg=".status_line_bg
    highlight MyGlobals ctermfg=255 ctermbg=240

    autocmd!
    autocmd FileReadPost,CmdwinEnter,BufEnter,BufRead,BufWritePost * let b:trailing=search('\s\+$','n')
    autocmd FileReadPost,CmdwinEnter,BufEnter,BufRead,BufWritePost * let b:mixed=Mixed_indent()
    autocmd User Flags call Hoist("buffer", "%{FugitiveHead('') != '' ? '['.FugitiveHead('').']' : ''}")
    autocmd User Flags call Hoist("buffer", "%{b:trailing?'[tw]':''}")
    autocmd User Flags call Hoist("buffer", "%{b:mixed?'[mixed]':''}")
    autocmd User Flags call Hoist("buffer", "%{&paste?'[paste]':''}")
    autocmd User Flags call Hoist("window", "%{WinCwd() != '' ? '['.WinCwd().']' : ''}  %{winnr() == g:active_window ? '🐺' : ''}")
    autocmd User Flags call Hoist("global", {"hl": "MyGlobals"}, "[%{pathshorten(GlobalCwd())}, %{g:my_searchprgs[g:my_searchprg]}, %{g:my_findprgs[g:my_findprg]}] 🌿")
augroup END