summaryrefslogtreecommitdiff
path: root/vim/.vim/after/plugin/status.vim
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2021-08-10 10:32:16 +0200
committerUrbain Vaes <urbain@vaes.uk>2021-08-10 10:51:55 +0200
commitfce46ed7e852dfc60466c50f348c0c2c7caba7fc (patch)
treea3b2dce0f107676829f0eea49fcc0d8e9601c4dc /vim/.vim/after/plugin/status.vim
parentd140b98cba4b37805e4f2b112e93c87ae6adbe73 (diff)
Minor change
Diffstat (limited to 'vim/.vim/after/plugin/status.vim')
-rw-r--r--vim/.vim/after/plugin/status.vim46
1 files changed, 46 insertions, 0 deletions
diff --git a/vim/.vim/after/plugin/status.vim b/vim/.vim/after/plugin/status.vim
new file mode 100644
index 0000000..54c5bb7
--- /dev/null
+++ b/vim/.vim/after/plugin/status.vim
@@ -0,0 +1,46 @@
+" 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
+
+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 CmdwinEnter,BufEnter,BufRead,BufWritePost * let b:trailing=search('\s\+$','n')
+ autocmd 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().']' : ''}")
+ autocmd User Flags call Hoist("global", {"hl": "MyGlobals"}, "[%{pathshorten(GlobalCwd())}, %{g:my_searchprgs[g:my_searchprg]}, %{g:my_findprgs[g:my_findprg]}]")
+augroup END