diff options
-rw-r--r-- | ranger/defaults/commands.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py index c7f5e917..b20c7178 100644 --- a/ranger/defaults/commands.py +++ b/ranger/defaults/commands.py @@ -240,11 +240,25 @@ class quit(Command): """ :quit + Closes the current tab. If there is only one tab, quit the program. + """ + + def execute(self): + if len(self.fm.tabs) <= 1: + self.fm.exit() + self.fm.tab_close() + + +class quit_now(Command): + """ + :quit! + Quits the program immediately. """ + name = 'quit!' def execute(self): - raise SystemExit + self.fm.exit() class delete(Command): @@ -499,5 +513,6 @@ def get_command(name, abbrev=True): def command_generator(start): return (cmd + ' ' for cmd in by_name if cmd.startswith(start)) -alias(e=edit) # to make :e unambiguous. +alias(e=edit, q=quit) # for unambiguity +alias(**{'q!':quit_now}) |