diff --git a/Default.sublime-keymap b/Default.sublime-keymap index bae289c..d208c7e 100644 --- a/Default.sublime-keymap +++ b/Default.sublime-keymap @@ -62,6 +62,8 @@ { "keys" : ["z", "z"], "command" : "center_on_cursor", "context": [{"key": "setting.command_mode"}] }, + { "keys": ["Z", "Z"], "command" : "vi_save_and_exit", "context": [{"key": "setting.command_mode"}] }, + { "keys": ["i"], "command": "enter_insert_mode", "context": [{"key": "setting.command_mode"}] }, { "keys": ["I"], "command": "enter_insert_mode", "args": {"insert_command": "vi_move_to_first_non_white_space_character"}, diff --git a/vintage_commands.py b/vintage_commands.py index 29860d0..e32da77 100644 --- a/vintage_commands.py +++ b/vintage_commands.py @@ -39,3 +39,10 @@ def run(self, edit): file_name) if os.path.exists(file_name): self.view.window().open_file(file_name) + +class ViSaveAndExit(sublime_plugin.WindowCommand): + def run(self): + self.window.run_command('save') + self.window.run_command('close') + if len(self.window.views()) == 0: + self.window.run_command('close')