mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 03:43:50 -05:00
bugfix: the script failed when being initialized on a dir containing spaces
This commit is contained in:
@@ -999,3 +999,6 @@ the &hidden option is set.
|
|||||||
|
|
||||||
Thanks to Olivier Yiptong for prompting me to make line numbers in the
|
Thanks to Olivier Yiptong for prompting me to make line numbers in the
|
||||||
NERD tree window optional.
|
NERD tree window optional.
|
||||||
|
|
||||||
|
Thanks to Zhang Shuhan for a bug report when initializing the tree in a dir
|
||||||
|
containing spaces.
|
||||||
|
|||||||
@@ -1312,7 +1312,9 @@ function! s:InitNerdTree(dir)
|
|||||||
let dir = a:dir == '' ? expand('%:p:h') : a:dir
|
let dir = a:dir == '' ? expand('%:p:h') : a:dir
|
||||||
let dir = resolve(dir)
|
let dir = resolve(dir)
|
||||||
|
|
||||||
if !isdirectory(dir)
|
let path = s:oPath.New(dir)
|
||||||
|
|
||||||
|
if !path.isDirectory
|
||||||
call s:EchoWarning("Error reading: " . dir)
|
call s:EchoWarning("Error reading: " . dir)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -1320,7 +1322,7 @@ function! s:InitNerdTree(dir)
|
|||||||
"if instructed to, then change the vim CWD to the dir the NERDTree is
|
"if instructed to, then change the vim CWD to the dir the NERDTree is
|
||||||
"inited in
|
"inited in
|
||||||
if g:NERDTreeChDirMode != 0
|
if g:NERDTreeChDirMode != 0
|
||||||
exec "cd " . dir
|
exec "cd " . path.StrForOS(1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let t:treeShowHelp = 0
|
let t:treeShowHelp = 0
|
||||||
@@ -1333,7 +1335,6 @@ function! s:InitNerdTree(dir)
|
|||||||
unlet t:NERDTreeRoot
|
unlet t:NERDTreeRoot
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let path = s:oPath.New(dir)
|
|
||||||
let t:NERDTreeRoot = s:oTreeDirNode.New(path)
|
let t:NERDTreeRoot = s:oTreeDirNode.New(path)
|
||||||
call t:NERDTreeRoot.Open()
|
call t:NERDTreeRoot.Open()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user