From ee194fc2594c5dfe48b1ae0c033d7c87a1917bf2 Mon Sep 17 00:00:00 2001 From: Fredrik Ehnbom Date: Sat, 7 Apr 2012 22:02:16 +0200 Subject: [PATCH] Undo steps shouldn't enter visual mode. Issue #119 --- Default.sublime-keymap | 2 +- vintage.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Default.sublime-keymap b/Default.sublime-keymap index faf2e65..a27d062 100644 --- a/Default.sublime-keymap +++ b/Default.sublime-keymap @@ -124,7 +124,7 @@ "context": [{"key": "setting.command_mode"}] }, - { "keys": ["u"], "command": "undo", "context": [{"key": "setting.command_mode"}] }, + { "keys": ["u"], "command": "vintage_undo", "context": [{"key": "setting.command_mode"}] }, { "keys": ["ctrl+r"], "command": "redo", "context": [{"key": "setting.command_mode"}, {"key": "setting.vintage_ctrl_keys"}] diff --git a/vintage.py b/vintage.py index 5c03361..d78f984 100644 --- a/vintage.py +++ b/vintage.py @@ -750,6 +750,11 @@ def run(self, edit): self.view.run_command("lower_case") self.view.run_command("exit_visual_mode") +class VintageUndo(sublime_plugin.TextCommand): + def run(self, edit): + self.view.run_command("undo") + self.view.sel().clear() + # Sequence is used as part of glue_marked_undo_groups: the marked undo groups # are rewritten into a single sequence command, that accepts all the previous # commands