Fix lint warnings: use the abort attribute for functions in autoload

This commit is contained in:
Caleb Maclennan
2019-12-31 09:34:55 +03:00
parent 10868dd94c
commit 38b1e5e7aa
2 changed files with 74 additions and 74 deletions

View File

@@ -9,7 +9,7 @@ let s:rootNERDTreePath = resolve(expand('<sfile>:p:h:h'))
" If any value is given as an argument, the entire line of text from the " If any value is given as an argument, the entire line of text from the
" change log is shown for the current version; otherwise, only the version " change log is shown for the current version; otherwise, only the version
" number is shown. " number is shown.
function! nerdtree#version(...) function! nerdtree#version(...) abort
let l:text = 'Unknown' let l:text = 'Unknown'
try try
let l:changelog = readfile(join([s:rootNERDTreePath, 'CHANGELOG.md'], nerdtree#slash())) let l:changelog = readfile(join([s:rootNERDTreePath, 'CHANGELOG.md'], nerdtree#slash()))
@@ -31,7 +31,7 @@ endfunction
"============================================================ "============================================================
"FUNCTION: nerdtree#slash() {{{2 "FUNCTION: nerdtree#slash() {{{2
function! nerdtree#slash() function! nerdtree#slash() abort
if nerdtree#runningWindows() if nerdtree#runningWindows()
if exists('+shellslash') && &shellslash if exists('+shellslash') && &shellslash
@@ -46,7 +46,7 @@ endfunction
"FUNCTION: nerdtree#and(x,y) {{{2 "FUNCTION: nerdtree#and(x,y) {{{2
" Implements and() function for Vim <= 7.2 " Implements and() function for Vim <= 7.2
function! nerdtree#and(x,y) function! nerdtree#and(x,y) abort
if exists('*and') if exists('*and')
return and(a:x, a:y) return and(a:x, a:y)
else else
@@ -68,7 +68,7 @@ endfunction
"FUNCTION: nerdtree#checkForBrowse(dir) {{{2 "FUNCTION: nerdtree#checkForBrowse(dir) {{{2
"inits a window tree in the current buffer if appropriate "inits a window tree in the current buffer if appropriate
function! nerdtree#checkForBrowse(dir) function! nerdtree#checkForBrowse(dir) abort
if !isdirectory(a:dir) if !isdirectory(a:dir)
return return
endif endif
@@ -104,17 +104,17 @@ endfunction
" FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2 " FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2
" completion function for the bookmark commands " completion function for the bookmark commands
function! nerdtree#completeBookmarks(A,L,P) function! nerdtree#completeBookmarks(A,L,P) abort
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"') return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
endfunction endfunction
"FUNCTION: nerdtree#compareNodes(dir) {{{2 "FUNCTION: nerdtree#compareNodes(dir) {{{2
function! nerdtree#compareNodes(n1, n2) function! nerdtree#compareNodes(n1, n2) abort
return a:n1.path.compareTo(a:n2.path) return a:n1.path.compareTo(a:n2.path)
endfunction endfunction
"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2 "FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
function! nerdtree#compareNodesBySortKey(n1, n2) function! nerdtree#compareNodesBySortKey(n1, n2) abort
let sortKey1 = a:n1.path.getSortKey() let sortKey1 = a:n1.path.getSortKey()
let sortKey2 = a:n2.path.getSortKey() let sortKey2 = a:n2.path.getSortKey()
let i = 0 let i = 0
@@ -150,7 +150,7 @@ endfunction
" FUNCTION: nerdtree#deprecated(func, [msg]) {{{2 " FUNCTION: nerdtree#deprecated(func, [msg]) {{{2
" Issue a deprecation warning for a:func. If a second arg is given, use this " Issue a deprecation warning for a:func. If a second arg is given, use this
" as the deprecation message " as the deprecation message
function! nerdtree#deprecated(func, ...) function! nerdtree#deprecated(func, ...) abort
let msg = a:0 ? a:func . ' ' . a:1 : a:func . ' is deprecated' let msg = a:0 ? a:func . ' ' . a:1 : a:func . ' is deprecated'
if !exists('s:deprecationWarnings') if !exists('s:deprecationWarnings')
@@ -164,7 +164,7 @@ endfunction
" FUNCTION: nerdtree#exec(cmd, ignoreAll) {{{2 " FUNCTION: nerdtree#exec(cmd, ignoreAll) {{{2
" Same as :exec cmd but, if ignoreAll is TRUE, set eventignore=all for the duration " Same as :exec cmd but, if ignoreAll is TRUE, set eventignore=all for the duration
function! nerdtree#exec(cmd, ignoreAll) function! nerdtree#exec(cmd, ignoreAll) abort
let old_ei = &ei let old_ei = &ei
if a:ignoreAll if a:ignoreAll
set ei=all set ei=all
@@ -174,12 +174,12 @@ function! nerdtree#exec(cmd, ignoreAll)
endfunction endfunction
" FUNCTION: nerdtree#has_opt(options, name) {{{2 " FUNCTION: nerdtree#has_opt(options, name) {{{2
function! nerdtree#has_opt(options, name) function! nerdtree#has_opt(options, name) abort
return has_key(a:options, a:name) && a:options[a:name] ==# 1 return has_key(a:options, a:name) && a:options[a:name] ==# 1
endfunction endfunction
" FUNCTION: nerdtree#loadClassFiles() {{{2 " FUNCTION: nerdtree#loadClassFiles() {{{2
function! nerdtree#loadClassFiles() function! nerdtree#loadClassFiles() abort
runtime lib/nerdtree/path.vim runtime lib/nerdtree/path.vim
runtime lib/nerdtree/menu_controller.vim runtime lib/nerdtree/menu_controller.vim
runtime lib/nerdtree/menu_item.vim runtime lib/nerdtree/menu_item.vim
@@ -197,7 +197,7 @@ function! nerdtree#loadClassFiles()
endfunction endfunction
" FUNCTION: nerdtree#postSourceActions() {{{2 " FUNCTION: nerdtree#postSourceActions() {{{2
function! nerdtree#postSourceActions() function! nerdtree#postSourceActions() abort
call g:NERDTreeBookmark.CacheBookmarks(1) call g:NERDTreeBookmark.CacheBookmarks(1)
call nerdtree#ui_glue#createDefaultBindings() call nerdtree#ui_glue#createDefaultBindings()
@@ -206,12 +206,12 @@ function! nerdtree#postSourceActions()
endfunction endfunction
"FUNCTION: nerdtree#runningWindows(dir) {{{2 "FUNCTION: nerdtree#runningWindows(dir) {{{2
function! nerdtree#runningWindows() function! nerdtree#runningWindows() abort
return has('win16') || has('win32') || has('win64') return has('win16') || has('win32') || has('win64')
endfunction endfunction
"FUNCTION: nerdtree#runningCygwin(dir) {{{2 "FUNCTION: nerdtree#runningCygwin(dir) {{{2
function! nerdtree#runningCygwin() function! nerdtree#runningCygwin() abort
return has('win32unix') return has('win32unix')
endfunction endfunction
@@ -223,7 +223,7 @@ endfunction
" "
"Args: "Args:
"msg: the message to echo "msg: the message to echo
function! nerdtree#echo(msg) function! nerdtree#echo(msg) abort
redraw redraw
echomsg empty(a:msg) ? '' : ('NERDTree: ' . a:msg) echomsg empty(a:msg) ? '' : ('NERDTree: ' . a:msg)
endfunction endfunction
@@ -232,7 +232,7 @@ endfunction
"Wrapper for nerdtree#echo, sets the message type to errormsg for this message "Wrapper for nerdtree#echo, sets the message type to errormsg for this message
"Args: "Args:
"msg: the message to echo "msg: the message to echo
function! nerdtree#echoError(msg) function! nerdtree#echoError(msg) abort
echohl errormsg echohl errormsg
call nerdtree#echo(a:msg) call nerdtree#echo(a:msg)
echohl normal echohl normal
@@ -242,14 +242,14 @@ endfunction
"Wrapper for nerdtree#echo, sets the message type to warningmsg for this message "Wrapper for nerdtree#echo, sets the message type to warningmsg for this message
"Args: "Args:
"msg: the message to echo "msg: the message to echo
function! nerdtree#echoWarning(msg) function! nerdtree#echoWarning(msg) abort
echohl warningmsg echohl warningmsg
call nerdtree#echo(a:msg) call nerdtree#echo(a:msg)
echohl normal echohl normal
endfunction endfunction
"FUNCTION: nerdtree#renderView {{{2 "FUNCTION: nerdtree#renderView {{{2
function! nerdtree#renderView() function! nerdtree#renderView() abort
call b:NERDTree.render() call b:NERDTree.render()
endfunction endfunction

View File

@@ -4,7 +4,7 @@ endif
let g:loaded_nerdtree_ui_glue_autoload = 1 let g:loaded_nerdtree_ui_glue_autoload = 1
" FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1 " FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1
function! nerdtree#ui_glue#createDefaultBindings() function! nerdtree#ui_glue#createDefaultBindings() abort
let s = '<SNR>' . s:SID() . '_' let s = '<SNR>' . s:SID() . '_'
call NERDTreeAddKeyMap({ 'key': '<MiddleMouse>', 'scope': 'all', 'callback': s . 'handleMiddleMouse' }) call NERDTreeAddKeyMap({ 'key': '<MiddleMouse>', 'scope': 'all', 'callback': s . 'handleMiddleMouse' })
@@ -83,19 +83,19 @@ endfunction
"FUNCTION: s:customOpenFile() {{{1 "FUNCTION: s:customOpenFile() {{{1
" Open file node with the 'custom' key, initially <CR>. " Open file node with the 'custom' key, initially <CR>.
function! s:customOpenFile(node) function! s:customOpenFile(node) abort
call a:node.activate(s:initCustomOpenArgs().file) call a:node.activate(s:initCustomOpenArgs().file)
endfunction endfunction
"FUNCTION: s:customOpenDir() {{{1 "FUNCTION: s:customOpenDir() {{{1
" Open directory node with the 'custom' key, initially <CR>. " Open directory node with the 'custom' key, initially <CR>.
function! s:customOpenDir(node) function! s:customOpenDir(node) abort
call s:activateDirNode(a:node, s:initCustomOpenArgs().dir) call s:activateDirNode(a:node, s:initCustomOpenArgs().dir)
endfunction endfunction
"FUNCTION: s:customOpenBookmark() {{{1 "FUNCTION: s:customOpenBookmark() {{{1
" Open bookmark node with the 'custom' key, initially <CR>. " Open bookmark node with the 'custom' key, initially <CR>.
function! s:customOpenBookmark(node) function! s:customOpenBookmark(node) abort
if a:node.path.isDirectory if a:node.path.isDirectory
call a:node.activate(b:NERDTree, s:initCustomOpenArgs().dir) call a:node.activate(b:NERDTree, s:initCustomOpenArgs().dir)
else else
@@ -105,14 +105,14 @@ endfunction
"FUNCTION: s:initCustomOpenArgs() {{{1 "FUNCTION: s:initCustomOpenArgs() {{{1
" Make sure NERDTreeCustomOpenArgs has needed keys " Make sure NERDTreeCustomOpenArgs has needed keys
function! s:initCustomOpenArgs() function! s:initCustomOpenArgs() abort
let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {}) let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {})
return extend(g:NERDTreeCustomOpenArgs, {'file':{'reuse': 'all', 'where': 'p'}, 'dir':{}}, 'keep') return extend(g:NERDTreeCustomOpenArgs, {'file':{'reuse': 'all', 'where': 'p'}, 'dir':{}}, 'keep')
endfunction endfunction
"FUNCTION: s:activateAll() {{{1 "FUNCTION: s:activateAll() {{{1
"handle the user activating the updir line "handle the user activating the updir line
function! s:activateAll() function! s:activateAll() abort
if getline('.') ==# g:NERDTreeUI.UpDirLine() if getline('.') ==# g:NERDTreeUI.UpDirLine()
return nerdtree#ui_glue#upDir(0) return nerdtree#ui_glue#upDir(0)
endif endif
@@ -120,7 +120,7 @@ endfunction
" FUNCTION: s:activateDirNode(directoryNode, options) {{{1 " FUNCTION: s:activateDirNode(directoryNode, options) {{{1
" Open a directory with optional options " Open a directory with optional options
function! s:activateDirNode(directoryNode, ...) function! s:activateDirNode(directoryNode, ...) abort
if a:directoryNode.isRoot() && a:directoryNode.isOpen if a:directoryNode.isRoot() && a:directoryNode.isOpen
call nerdtree#echo('cannot close tree root') call nerdtree#echo('cannot close tree root')
@@ -132,19 +132,19 @@ endfunction
"FUNCTION: s:activateFileNode() {{{1 "FUNCTION: s:activateFileNode() {{{1
"handle the user activating a tree node "handle the user activating a tree node
function! s:activateFileNode(node) function! s:activateFileNode(node) abort
call a:node.activate({'reuse': 'all', 'where': 'p'}) call a:node.activate({'reuse': 'all', 'where': 'p'})
endfunction endfunction
"FUNCTION: s:activateBookmark(bookmark) {{{1 "FUNCTION: s:activateBookmark(bookmark) {{{1
"handle the user activating a bookmark "handle the user activating a bookmark
function! s:activateBookmark(bm) function! s:activateBookmark(bm) abort
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {}) call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {})
endfunction endfunction
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1 " FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
" Associate the current node with the given name " Associate the current node with the given name
function! nerdtree#ui_glue#bookmarkNode(...) function! nerdtree#ui_glue#bookmarkNode(...) abort
let currentNode = g:NERDTreeFileNode.GetSelected() let currentNode = g:NERDTreeFileNode.GetSelected()
if currentNode !=# {} if currentNode !=# {}
let name = a:1 let name = a:1
@@ -163,7 +163,7 @@ function! nerdtree#ui_glue#bookmarkNode(...)
endfunction endfunction
" FUNCTION: s:chCwd(node) {{{1 " FUNCTION: s:chCwd(node) {{{1
function! s:chCwd(node) function! s:chCwd(node) abort
try try
call a:node.path.changeToDir() call a:node.path.changeToDir()
catch /^NERDTree.PathChangeError/ catch /^NERDTree.PathChangeError/
@@ -173,18 +173,18 @@ endfunction
" FUNCTION: s:chRoot(node) {{{1 " FUNCTION: s:chRoot(node) {{{1
" changes the current root to the selected one " changes the current root to the selected one
function! s:chRoot(node) function! s:chRoot(node) abort
call b:NERDTree.changeRoot(a:node) call b:NERDTree.changeRoot(a:node)
endfunction endfunction
" FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1 " FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1
" Change the NERDTree root to match the current working directory. " Change the NERDTree root to match the current working directory.
function! nerdtree#ui_glue#chRootCwd() function! nerdtree#ui_glue#chRootCwd() abort
NERDTreeCWD NERDTreeCWD
endfunction endfunction
" FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1 " FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1
function! nerdtree#ui_glue#clearBookmarks(bookmarks) function! nerdtree#ui_glue#clearBookmarks(bookmarks) abort
if a:bookmarks ==# '' if a:bookmarks ==# ''
let currentNode = g:NERDTreeFileNode.GetSelected() let currentNode = g:NERDTreeFileNode.GetSelected()
if currentNode !=# {} if currentNode !=# {}
@@ -202,7 +202,7 @@ endfunction
" FUNCTION: s:closeChildren(node) {{{1 " FUNCTION: s:closeChildren(node) {{{1
" closes all childnodes of the current node " closes all childnodes of the current node
function! s:closeChildren(node) function! s:closeChildren(node) abort
call a:node.closeChildren() call a:node.closeChildren()
call b:NERDTree.render() call b:NERDTree.render()
call a:node.putCursorHere(0, 0) call a:node.putCursorHere(0, 0)
@@ -210,7 +210,7 @@ endfunction
" FUNCTION: s:closeCurrentDir(node) {{{1 " FUNCTION: s:closeCurrentDir(node) {{{1
" Close the parent directory of the current node. " Close the parent directory of the current node.
function! s:closeCurrentDir(node) function! s:closeCurrentDir(node) abort
if a:node.isRoot() if a:node.isRoot()
call nerdtree#echo('cannot close parent of tree root') call nerdtree#echo('cannot close parent of tree root')
@@ -235,7 +235,7 @@ endfunction
" FUNCTION: s:closeTreeWindow() {{{1 " FUNCTION: s:closeTreeWindow() {{{1
" close the tree window " close the tree window
function! s:closeTreeWindow() function! s:closeTreeWindow() abort
if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() !=# -1 if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() !=# -1
exec 'buffer ' . b:NERDTree.previousBuf() exec 'buffer ' . b:NERDTree.previousBuf()
else else
@@ -249,7 +249,7 @@ endfunction
" FUNCTION: s:deleteBookmark(bookmark) {{{1 " FUNCTION: s:deleteBookmark(bookmark) {{{1
" Prompt the user to confirm the deletion of the selected bookmark. " Prompt the user to confirm the deletion of the selected bookmark.
function! s:deleteBookmark(bookmark) function! s:deleteBookmark(bookmark) abort
let l:message = 'Delete the bookmark "' . a:bookmark.name let l:message = 'Delete the bookmark "' . a:bookmark.name
\ . '" from the bookmark list?' \ . '" from the bookmark list?'
@@ -275,14 +275,14 @@ endfunction
" FUNCTION: s:displayHelp() {{{1 " FUNCTION: s:displayHelp() {{{1
" toggles the help display " toggles the help display
function! s:displayHelp() function! s:displayHelp() abort
call b:NERDTree.ui.toggleHelp() call b:NERDTree.ui.toggleHelp()
call b:NERDTree.render() call b:NERDTree.render()
call b:NERDTree.ui.centerView() call b:NERDTree.ui.centerView()
endfunction endfunction
" FUNCTION: s:findAndRevealPath(pathStr) {{{1 " FUNCTION: s:findAndRevealPath(pathStr) {{{1
function! s:findAndRevealPath(pathStr) function! s:findAndRevealPath(pathStr) abort
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p') let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
if !filereadable(l:pathStr) if !filereadable(l:pathStr)
let l:pathStr = fnamemodify(l:pathStr, ':h') let l:pathStr = fnamemodify(l:pathStr, ':h')
@@ -333,7 +333,7 @@ endfunction
"FUNCTION: s:handleLeftClick() {{{1 "FUNCTION: s:handleLeftClick() {{{1
"Checks if the click should open the current node "Checks if the click should open the current node
function! s:handleLeftClick() function! s:handleLeftClick() abort
let currentNode = g:NERDTreeFileNode.GetSelected() let currentNode = g:NERDTreeFileNode.GetSelected()
if currentNode !=# {} if currentNode !=# {}
@@ -368,7 +368,7 @@ function! s:handleLeftClick()
endfunction endfunction
" FUNCTION: s:handleMiddleMouse() {{{1 " FUNCTION: s:handleMiddleMouse() {{{1
function! s:handleMiddleMouse() function! s:handleMiddleMouse() abort
" A middle mouse click does not automatically position the cursor as one " A middle mouse click does not automatically position the cursor as one
" would expect. Forcing the execution of a regular left mouse click here " would expect. Forcing the execution of a regular left mouse click here
@@ -391,17 +391,17 @@ endfunction
" FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1 " FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1
"this is needed since I cant figure out how to invoke dict functions from a "this is needed since I cant figure out how to invoke dict functions from a
"key map "key map
function! nerdtree#ui_glue#invokeKeyMap(key) function! nerdtree#ui_glue#invokeKeyMap(key) abort
call g:NERDTreeKeyMap.Invoke(a:key) call g:NERDTreeKeyMap.Invoke(a:key)
endfunction endfunction
" FUNCTION: s:jumpToFirstChild(node) {{{1 " FUNCTION: s:jumpToFirstChild(node) {{{1
function! s:jumpToFirstChild(node) function! s:jumpToFirstChild(node) abort
call s:jumpToChild(a:node, 0) call s:jumpToChild(a:node, 0)
endfunction endfunction
" FUNCTION: s:jumpToLastChild(node) {{{1 " FUNCTION: s:jumpToLastChild(node) {{{1
function! s:jumpToLastChild(node) function! s:jumpToLastChild(node) abort
call s:jumpToChild(a:node, 1) call s:jumpToChild(a:node, 1)
endfunction endfunction
@@ -411,7 +411,7 @@ endfunction
" Args: " Args:
" node: the node on which the cursor currently sits " node: the node on which the cursor currently sits
" last: 1 (true) if jumping to last child, 0 (false) if jumping to first " last: 1 (true) if jumping to last child, 0 (false) if jumping to first
function! s:jumpToChild(node, last) function! s:jumpToChild(node, last) abort
let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
if l:node.isRoot() if l:node.isRoot()
@@ -430,7 +430,7 @@ endfunction
" FUNCTION: s:jumpToParent(node) {{{1 " FUNCTION: s:jumpToParent(node) {{{1
" Move the cursor to the parent of the specified node. For a cascade, move to " Move the cursor to the parent of the specified node. For a cascade, move to
" the parent of the cascade's first node. At the root node, do nothing. " the parent of the cascade's first node. At the root node, do nothing.
function! s:jumpToParent(node) function! s:jumpToParent(node) abort
let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
if l:node.isRoot() if l:node.isRoot()
@@ -448,18 +448,18 @@ endfunction
" FUNCTION: s:jumpToRoot() {{{1 " FUNCTION: s:jumpToRoot() {{{1
" moves the cursor to the root node " moves the cursor to the root node
function! s:jumpToRoot() function! s:jumpToRoot() abort
call b:NERDTree.root.putCursorHere(1, 0) call b:NERDTree.root.putCursorHere(1, 0)
call b:NERDTree.ui.centerView() call b:NERDTree.ui.centerView()
endfunction endfunction
" FUNCTION: s:jumpToNextSibling(node) {{{1 " FUNCTION: s:jumpToNextSibling(node) {{{1
function! s:jumpToNextSibling(node) function! s:jumpToNextSibling(node) abort
call s:jumpToSibling(a:node, 1) call s:jumpToSibling(a:node, 1)
endfunction endfunction
" FUNCTION: s:jumpToPrevSibling(node) {{{1 " FUNCTION: s:jumpToPrevSibling(node) {{{1
function! s:jumpToPrevSibling(node) function! s:jumpToPrevSibling(node) abort
call s:jumpToSibling(a:node, 0) call s:jumpToSibling(a:node, 0)
endfunction endfunction
@@ -469,7 +469,7 @@ endfunction
" Args: " Args:
" node: the node on which the cursor currently sits " node: the node on which the cursor currently sits
" forward: 0 to jump to previous sibling, 1 to jump to next sibling " forward: 0 to jump to previous sibling, 1 to jump to next sibling
function! s:jumpToSibling(node, forward) function! s:jumpToSibling(node, forward) abort
let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
let l:sibling = l:node.findSibling(a:forward) let l:sibling = l:node.findSibling(a:forward)
@@ -484,7 +484,7 @@ endfunction
" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1 " FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
" Open the Bookmark that has the specified name. This function provides the " Open the Bookmark that has the specified name. This function provides the
" implementation for the :OpenBookmark command. " implementation for the :OpenBookmark command.
function! nerdtree#ui_glue#openBookmark(name) function! nerdtree#ui_glue#openBookmark(name) abort
try try
let l:bookmark = g:NERDTreeBookmark.BookmarkFor(a:name) let l:bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
catch /^NERDTree.BookmarkNotFoundError/ catch /^NERDTree.BookmarkNotFoundError/
@@ -499,34 +499,34 @@ function! nerdtree#ui_glue#openBookmark(name)
endfunction endfunction
" FUNCTION: s:openHSplit(target) {{{1 " FUNCTION: s:openHSplit(target) {{{1
function! s:openHSplit(target) function! s:openHSplit(target) abort
call a:target.activate({'where': 'h'}) call a:target.activate({'where': 'h'})
endfunction endfunction
" FUNCTION: s:openVSplit(target) {{{1 " FUNCTION: s:openVSplit(target) {{{1
function! s:openVSplit(target) function! s:openVSplit(target) abort
call a:target.activate({'where': 'v'}) call a:target.activate({'where': 'v'})
endfunction endfunction
" FUNCTION: s:openExplorer(node) {{{1 " FUNCTION: s:openExplorer(node) {{{1
function! s:openExplorer(node) function! s:openExplorer(node) abort
call a:node.openExplorer() call a:node.openExplorer()
endfunction endfunction
" FUNCTION: s:openInNewTab(target) {{{1 " FUNCTION: s:openInNewTab(target) {{{1
function! s:openInNewTab(target) function! s:openInNewTab(target) abort
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'}) let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'})
call l:opener.open(a:target) call l:opener.open(a:target)
endfunction endfunction
" FUNCTION: s:openInNewTabSilent(target) {{{1 " FUNCTION: s:openInNewTabSilent(target) {{{1
function! s:openInNewTabSilent(target) function! s:openInNewTabSilent(target) abort
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1}) let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1})
call l:opener.open(a:target) call l:opener.open(a:target)
endfunction endfunction
" FUNCTION: s:openNodeRecursively(node) {{{1 " FUNCTION: s:openNodeRecursively(node) {{{1
function! s:openNodeRecursively(node) function! s:openNodeRecursively(node) abort
call nerdtree#echo('Recursively opening node. Please wait...') call nerdtree#echo('Recursively opening node. Please wait...')
call a:node.openRecursively() call a:node.openRecursively()
call b:NERDTree.render() call b:NERDTree.render()
@@ -534,7 +534,7 @@ function! s:openNodeRecursively(node)
endfunction endfunction
" FUNCTION: s:previewBookmark(bookmark) {{{1 " FUNCTION: s:previewBookmark(bookmark) {{{1
function! s:previewBookmark(bookmark) function! s:previewBookmark(bookmark) abort
if a:bookmark.path.isDirectory if a:bookmark.path.isDirectory
execute 'NERDTreeFind '.a:bookmark.path.str() execute 'NERDTreeFind '.a:bookmark.path.str()
else else
@@ -543,23 +543,23 @@ function! s:previewBookmark(bookmark)
endfunction endfunction
"FUNCTION: s:previewNodeCurrent(node) {{{1 "FUNCTION: s:previewNodeCurrent(node) {{{1
function! s:previewNodeCurrent(node) function! s:previewNodeCurrent(node) abort
call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1}) call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1})
endfunction endfunction
"FUNCTION: s:previewNodeHSplit(node) {{{1 "FUNCTION: s:previewNodeHSplit(node) {{{1
function! s:previewNodeHSplit(node) function! s:previewNodeHSplit(node) abort
call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1}) call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1})
endfunction endfunction
"FUNCTION: s:previewNodeVSplit(node) {{{1 "FUNCTION: s:previewNodeVSplit(node) {{{1
function! s:previewNodeVSplit(node) function! s:previewNodeVSplit(node) abort
call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1}) call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1})
endfunction endfunction
" FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1 " FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1
" put the cursor on the node associate with the given name " put the cursor on the node associate with the given name
function! nerdtree#ui_glue#revealBookmark(name) function! nerdtree#ui_glue#revealBookmark(name) abort
try try
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree) let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
call targetNode.putCursorHere(0, 1) call targetNode.putCursorHere(0, 1)
@@ -571,7 +571,7 @@ endfunction
" FUNCTION: s:refreshRoot() {{{1 " FUNCTION: s:refreshRoot() {{{1
" Reloads the current root. All nodes below this will be lost and the root dir " Reloads the current root. All nodes below this will be lost and the root dir
" will be reloaded. " will be reloaded.
function! s:refreshRoot() function! s:refreshRoot() abort
if !g:NERDTree.IsOpen() if !g:NERDTree.IsOpen()
return return
endif endif
@@ -588,7 +588,7 @@ endfunction
" FUNCTION: s:refreshCurrent(node) {{{1 " FUNCTION: s:refreshCurrent(node) {{{1
" refreshes the root for the current node " refreshes the root for the current node
function! s:refreshCurrent(node) function! s:refreshCurrent(node) abort
let node = a:node let node = a:node
if !node.path.isDirectory if !node.path.isDirectory
let node = node.parent let node = node.parent
@@ -601,7 +601,7 @@ function! s:refreshCurrent(node)
endfunction endfunction
" FUNCTION: nerdtree#ui_glue#setupCommands() {{{1 " FUNCTION: nerdtree#ui_glue#setupCommands() {{{1
function! nerdtree#ui_glue#setupCommands() function! nerdtree#ui_glue#setupCommands() abort
command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('<args>') command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('<args>')
command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('<args>') command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('<args>')
command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close() command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
@@ -614,7 +614,7 @@ function! nerdtree#ui_glue#setupCommands()
endfunction endfunction
" Function: s:SID() {{{1 " Function: s:SID() {{{1
function s:SID() function! s:SID() abort
if !exists('s:sid') if !exists('s:sid')
let s:sid = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$') let s:sid = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
endif endif
@@ -622,34 +622,34 @@ function s:SID()
endfun endfun
" FUNCTION: s:showMenu(node) {{{1 " FUNCTION: s:showMenu(node) {{{1
function! s:showMenu(node) function! s:showMenu(node) abort
let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled()) let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled())
call mc.showMenu() call mc.showMenu()
endfunction endfunction
" FUNCTION: s:toggleIgnoreFilter() {{{1 " FUNCTION: s:toggleIgnoreFilter() {{{1
function! s:toggleIgnoreFilter() function! s:toggleIgnoreFilter() abort
call b:NERDTree.ui.toggleIgnoreFilter() call b:NERDTree.ui.toggleIgnoreFilter()
endfunction endfunction
" FUNCTION: s:toggleShowBookmarks() {{{1 " FUNCTION: s:toggleShowBookmarks() {{{1
function! s:toggleShowBookmarks() function! s:toggleShowBookmarks() abort
call b:NERDTree.ui.toggleShowBookmarks() call b:NERDTree.ui.toggleShowBookmarks()
endfunction endfunction
" FUNCTION: s:toggleShowFiles() {{{1 " FUNCTION: s:toggleShowFiles() {{{1
function! s:toggleShowFiles() function! s:toggleShowFiles() abort
call b:NERDTree.ui.toggleShowFiles() call b:NERDTree.ui.toggleShowFiles()
endfunction endfunction
" FUNCTION: s:toggleShowHidden() {{{1 " FUNCTION: s:toggleShowHidden() {{{1
" toggles the display of hidden files " toggles the display of hidden files
function! s:toggleShowHidden() function! s:toggleShowHidden() abort
call b:NERDTree.ui.toggleShowHidden() call b:NERDTree.ui.toggleShowHidden()
endfunction endfunction
" FUNCTION: s:toggleZoom() {{{1 " FUNCTION: s:toggleZoom() {{{1
function! s:toggleZoom() function! s:toggleZoom() abort
call b:NERDTree.ui.toggleZoom() call b:NERDTree.ui.toggleZoom()
endfunction endfunction
@@ -659,7 +659,7 @@ endfunction
" Args: " Args:
" preserveState: if 1, the current root is left open when the new tree is " preserveState: if 1, the current root is left open when the new tree is
" rendered; if 0, the current root node is closed " rendered; if 0, the current root node is closed
function! nerdtree#ui_glue#upDir(preserveState) function! nerdtree#ui_glue#upDir(preserveState) abort
try try
call b:NERDTree.root.cacheParent() call b:NERDTree.root.cacheParent()
@@ -683,12 +683,12 @@ function! nerdtree#ui_glue#upDir(preserveState)
endfunction endfunction
" FUNCTION: s:upDirCurrentRootOpen() {{{1 " FUNCTION: s:upDirCurrentRootOpen() {{{1
function! s:upDirCurrentRootOpen() function! s:upDirCurrentRootOpen() abort
call nerdtree#ui_glue#upDir(1) call nerdtree#ui_glue#upDir(1)
endfunction endfunction
" FUNCTION: s:upDirCurrentRootClosed() {{{1 " FUNCTION: s:upDirCurrentRootClosed() {{{1
function! s:upDirCurrentRootClosed() function! s:upDirCurrentRootClosed() abort
call nerdtree#ui_glue#upDir(0) call nerdtree#ui_glue#upDir(0)
endfunction endfunction