tree, dont_show_children_nodes, number of direct children
This commit is contained in:
parent
c2c0f3ec3c
commit
f6424891b9
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -19,7 +19,7 @@ class NerdTree():
|
|||||||
else:
|
else:
|
||||||
self.json_tree = {}
|
self.json_tree = {}
|
||||||
|
|
||||||
def sort_directory_first(self, startpath):
|
def sort_directories_first(self, startpath):
|
||||||
files = []
|
files = []
|
||||||
dirs = []
|
dirs = []
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class NerdTree():
|
|||||||
dirfirst = self.opts['list_dir_first'] if self.opts.get('list_dir_first') is not None else False
|
dirfirst = self.opts['list_dir_first'] if self.opts.get('list_dir_first') is not None else False
|
||||||
|
|
||||||
if dirfirst:
|
if dirfirst:
|
||||||
return self.sort_directory_first(startpath)
|
return self.sort_directories_first(startpath)
|
||||||
|
|
||||||
return os.listdir(startpath)
|
return os.listdir(startpath)
|
||||||
|
|
||||||
@ -125,6 +125,9 @@ class NerdTree():
|
|||||||
else:
|
else:
|
||||||
nerd_tree_txt = rootnode_name
|
nerd_tree_txt = rootnode_name
|
||||||
|
|
||||||
|
if rootnode.get('nchildren') is not None:
|
||||||
|
nerd_tree_txt += ' (%s▾)' % rootnode['nchildren']
|
||||||
|
|
||||||
items = rootnode.get('children') or []
|
items = rootnode.get('children') or []
|
||||||
|
|
||||||
for n, item in enumerate(items):
|
for n, item in enumerate(items):
|
||||||
|
@ -70,6 +70,7 @@ class NerdTreeFind(NerdTree):
|
|||||||
|
|
||||||
if dont_show_children_nodes:
|
if dont_show_children_nodes:
|
||||||
for result in results:
|
for result in results:
|
||||||
|
result['nchildren'] = len(result['children'])
|
||||||
result['children'] = []
|
result['children'] = []
|
||||||
|
|
||||||
tree_struct = {}
|
tree_struct = {}
|
||||||
|
@ -37,6 +37,11 @@ def produce_treeline(prec_seps, lsep):
|
|||||||
else:
|
else:
|
||||||
item_name = item['name']
|
item_name = item['name']
|
||||||
tomount = sep + item_name
|
tomount = sep + item_name
|
||||||
|
|
||||||
|
# if item.get('type') == 'd':
|
||||||
|
# if item.get('nchildren') is not None:
|
||||||
|
# tomount += '(%s)' % (item['nchildren'],)
|
||||||
|
|
||||||
tree_line = mount_str_at(tree_line, level2indent(level_n), tomount)
|
tree_line = mount_str_at(tree_line, level2indent(level_n), tomount)
|
||||||
|
|
||||||
return tree_line.rstrip()
|
return tree_line.rstrip()
|
||||||
@ -45,8 +50,6 @@ def nerd_tree_sort_dirfirst(startpath):
|
|||||||
files = []
|
files = []
|
||||||
dirs = []
|
dirs = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for item in os.listdir(startpath):
|
for item in os.listdir(startpath):
|
||||||
if os.path.isdir(startpath + item):
|
if os.path.isdir(startpath + item):
|
||||||
dirs.append(item)
|
dirs.append(item)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user