mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 11:53:48 -05:00
@@ -653,25 +653,15 @@ endfunction
|
|||||||
"command
|
"command
|
||||||
function! s:Path._strForEdit()
|
function! s:Path._strForEdit()
|
||||||
let p = escape(self.str(), self._escChars())
|
let p = escape(self.str(), self._escChars())
|
||||||
let cwd = getcwd() . s:Path.Slash()
|
|
||||||
|
|
||||||
"return a relative path if we can
|
"make it relative
|
||||||
let isRelative = 0
|
let p = fnamemodify(p, ':.')
|
||||||
if nerdtree#runningWindows()
|
|
||||||
let isRelative = stridx(tolower(p), tolower(cwd)) == 0
|
|
||||||
else
|
|
||||||
let isRelative = stridx(p, cwd) == 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
if isRelative
|
|
||||||
let p = strpart(p, strlen(cwd))
|
|
||||||
|
|
||||||
"handle the edge case where the file begins with a + (vim interprets
|
"handle the edge case where the file begins with a + (vim interprets
|
||||||
"the +foo in `:e +foo` as an option to :edit)
|
"the +foo in `:e +foo` as an option to :edit)
|
||||||
if p[0] == "+"
|
if p[0] == "+"
|
||||||
let p = '\' . p
|
let p = '\' . p
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
if p ==# ''
|
if p ==# ''
|
||||||
let p = '.'
|
let p = '.'
|
||||||
|
|||||||
Reference in New Issue
Block a user