loosen bookmark name restrictions

now the only rule is that they cant contain spaces
This commit is contained in:
Martin Grenfell
2008-07-02 21:22:26 +12:00
parent f5a20e5379
commit dea37444bc

View File

@@ -206,8 +206,8 @@ function! s:oBookmark.CacheBookmarks() dict
let bookmarkStrings = readfile(g:NERDTreeBookmarksFile) let bookmarkStrings = readfile(g:NERDTreeBookmarksFile)
let invalidBookmarksFound = 0 let invalidBookmarksFound = 0
for i in bookmarkStrings for i in bookmarkStrings
let name = substitute(i, '^\(\w\{-}\) .*$', '\1', '') let name = substitute(i, '^\(.\{-}\) .*$', '\1', '')
let path = substitute(i, '^\w\{-} \(.*\)$', '\1', '') let path = substitute(i, '^.\{-} \(.*\)$', '\1', '')
try try
let bookmark = s:oBookmark.New(name, s:oPath.New(path)) let bookmark = s:oBookmark.New(name, s:oPath.New(path))
@@ -277,7 +277,7 @@ endfunction
" FUNCTION: oBookmark.New(name, path) {{{3 " FUNCTION: oBookmark.New(name, path) {{{3
" Create a new bookmark object with the given name and path object " Create a new bookmark object with the given name and path object
function! s:oBookmark.New(name, path) dict function! s:oBookmark.New(name, path) dict
if a:name !~ '^[0-9a-zA-Z_]*$' if a:name =~ ' '
throw "NERDTree.IllegalBookmarkName illegal name:" . a:name throw "NERDTree.IllegalBookmarkName illegal name:" . a:name
endif endif
@@ -2801,7 +2801,7 @@ function! s:BookmarkNode(name)
call currentNode.Bookmark(a:name) call currentNode.Bookmark(a:name)
call s:RenderView() call s:RenderView()
catch /NERDTree.IllegalBookmarkName/ catch /NERDTree.IllegalBookmarkName/
call s:Echo("bookmark names must be made up of alpha numeric characters and underscores") call s:Echo("bookmark names must not contain spaces")
endtry endtry
else else
call s:Echo("select a node first") call s:Echo("select a node first")