diff options
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/globals.py | 10 | ||||
-rw-r--r-- | alot/defaults/default.bindings | 1 | ||||
-rw-r--r-- | alot/ui.py | 7 |
3 files changed, 18 insertions, 0 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index ba577714..6ed95166 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -310,6 +310,16 @@ class PythonShellCommand(Command): ui.mainloop.screen.start() +@registerCommand(MODE, 'repeat') +class RepeatCommand(Command): + """Repeats the command executed last time""" + def apply(self, ui): + if ui.last_commandline is not None: + ui.apply_commandline(ui.last_commandline) + else: + ui.notify('no last command') + + @registerCommand(MODE, 'call', arguments=[ (['command'], {'help':'python command string to call'})]) class CallCommand(Command): diff --git a/alot/defaults/default.bindings b/alot/defaults/default.bindings index a9f0b832..e5409a19 100644 --- a/alot/defaults/default.bindings +++ b/alot/defaults/default.bindings @@ -21,6 +21,7 @@ o = prompt 'search ' q = exit ';' = bufferlist ':' = prompt +. = repeat [bufferlist] x = close @@ -37,6 +37,8 @@ class UI(object): """history of the command line prompt""" input_queue = [] """stores partial keyboard input""" + last_commandline = None + """saves the last executed commandline""" def __init__(self, dbman, initialcmd): """ @@ -182,6 +184,11 @@ class UI(object): cmd = CommandSequenceCommand(cmdlist) self.apply_command(cmd) + # store cmdline for use with 'repeat' command + cmdline = cmdline.lstrip() + if not cmdline.startswith('prompt') and not cmdline.startswith('repeat'): + self.last_commandline = cmdline + def _unhandeled_input(self, key): """ Called by :class:`urwid.MainLoop` if a keypress was passed to the root |