mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 03:43:50 -05:00
make the throw/catch code uniform and consistent
This commit is contained in:
@@ -198,7 +198,7 @@ function! s:Bookmark.BookmarkExistsFor(name)
|
|||||||
try
|
try
|
||||||
call s:Bookmark.BookmarkFor(a:name)
|
call s:Bookmark.BookmarkFor(a:name)
|
||||||
return 1
|
return 1
|
||||||
catch /NERDTree.BookmarkNotFound/
|
catch /^NERDTree.BookmarkNotFoundError/
|
||||||
return 0
|
return 0
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
@@ -211,7 +211,7 @@ function! s:Bookmark.BookmarkFor(name)
|
|||||||
return i
|
return i
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
throw "NERDTree.BookmarkNotFound exception: no bookmark found for name: \"". a:name .'"'
|
throw "NERDTree.BookmarkNotFoundError: no bookmark found for name: \"". a:name .'"'
|
||||||
endfunction
|
endfunction
|
||||||
" Function: Bookmark.BookmarkNames() {{{3
|
" Function: Bookmark.BookmarkNames() {{{3
|
||||||
" Class method to return an array of all bookmark names
|
" Class method to return an array of all bookmark names
|
||||||
@@ -245,7 +245,7 @@ function! s:Bookmark.CacheBookmarks(silent)
|
|||||||
try
|
try
|
||||||
let bookmark = s:Bookmark.New(name, s:Path.New(path))
|
let bookmark = s:Bookmark.New(name, s:Path.New(path))
|
||||||
call add(g:NERDTreeBookmarks, bookmark)
|
call add(g:NERDTreeBookmarks, bookmark)
|
||||||
catch /NERDTree.Path.InvalidArguments/
|
catch /^NERDTree.InvalidArgumentsError/
|
||||||
call add(g:NERDTreeInvalidBookmarks, i)
|
call add(g:NERDTreeInvalidBookmarks, i)
|
||||||
let invalidBookmarksFound += 1
|
let invalidBookmarksFound += 1
|
||||||
endtry
|
endtry
|
||||||
@@ -280,7 +280,7 @@ function! s:Bookmark.delete()
|
|||||||
let node = {}
|
let node = {}
|
||||||
try
|
try
|
||||||
let node = self.getNode(1)
|
let node = self.getNode(1)
|
||||||
catch /NERDTree.BookmarkedNodeNotFound/
|
catch /^NERDTree.BookmarkedNodeNotFoundError/
|
||||||
endtry
|
endtry
|
||||||
call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self))
|
call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self))
|
||||||
if !empty(node)
|
if !empty(node)
|
||||||
@@ -298,7 +298,7 @@ function! s:Bookmark.getNode(searchFromAbsoluteRoot)
|
|||||||
let searchRoot = a:searchFromAbsoluteRoot ? s:TreeDirNode.AbsoluteTreeRoot() : b:NERDTreeRoot
|
let searchRoot = a:searchFromAbsoluteRoot ? s:TreeDirNode.AbsoluteTreeRoot() : b:NERDTreeRoot
|
||||||
let targetNode = searchRoot.findNode(self.path)
|
let targetNode = searchRoot.findNode(self.path)
|
||||||
if empty(targetNode)
|
if empty(targetNode)
|
||||||
throw "NERDTree.BookmarkedNodeNotFound no node was found for bookmark: " . self.name
|
throw "NERDTree.BookmarkedNodeNotFoundError: no node was found for bookmark: " . self.name
|
||||||
endif
|
endif
|
||||||
return targetNode
|
return targetNode
|
||||||
endfunction
|
endfunction
|
||||||
@@ -322,7 +322,7 @@ endfunction
|
|||||||
function! s:Bookmark.mustExist()
|
function! s:Bookmark.mustExist()
|
||||||
if !self.path.exists()
|
if !self.path.exists()
|
||||||
call s:Bookmark.CacheBookmarks(1)
|
call s:Bookmark.CacheBookmarks(1)
|
||||||
throw "NERDTree.BookmarkPointsToInvalidLocation exception: the bookmark \"".
|
throw "NERDTree.BookmarkPointsToInvalidLocationError: the bookmark \"".
|
||||||
\ self.name ."\" points to a non existing location: \"". self.path.strForOS(0)
|
\ self.name ."\" points to a non existing location: \"". self.path.strForOS(0)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -330,7 +330,7 @@ endfunction
|
|||||||
" 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:Bookmark.New(name, path)
|
function! s:Bookmark.New(name, path)
|
||||||
if a:name =~ ' '
|
if a:name =~ ' '
|
||||||
throw "NERDTree.IllegalBookmarkName illegal name:" . a:name
|
throw "NERDTree.IllegalBookmarkNameError: illegal name:" . a:name
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let newBookmark = copy(self)
|
let newBookmark = copy(self)
|
||||||
@@ -369,7 +369,7 @@ function! s:Bookmark.toRoot()
|
|||||||
if self.validate()
|
if self.validate()
|
||||||
try
|
try
|
||||||
let targetNode = self.getNode(1)
|
let targetNode = self.getNode(1)
|
||||||
catch /NERDTree.BookmarkedNodeNotFound/
|
catch /^NERDTree.BookmarkedNodeNotFoundError/
|
||||||
let targetNode = s:TreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path)
|
let targetNode = s:TreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path)
|
||||||
endtry
|
endtry
|
||||||
call targetNode.makeRoot()
|
call targetNode.makeRoot()
|
||||||
@@ -425,7 +425,7 @@ function! s:TreeFileNode.bookmark(name)
|
|||||||
try
|
try
|
||||||
let oldMarkedNode = s:Bookmark.GetNodeForName(a:name, 1)
|
let oldMarkedNode = s:Bookmark.GetNodeForName(a:name, 1)
|
||||||
call oldMarkedNode.path.cacheDisplayString()
|
call oldMarkedNode.path.cacheDisplayString()
|
||||||
catch /NERDTree.Bookmark\(DoesntExist\|NotFound\)/
|
catch /^NERDTree.BookmarkNotFoundError/
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
call s:Bookmark.AddBookmark(a:name, self.path)
|
call s:Bookmark.AddBookmark(a:name, self.path)
|
||||||
@@ -438,7 +438,7 @@ function! s:TreeFileNode.cacheParent()
|
|||||||
if empty(self.parent)
|
if empty(self.parent)
|
||||||
let parentPath = self.path.getParent()
|
let parentPath = self.path.getParent()
|
||||||
if parentPath.equals(self.path)
|
if parentPath.equals(self.path)
|
||||||
throw "NERDTree.CannotCacheParent exception: already at root"
|
throw "NERDTree.CannotCacheParentError: already at root"
|
||||||
endif
|
endif
|
||||||
let self.parent = s:TreeFileNode.New(parentPath)
|
let self.parent = s:TreeFileNode.New(parentPath)
|
||||||
endif
|
endif
|
||||||
@@ -778,7 +778,7 @@ endfunction
|
|||||||
function! s:TreeDirNode.getChildByIndex(indx, visible)
|
function! s:TreeDirNode.getChildByIndex(indx, visible)
|
||||||
let array_to_search = a:visible? self.getVisibleChildren() : self.children
|
let array_to_search = a:visible? self.getVisibleChildren() : self.children
|
||||||
if a:indx > len(array_to_search)
|
if a:indx > len(array_to_search)
|
||||||
throw "NERDTree.TreeDirNode.InvalidArguments exception. Index is out of bounds."
|
throw "NERDTree.InvalidArgumentsError: Index is out of bounds."
|
||||||
endif
|
endif
|
||||||
return array_to_search[a:indx]
|
return array_to_search[a:indx]
|
||||||
endfunction
|
endfunction
|
||||||
@@ -874,7 +874,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
try
|
try
|
||||||
let path = s:Path.New(i)
|
let path = s:Path.New(i)
|
||||||
call self.createChild(path, 0)
|
call self.createChild(path, 0)
|
||||||
catch /^NERDTree.Path.\(InvalidArguments\|InvalidFiletype\)/
|
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||||
let invalidFilesFound += 1
|
let invalidFilesFound += 1
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
@@ -899,7 +899,7 @@ endfunction
|
|||||||
unlet s:TreeDirNode.New
|
unlet s:TreeDirNode.New
|
||||||
function! s:TreeDirNode.New(path)
|
function! s:TreeDirNode.New(path)
|
||||||
if a:path.isDirectory != 1
|
if a:path.isDirectory != 1
|
||||||
throw "NERDTree.TreeDirNode.InvalidArguments exception. A TreeDirNode object must be instantiated with a directory Path object."
|
throw "NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object."
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let newTreeNode = copy(self)
|
let newTreeNode = copy(self)
|
||||||
@@ -989,7 +989,7 @@ function! s:TreeDirNode.refresh()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
catch /^NERDTree.InvalidArguments/
|
catch /^NERDTree.InvalidArgumentsError/
|
||||||
let invalidFilesFound = 1
|
let invalidFilesFound = 1
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
@@ -1012,7 +1012,7 @@ endfunction
|
|||||||
"Args:
|
"Args:
|
||||||
"treenode: the node to remove
|
"treenode: the node to remove
|
||||||
"
|
"
|
||||||
"Throws a NERDTree.TreeDirNode exception if the given treenode is not found
|
"Throws a NERDTree.ChildNotFoundError if the given treenode is not found
|
||||||
function! s:TreeDirNode.removeChild(treenode)
|
function! s:TreeDirNode.removeChild(treenode)
|
||||||
for i in range(0, self.getChildCount()-1)
|
for i in range(0, self.getChildCount()-1)
|
||||||
if self.children[i].equals(a:treenode)
|
if self.children[i].equals(a:treenode)
|
||||||
@@ -1021,7 +1021,7 @@ function! s:TreeDirNode.removeChild(treenode)
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
throw "NERDTree.TreeDirNode exception: child node was not found"
|
throw "NERDTree.ChildNotFoundError: child node was not found"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: TreeDirNode.sortChildren() {{{3
|
"FUNCTION: TreeDirNode.sortChildren() {{{3
|
||||||
@@ -1108,7 +1108,7 @@ function! s:Path.changeToDir()
|
|||||||
execute "cd " . dir
|
execute "cd " . dir
|
||||||
call s:echo("CWD is now: " . getcwd())
|
call s:echo("CWD is now: " . getcwd())
|
||||||
catch
|
catch
|
||||||
throw "NERDTree.Path.Change exception: cannot change to " . dir
|
throw "NERDTree.PathChangeError: cannot change CWD to " . dir
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -1165,7 +1165,7 @@ endfunction
|
|||||||
function! s:Path.Create(fullpath)
|
function! s:Path.Create(fullpath)
|
||||||
"bail if the a:fullpath already exists
|
"bail if the a:fullpath already exists
|
||||||
if isdirectory(a:fullpath) || filereadable(a:fullpath)
|
if isdirectory(a:fullpath) || filereadable(a:fullpath)
|
||||||
throw "NERDTree.Path.Exists Exception: Directory Exists: '" . a:fullpath . "'"
|
throw "NERDTree.CreatePathError: Directory Exists: '" . a:fullpath . "'"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -1181,8 +1181,8 @@ function! s:Path.Create(fullpath)
|
|||||||
else
|
else
|
||||||
call writefile([], a:fullpath)
|
call writefile([], a:fullpath)
|
||||||
endif
|
endif
|
||||||
catch /.*/
|
catch
|
||||||
throw "NERDTree.Path Exception: Could not create path: '" . a:fullpath . "'"
|
throw "NERDTree.CreatePathError: Could not create path: '" . a:fullpath . "'"
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
return s:Path.New(a:fullpath)
|
return s:Path.New(a:fullpath)
|
||||||
@@ -1196,7 +1196,7 @@ endfunction
|
|||||||
"dest: the location to copy this dir/file to
|
"dest: the location to copy this dir/file to
|
||||||
function! s:Path.copy(dest)
|
function! s:Path.copy(dest)
|
||||||
if !s:Path.CopyingSupported()
|
if !s:Path.CopyingSupported()
|
||||||
throw "NERDTree.Path.CopyingNotSupported Exception: Copying is not supported on this OS"
|
throw "NERDTree.CopyingNotSupportedError: Copying is not supported on this OS"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let dest = s:Path.WinToUnixPath(a:dest)
|
let dest = s:Path.WinToUnixPath(a:dest)
|
||||||
@@ -1204,7 +1204,7 @@ function! s:Path.copy(dest)
|
|||||||
let cmd = g:NERDTreeCopyCmd . " " . self.strForOS(0) . " " . dest
|
let cmd = g:NERDTreeCopyCmd . " " . self.strForOS(0) . " " . dest
|
||||||
let success = system(cmd)
|
let success = system(cmd)
|
||||||
if success != 0
|
if success != 0
|
||||||
throw "NERDTree.Path Exception: Could not copy ''". self.strForOS(0) ."'' to: '" . a:dest . "'"
|
throw "NERDTree.CopyError: Could not copy ''". self.strForOS(0) ."'' to: '" . a:dest . "'"
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -1255,12 +1255,12 @@ function! s:Path.delete()
|
|||||||
let success = system(cmd)
|
let success = system(cmd)
|
||||||
|
|
||||||
if v:shell_error != 0
|
if v:shell_error != 0
|
||||||
throw "NERDTree.Path.Deletion Exception: Could not delete directory: '" . self.strForOS(0) . "'"
|
throw "NERDTree.PathDeletionError: Could not delete directory: '" . self.strForOS(0) . "'"
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let success = delete(self.strForOS(0))
|
let success = delete(self.strForOS(0))
|
||||||
if success != 0
|
if success != 0
|
||||||
throw "NERDTree.Path.Deletion Exception: Could not delete file: '" . self.str(0) . "'"
|
throw "NERDTree.PathDeletionError: Could not delete file: '" . self.str(0) . "'"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -1417,7 +1417,7 @@ function! s:Path.readInfoFromDisk(fullpath)
|
|||||||
let fullpath = s:Path.WinToUnixPath(a:fullpath)
|
let fullpath = s:Path.WinToUnixPath(a:fullpath)
|
||||||
|
|
||||||
if getftype(fullpath) == "fifo"
|
if getftype(fullpath) == "fifo"
|
||||||
throw "NERDTree.Path.InvalidFiletype Exception: Cant handle FIFO files: " . a:fullpath
|
throw "NERDTree.InvalidFiletypeError: Cant handle FIFO files: " . a:fullpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let self.pathSegments = split(fullpath, '/')
|
let self.pathSegments = split(fullpath, '/')
|
||||||
@@ -1430,7 +1430,7 @@ function! s:Path.readInfoFromDisk(fullpath)
|
|||||||
let self.isDirectory = 0
|
let self.isDirectory = 0
|
||||||
let self.isReadOnly = filewritable(a:fullpath) == 0
|
let self.isReadOnly = filewritable(a:fullpath) == 0
|
||||||
else
|
else
|
||||||
throw "NERDTree.Path.InvalidArguments Exception: Invalid path = " . a:fullpath
|
throw "NERDTree.InvalidArgumentsError: Invalid path = " . a:fullpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let self.isExecutable = 0
|
let self.isExecutable = 0
|
||||||
@@ -1473,12 +1473,12 @@ endfunction
|
|||||||
"Renames this node on the filesystem
|
"Renames this node on the filesystem
|
||||||
function! s:Path.rename(newPath)
|
function! s:Path.rename(newPath)
|
||||||
if a:newPath == ''
|
if a:newPath == ''
|
||||||
throw "NERDTree.Path.InvalidArguments exception. Invalid newPath for renaming = ". a:newPath
|
throw "NERDTree.InvalidArgumentsError: Invalid newPath for renaming = ". a:newPath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let success = rename(self.strForOS(0), a:newPath)
|
let success = rename(self.strForOS(0), a:newPath)
|
||||||
if success != 0
|
if success != 0
|
||||||
throw "NERDTree.Path.Rename Exception: Could not rename: '" . self.strForOS(0) . "'" . 'to:' . a:newPath
|
throw "NERDTree.PathRenameError: Could not rename: '" . self.strForOS(0) . "'" . 'to:' . a:newPath
|
||||||
endif
|
endif
|
||||||
call self.readInfoFromDisk(a:newPath)
|
call self.readInfoFromDisk(a:newPath)
|
||||||
|
|
||||||
@@ -1705,7 +1705,7 @@ function! s:initNerdTree(name)
|
|||||||
|
|
||||||
try
|
try
|
||||||
let path = s:Path.New(dir)
|
let path = s:Path.New(dir)
|
||||||
catch /NERDTree.Path.InvalidArguments/
|
catch /^NERDTree.InvalidArgumentsError/
|
||||||
call s:echo("No bookmark or directory found for: " . a:name)
|
call s:echo("No bookmark or directory found for: " . a:name)
|
||||||
return
|
return
|
||||||
endtry
|
endtry
|
||||||
@@ -1748,7 +1748,7 @@ endfunction
|
|||||||
function! s:initNerdTreeInPlace(dir)
|
function! s:initNerdTreeInPlace(dir)
|
||||||
try
|
try
|
||||||
let path = s:Path.New(a:dir)
|
let path = s:Path.New(a:dir)
|
||||||
catch /NERDTree.Path.InvalidArguments/
|
catch /^NERDTree.InvalidArgumentsError/
|
||||||
call s:echo("Invalid directory name:" . a:name)
|
call s:echo("Invalid directory name:" . a:name)
|
||||||
return
|
return
|
||||||
endtry
|
endtry
|
||||||
@@ -1814,7 +1814,7 @@ endfunction
|
|||||||
"If the cursor is not on a node then an empty dictionary {} is returned.
|
"If the cursor is not on a node then an empty dictionary {} is returned.
|
||||||
function! NERDTreeGetCurrentNode()
|
function! NERDTreeGetCurrentNode()
|
||||||
if !s:treeExistsForTab() || !s:isTreeOpen()
|
if !s:treeExistsForTab() || !s:isTreeOpen()
|
||||||
throw "NERDTree.NoTreeForTab exception: there is no NERD tree open for the current tab"
|
throw "NERDTree.NoTreeForTabError: there is no NERD tree open for the current tab"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let winnr = winnr()
|
let winnr = winnr()
|
||||||
@@ -1862,7 +1862,7 @@ endfunction
|
|||||||
"Closes the NERD tree window
|
"Closes the NERD tree window
|
||||||
function! s:closeTree()
|
function! s:closeTree()
|
||||||
if !s:isTreeOpen()
|
if !s:isTreeOpen()
|
||||||
throw "NERDTree.view.closeTree exception: no NERDTree is open"
|
throw "NERDTree.NoTreeFoundError: no NERDTree is open"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if winnr("$") != 1
|
if winnr("$") != 1
|
||||||
@@ -2272,7 +2272,7 @@ function! s:getSelectedBookmark()
|
|||||||
if name != line
|
if name != line
|
||||||
try
|
try
|
||||||
return s:Bookmark.BookmarkFor(name)
|
return s:Bookmark.BookmarkFor(name)
|
||||||
catch /NERDTree.BookmarkNotFound/
|
catch /^NERDTree.BookmarkNotFoundError/
|
||||||
return {}
|
return {}
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
@@ -2300,7 +2300,7 @@ function! s:getSelectedNode()
|
|||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
return b:NERDTreeRoot.findNode(path)
|
return b:NERDTreeRoot.findNode(path)
|
||||||
catch /^NERDTree/
|
catch /NERDTree/
|
||||||
return {}
|
return {}
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
@@ -2457,7 +2457,7 @@ function! s:openFileNodeSplit(treenode)
|
|||||||
if a:treenode.path.isDirectory == 0
|
if a:treenode.path.isDirectory == 0
|
||||||
try
|
try
|
||||||
call s:openNodeSplit(a:treenode)
|
call s:openNodeSplit(a:treenode)
|
||||||
catch /^NERDTree.view.FileOpen/
|
catch /^NERDTree.FileAlreadyOpenAndModifiedError/
|
||||||
call s:echo("Cannot open file, it is already open and modified" )
|
call s:echo("Cannot open file, it is already open and modified" )
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
@@ -2515,7 +2515,7 @@ function! s:openNodeSplit(treenode)
|
|||||||
exec(splitMode." sp " . a:treenode.path.strForEditCmd())
|
exec(splitMode." sp " . a:treenode.path.strForEditCmd())
|
||||||
catch /^Vim\%((\a\+)\)\=:E37/
|
catch /^Vim\%((\a\+)\)\=:E37/
|
||||||
call s:putCursorInTreeWin()
|
call s:putCursorInTreeWin()
|
||||||
throw "NERDTree.view.FileOpen exception: ". a:treenode.path.str(0) ." is already open and modified."
|
throw "NERDTree.FileAlreadyOpenAndModifiedError: ". a:treenode.path.str(0) ." is already open and modified."
|
||||||
catch /^Vim\%((\a\+)\)\=:/
|
catch /^Vim\%((\a\+)\)\=:/
|
||||||
"do nothing
|
"do nothing
|
||||||
endtry
|
endtry
|
||||||
@@ -2552,7 +2552,7 @@ endfunction
|
|||||||
"Places the cursor at the top of the bookmarks table
|
"Places the cursor at the top of the bookmarks table
|
||||||
function! s:putCursorOnBookmarkTable()
|
function! s:putCursorOnBookmarkTable()
|
||||||
if !b:NERDTreeShowBookmarks
|
if !b:NERDTreeShowBookmarks
|
||||||
throw "NERDTree.IllegalOperation exception: cant find bookmark table, bookmarks arent active"
|
throw "NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let rootNodeLine = s:findRootNodeLineNumber()
|
let rootNodeLine = s:findRootNodeLineNumber()
|
||||||
@@ -2561,7 +2561,7 @@ function! s:putCursorOnBookmarkTable()
|
|||||||
while getline(line) !~ '^>-\+Bookmarks-\+$'
|
while getline(line) !~ '^>-\+Bookmarks-\+$'
|
||||||
let line = line + 1
|
let line = line + 1
|
||||||
if line >= rootNodeLine
|
if line >= rootNodeLine
|
||||||
throw "NERDTree.BookmarkTableNotFound exception: didnt find the bookmarks table"
|
throw "NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table"
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
call cursor(line, 0)
|
call cursor(line, 0)
|
||||||
@@ -2599,7 +2599,7 @@ endfunction
|
|||||||
"Places the cursor in the nerd tree window
|
"Places the cursor in the nerd tree window
|
||||||
function! s:putCursorInTreeWin()
|
function! s:putCursorInTreeWin()
|
||||||
if !s:isTreeOpen()
|
if !s:isTreeOpen()
|
||||||
throw "NERDTree.view.InvalidOperation Exception: No NERD tree window exists"
|
throw "NERDTree.InvalidOperationError: cant put cursor in NERD tree window, no window exists"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
exec s:getTreeWinNum() . "wincmd w"
|
exec s:getTreeWinNum() . "wincmd w"
|
||||||
@@ -2720,7 +2720,7 @@ function! s:saveScreenState()
|
|||||||
let b:NERDTreeOldTopLine = line("w0")
|
let b:NERDTreeOldTopLine = line("w0")
|
||||||
let b:NERDTreeOldWindowSize = winwidth("")
|
let b:NERDTreeOldWindowSize = winwidth("")
|
||||||
exec win . "wincmd w"
|
exec win . "wincmd w"
|
||||||
catch /NERDTree.view.InvalidOperation/
|
catch /^NERDTree.InvalidOperationError/
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -2982,7 +2982,7 @@ function! s:bookmarkNode(name)
|
|||||||
try
|
try
|
||||||
call currentNode.bookmark(a:name)
|
call currentNode.bookmark(a:name)
|
||||||
call s:renderView()
|
call s:renderView()
|
||||||
catch /NERDTree.IllegalBookmarkName/
|
catch /^NERDTree.IllegalBookmarkNameError/
|
||||||
call s:echo("bookmark names must not contain spaces")
|
call s:echo("bookmark names must not contain spaces")
|
||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
@@ -3027,7 +3027,7 @@ function! s:chCwd()
|
|||||||
|
|
||||||
try
|
try
|
||||||
call treenode.path.changeToDir()
|
call treenode.path.changeToDir()
|
||||||
catch /^NERDTree.Path.Change/
|
catch /^NERDTree.PathChangeError/
|
||||||
call s:echoWarning("could not change cwd")
|
call s:echoWarning("could not change cwd")
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
@@ -3348,7 +3348,7 @@ function! s:openBookmark(name)
|
|||||||
let targetNode = s:Bookmark.GetNodeForName(a:name, 0)
|
let targetNode = s:Bookmark.GetNodeForName(a:name, 0)
|
||||||
call s:putCursorOnNode(targetNode, 0, 1)
|
call s:putCursorOnNode(targetNode, 0, 1)
|
||||||
redraw!
|
redraw!
|
||||||
catch /NERDTree.BookmarkedNodeNotFound/
|
catch /^NERDTree.BookmarkedNodeNotFoundError/
|
||||||
call s:echo("note - target node is not cached")
|
call s:echo("note - target node is not cached")
|
||||||
let bookmark = s:Bookmark.BookmarkFor(a:name)
|
let bookmark = s:Bookmark.BookmarkFor(a:name)
|
||||||
let targetNode = s:TreeFileNode.New(bookmark.path)
|
let targetNode = s:TreeFileNode.New(bookmark.path)
|
||||||
@@ -3451,7 +3451,7 @@ function! s:revealBookmark(name)
|
|||||||
try
|
try
|
||||||
let targetNode = s:Bookmark.GetNodeForName(a:name, 0)
|
let targetNode = s:Bookmark.GetNodeForName(a:name, 0)
|
||||||
call s:putCursorOnNode(targetNode, 0, 1)
|
call s:putCursorOnNode(targetNode, 0, 1)
|
||||||
catch /NERDTree.BookmarkDoesntExist/
|
catch /^NERDTree.BookmarkNotFoundError/
|
||||||
call s:echo("Bookmark isnt cached under the current root")
|
call s:echo("Bookmark isnt cached under the current root")
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user