Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Commit

Permalink
Fix path styles
Browse files Browse the repository at this point in the history
- Fix short path style when autochdir isset
- Fix full path style

Closes #144.
  • Loading branch information
char101 authored and Lokaltog committed Jun 11, 2012
1 parent f0caee8 commit fa55b81
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions autoload/Powerline/Functions.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand All @@ -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

Expand Down

0 comments on commit fa55b81

Please sign in to comment.