Ranger: Add toggle_flat command

master
Pierre Neidhardt 2015-04-15 08:00:03 +02:00
parent 1d4f082dcb
commit 0c6df5b343
2 changed files with 21 additions and 0 deletions

View File

@ -124,3 +124,21 @@ class mkcd(Command):
self.fm.execute_console('scout -ae ^{}$'.format(s))
else:
self.fm.notify("file/directory exists!", bad=True)
class toggle_flat(Command):
"""
:toggle_flat
Flattens or unflattens the directory view.
"""
def execute(self):
if self.fm.thisdir.flat == 0:
self.fm.thisdir.unload()
self.fm.thisdir.flat = -1
self.fm.thisdir.load_content()
else:
self.fm.thisdir.unload()
self.fm.thisdir.flat = 0
self.fm.thisdir.load_content()

View File

@ -171,3 +171,6 @@ map S shell zshcd %d
## Image preview toggle
map zi set preview_images=True
map zI set preview_images=False
## toggle_flat
map zF toggle_flat