From 96215c5da6c01d1593eb35ad9ea714cb824ce1c6 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sun, 30 Nov 2008 20:05:54 +1300 Subject: [PATCH] use reletive paths for edit commands if possible --- plugin/NERD_tree.vim | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 1171028..e842e61 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -1539,12 +1539,21 @@ endfunction "Return: the string for this path that is suitable to be used with the :edit "command function! s:Path.strForEditCmd() + let p = self.str(1) + let cwd = getcwd() + if s:running_windows - return self.strForOS(0) - else - return self.str(1) + let p = tolower(self.strForOS(0)) + let cwd = tolower(getcwd()) endif + "return a relative path if we can + if stridx(p, cwd) == 0 + let p = strpart(p, strlen(cwd)+1) + endif + + return p + endfunction "FUNCTION: Path.strForGlob() {{{3 function! s:Path.strForGlob()