Skip to content

Commit

Permalink
Status line trimming
Browse files Browse the repository at this point in the history
- 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
derekwyatt committed Feb 25, 2014
1 parent 1c65963 commit 05a9c94
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions vimrc
Expand Up @@ -65,8 +65,19 @@ set hidden
" the text and replacing it " the text and replacing it
set cpoptions=ces$ 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 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 " tell VIM to always put a status line in, even if there is only one window
set laststatus=2 set laststatus=2
Expand Down Expand Up @@ -411,7 +422,7 @@ endif
nmap ,sf :AgForCurrentFileDir nmap ,sf :AgForCurrentFileDir
nmap ,sr :AgForProjectRoot nmap ,sr :AgForProjectRoot
nmap ,se :AgForExtension nmap ,se :AgForExtension
let g:ag_results_mapping = { let g:ag_results_mapping_replacements = {
\ 'open_and_close': '<cr>', \ 'open_and_close': '<cr>',
\ 'open': 'o', \ 'open': 'o',
\ } \ }
Expand Down

0 comments on commit 05a9c94

Please sign in to comment.