Permalink
Browse files

Fix path styles

- Fix short path style when autochdir isset
- Fix full path style

Closes #144.
  • Loading branch information...
1 parent f0caee8 commit fa55b810eb1547c76ae762d72704b9bac3b8c42c @char101 char101 committed with May 21, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 autoload/Powerline/Functions.vim
@@ -7,7 +7,7 @@ function! Powerline#Functions#GetFilepath() " {{{
endif
let dirsep = has('win32') && ! &shellslash ? '\' : '/'
- let filepath = expand('%')
+ let filepath = expand('%:p')
if empty(filepath)
return ''
@@ -23,18 +23,19 @@ function! Powerline#Functions#GetFilepath() " {{{
"
" This displays the shortest possible path, relative to ~ or the
" current directory.
- let fpath = split(fnamemodify(filepath, ':~:.:h'), dirsep)
+ let mod = (exists('+acd') && &acd) ? ':~:h' : ':~:.:h'
+ let fpath = split(fnamemodify(filepath, mod), dirsep)
let fpath_shortparts = map(fpath[1:], 'v:val[0]')
let ret = join(extend([fpath[0]], fpath_shortparts), dirsep) . dirsep
elseif g:Powerline_stl_path_style == 'relative'
" Display a relative path, similar to the %f statusline item
let ret = fnamemodify(filepath, ':.:h') . dirsep
elseif g:Powerline_stl_path_style == 'full'
" Display the full path, similar to the %F statusline item
- let ret = filepath . dirsep
+ let ret = fnamemodify(filepath, ':h') . dirsep
endif
- if ret == ('.'. dirsep)
+ if ret == ('.' . dirsep)
return ''
endif

0 comments on commit fa55b81

Please sign in to comment.