fix a bug for files that begin with +/-/~ chars

First, set the tree parts regex appropriately depending on
g:NERDTreeDirArrows.

Second, fix an edge case when trying to edit a file like +foo where the
+ meant 'foo' was being interpreted as an arg to the :edit cmd
This commit is contained in:
Martin Grenfell 2012-01-04 13:52:44 +00:00
parent a55e9eca40
commit 3be5f5ddd8

View File

@ -149,7 +149,12 @@ endif
let s:NERDTreeBufName = 'NERD_tree_' let s:NERDTreeBufName = 'NERD_tree_'
let s:tree_wid = 2 let s:tree_wid = 2
let s:tree_markup_reg = '^[ `|]*[\-+~▾▸ ]\+'
if g:NERDTreeDirArrows
let s:tree_markup_reg = '^ *\([▾▸] \)\?'
else
let s:tree_markup_reg = '^[ `|]*[\-+~]'
endif
let s:tree_up_dir_line = '.. (up a dir)' let s:tree_up_dir_line = '.. (up a dir)'
"the number to add to the nerd tree buffer name to make the buf name unique "the number to add to the nerd tree buffer name to make the buf name unique
@ -2532,6 +2537,12 @@ function! s:Path._strForEdit()
"return a relative path if we can "return a relative path if we can
if stridx(p, cwd) ==# 0 if stridx(p, cwd) ==# 0
let p = strpart(p, strlen(cwd)) 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
endif endif
if p ==# '' if p ==# ''