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