mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -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
|
" CLASS: TreeDirNode
|
||||||
|
"
|
||||||
" A subclass of NERDTreeFileNode.
|
" A subclass of NERDTreeFileNode.
|
||||||
"
|
"
|
||||||
" The 'composite' part of the file/dir composite.
|
" The 'composite' part of the file/dir composite.
|
||||||
"============================================================
|
" ============================================================================
|
||||||
|
|
||||||
|
|
||||||
let s:TreeDirNode = copy(g:NERDTreeFileNode)
|
let s:TreeDirNode = copy(g:NERDTreeFileNode)
|
||||||
let g:NERDTreeDirNode = s:TreeDirNode
|
let g:NERDTreeDirNode = s:TreeDirNode
|
||||||
|
|
||||||
" FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1
|
" 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()
|
function! s:TreeDirNode.AbsoluteTreeRoot()
|
||||||
let currentNode = b:NERDTree.root
|
let currentNode = b:NERDTree.root
|
||||||
while currentNode.parent != {}
|
while currentNode.parent != {}
|
||||||
@@ -157,6 +161,7 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1
|
" FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1
|
||||||
" returns the child at the given index
|
" returns the child at the given index
|
||||||
|
"
|
||||||
" Args:
|
" Args:
|
||||||
" indx: the index to get the child from
|
" indx: the index to get the child from
|
||||||
" visible: 1 if only the visible children array should be used, 0 if all the
|
" 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
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: TreeDirNode.getDirChildren() {{{1
|
" 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()
|
function! s:TreeDirNode.getDirChildren()
|
||||||
return filter(self.children, 'v:val.path.isDirectory == 1')
|
return filter(self.children, 'v:val.path.isDirectory == 1')
|
||||||
endfunction
|
endfunction
|
||||||
@@ -372,7 +378,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: TreeDirNode.New(path, nerdtree) {{{1
|
" 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:
|
" Args:
|
||||||
" path: dir that the node represents
|
" path: dir that the node represents
|
||||||
@@ -437,8 +443,8 @@ function! s:TreeDirNode.openAlong(...)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: TreeDirNode.openExplorer() {{{1
|
" FUNCTION: TreeDirNode.openExplorer() {{{1
|
||||||
" opens an explorer window for this node in the previous window (could be a
|
" Open an explorer window for this node in the previous window. The explorer
|
||||||
" nerd tree or a netrw)
|
" can be a NERDTree window or a netrw window.
|
||||||
function! s:TreeDirNode.openExplorer()
|
function! s:TreeDirNode.openExplorer()
|
||||||
call self.open({'where': 'p'})
|
call self.open({'where': 'p'})
|
||||||
endfunction
|
endfunction
|
||||||
@@ -572,13 +578,11 @@ function! s:TreeDirNode.reveal(path, ...)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: TreeDirNode.removeChild(treenode) {{{1
|
" FUNCTION: TreeDirNode.removeChild(treenode) {{{1
|
||||||
"
|
" Remove the given treenode from "self.children".
|
||||||
"Removes the given treenode from this nodes set of children
|
" Throws "NERDTree.ChildNotFoundError" if the node is not found.
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
"treenode: the node to remove
|
" treenode: the node object to remove
|
||||||
"
|
|
||||||
"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)
|
||||||
@@ -591,10 +595,7 @@ function! s:TreeDirNode.removeChild(treenode)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: TreeDirNode.sortChildren() {{{1
|
" FUNCTION: TreeDirNode.sortChildren() {{{1
|
||||||
"
|
" Sort "self.children" by alphabetical order and directory priority.
|
||||||
"Sorts the children of this node according to alphabetical order and the
|
|
||||||
"directory priority.
|
|
||||||
"
|
|
||||||
function! s:TreeDirNode.sortChildren()
|
function! s:TreeDirNode.sortChildren()
|
||||||
let CompareFunc = function("nerdtree#compareNodesBySortKey")
|
let CompareFunc = function("nerdtree#compareNodesBySortKey")
|
||||||
call sort(self.children, CompareFunc)
|
call sort(self.children, CompareFunc)
|
||||||
|
|||||||
Reference in New Issue
Block a user