Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:1643945
Created Jan 20, 2012

What would you like to do?
Add filename format customization to Powerline
diff --git a/powerline/distinguished.vim b/powerline/distinguished.vim
index a2b52a9..6d14142 100644
--- a/powerline/distinguished.vim
+++ b/powerline/distinguished.vim
@@ -12,6 +12,13 @@ function! Stl_GetBranch(branch_symbol) " {{{
return ret
endfunction " }}}
+function! Stl_GetPreferredFilenameFormat() " {{{
+ if ! exists('g:Powerline_filename_format')
+ return expand('%:t')
+ endif
+
+ return expand(g:Powerline_filename_format)
+endfunction " }}}
function! Stl_GetSyntaxErrors(line_symbol) " {{{
if ! exists('g:syntastic_stl_format')
" Syntastic hasn't been loaded yet
diff --git a/powerline/distinguished/00-default.vim b/powerline/distinguished/00-default.vim
index 359676e..9d57639 100644
--- a/powerline/distinguished/00-default.vim
+++ b/powerline/distinguished/00-default.vim
@@ -22,7 +22,7 @@ call Pl#Statusline(
\ Pl#HiInsert( Pl#FG(196)),
\ Pl#HiNonCurrent(Pl#FG( 88))
\ ),
- \ Pl#Segment(" %t ",
+ \ Pl#Segment(" %{Stl_GetPreferredFilenameFormat()} ",
\ Pl#HiCurrent( Pl#FG(231), Pl#Attr('bold')),
\ Pl#HiInsert( Pl#FG(231), Pl#Attr('bold')),
\ Pl#HiNonCurrent(Pl#FG(245), Pl#Attr('bold'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment