use reletive paths for edit commands if possible

This commit is contained in:
Martin Grenfell 2008-11-30 20:05:54 +13:00
parent f4c455bc2f
commit 96215c5da6

View File

@ -1539,12 +1539,21 @@ endfunction
"Return: the string for this path that is suitable to be used with the :edit "Return: the string for this path that is suitable to be used with the :edit
"command "command
function! s:Path.strForEditCmd() function! s:Path.strForEditCmd()
let p = self.str(1)
let cwd = getcwd()
if s:running_windows if s:running_windows
return self.strForOS(0) let p = tolower(self.strForOS(0))
else let cwd = tolower(getcwd())
return self.str(1)
endif endif
"return a relative path if we can
if stridx(p, cwd) == 0
let p = strpart(p, strlen(cwd)+1)
endif
return p
endfunction endfunction
"FUNCTION: Path.strForGlob() {{{3 "FUNCTION: Path.strForGlob() {{{3
function! s:Path.strForGlob() function! s:Path.strForGlob()