mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-10 12:23:49 -05:00
Reformat the commentary in the TreeDirNode script
The commentary in "tree_dir_node.vim" needed to be cleaned up a little. Spaces after leading quotes are a good idea, to avoid the "clustered" appearance that comments can sometimes have. Use the following substitution command... :s/^"\ze\S/" / to make this change to longer scripts.
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
" ============================================================================
|
||||
" CLASS: TreeDirNode
|
||||
"
|
||||
" A subclass of NERDTreeFileNode.
|
||||
"
|
||||
" The 'composite' part of the file/dir composite.
|
||||
"============================================================
|
||||
" ============================================================================
|
||||
|
||||
|
||||
let s:TreeDirNode = copy(g:NERDTreeFileNode)
|
||||
let g:NERDTreeDirNode = s:TreeDirNode
|
||||
|
||||
" FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1
|
||||
"class method that returns the highest cached ancestor of the current root
|
||||
" Class method that returns the highest cached ancestor of the current root.
|
||||
function! s:TreeDirNode.AbsoluteTreeRoot()
|
||||
let currentNode = b:NERDTree.root
|
||||
while currentNode.parent != {}
|
||||
@@ -157,6 +161,7 @@ endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1
|
||||
" returns the child at the given index
|
||||
"
|
||||
" Args:
|
||||
" indx: the index to get the child from
|
||||
" visible: 1 if only the visible children array should be used, 0 if all the
|
||||
@@ -201,7 +206,8 @@ function! s:TreeDirNode.getChildIndex(path)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.getDirChildren() {{{1
|
||||
"Get all children that are directories
|
||||
" Return a list of all child nodes from "self.children" that are of type
|
||||
" TreeDirNode.
|
||||
function! s:TreeDirNode.getDirChildren()
|
||||
return filter(self.children, 'v:val.path.isDirectory == 1')
|
||||
endfunction
|
||||
@@ -372,7 +378,7 @@ function! s:TreeDirNode._initChildren(silent)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.New(path, nerdtree) {{{1
|
||||
"Returns a new TreeNode object with the given path and parent
|
||||
" Return a new TreeDirNode object with the given path and parent.
|
||||
"
|
||||
" Args:
|
||||
" path: dir that the node represents
|
||||
@@ -437,8 +443,8 @@ function! s:TreeDirNode.openAlong(...)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.openExplorer() {{{1
|
||||
" opens an explorer window for this node in the previous window (could be a
|
||||
" nerd tree or a netrw)
|
||||
" Open an explorer window for this node in the previous window. The explorer
|
||||
" can be a NERDTree window or a netrw window.
|
||||
function! s:TreeDirNode.openExplorer()
|
||||
call self.open({'where': 'p'})
|
||||
endfunction
|
||||
@@ -572,13 +578,11 @@ function! s:TreeDirNode.reveal(path, ...)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.removeChild(treenode) {{{1
|
||||
"
|
||||
"Removes the given treenode from this nodes set of children
|
||||
" Remove the given treenode from "self.children".
|
||||
" Throws "NERDTree.ChildNotFoundError" if the node is not found.
|
||||
"
|
||||
" Args:
|
||||
"treenode: the node to remove
|
||||
"
|
||||
"Throws a NERDTree.ChildNotFoundError if the given treenode is not found
|
||||
" treenode: the node object to remove
|
||||
function! s:TreeDirNode.removeChild(treenode)
|
||||
for i in range(0, self.getChildCount()-1)
|
||||
if self.children[i].equals(a:treenode)
|
||||
@@ -591,10 +595,7 @@ function! s:TreeDirNode.removeChild(treenode)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.sortChildren() {{{1
|
||||
"
|
||||
"Sorts the children of this node according to alphabetical order and the
|
||||
"directory priority.
|
||||
"
|
||||
" Sort "self.children" by alphabetical order and directory priority.
|
||||
function! s:TreeDirNode.sortChildren()
|
||||
let CompareFunc = function("nerdtree#compareNodesBySortKey")
|
||||
call sort(self.children, CompareFunc)
|
||||
|
||||
Reference in New Issue
Block a user