Permalink
Browse files

Status line trimming

- Fugitive is awesome, but if I have a long branch name (which is common where I
  work) then it steals all of the real-estate in the status line
- This change turns things like '[Git(feature/XYZ-9999_Description-goes-here)]' into
  something like '{f/XYZ-9999_}'
- Also updated my config for the changes I made to vim-ag
  • Loading branch information...
1 parent 1c65963 commit 05a9c9441bc84aa52df70e9d44ce4b3c817a50e4 @derekwyatt committed Feb 25, 2014
Showing with 13 additions and 2 deletions.
  1. +13 −2 vimrc
View
15 vimrc
@@ -65,8 +65,19 @@ set hidden
" the text and replacing it
set cpoptions=ces$
+function! DerekFugitiveStatusLine()
+ let status = fugitive#statusline()
+ let trimmed = substitute(status, '\[Git(\(.*\))\]', '\1', '')
+ let trimmed = substitute(trimmed, '\(\w\)\w\+\ze/', '\1', '')
+ if len(trimmed) == 0
+ return ""
+ else
+ return '{' . trimmed[0:10] . '}'
+ endif
+endfunction
+
" Set the status line the way i like it
-set stl=%f\ %m\ %r%{fugitive#statusline()}\ Line:%l/%L[%p%%]\ Col:%v\ Buf:#%n\ [%b][0x%B]
+set stl=%f\ %m\ %r%{DerekFugitiveStatusLine()}\ Line:%l/%L[%p%%]\ Col:%v\ Buf:#%n\ [%b][0x%B]
" tell VIM to always put a status line in, even if there is only one window
set laststatus=2
@@ -411,7 +422,7 @@ endif
nmap ,sf :AgForCurrentFileDir
nmap ,sr :AgForProjectRoot
nmap ,se :AgForExtension
-let g:ag_results_mapping = {
+let g:ag_results_mapping_replacements = {
\ 'open_and_close': '<cr>',
\ 'open': 'o',
\ }

0 comments on commit 05a9c94

Please sign in to comment.