PKQ4=@tVim.pyimport sublime, sublimeplugin # To run it, save it within the User/ directory, then open the console (Ctrl+~), # and type: view.runCommand('vim') # ========================================================================================== class SelectCtrlModeCommand(sublimeplugin.TextCommand): def run(self, view, args): if args[0] == 'control': self.switch(view, True) elif args[0] == 'edit': self.switch(view, False) def switch(self, view, isCtrl): if isCtrl: # set restore point view.runCommand('glueMarkedUndoGroups') sublime.statusMessage("-- CTRL --") view.setStatus('Vim.status', '-- CTRL --') else: sublime.statusMessage("CTRL: OFF") # set restore point view.runCommand('markUndoGroupsForGluing') view.eraseStatus('Vim.status') # set modes view.options().set('ctrlMode', isCtrl) view.options().set('commandMode', isCtrl) # ========================================================================================== class InsertModeCommand(sublimeplugin.TextCommand): def run(self, view, args): view.runCommand('selectCtrlMode edit') if len(args) > 0: if args[0] == 'bol': view.runCommand('moveTo bol') elif args[0] == 'eol': view.runCommand('moveTo eol') elif args[0] == 'append': view.runCommand('move characters 0') # ========================================================================================== class CtrlModeCommand(sublimeplugin.TextCommand): def run(self, view, args): if len(args) > 0: if args[0] == 'on': view.runCommand('selectCtrlMode control') elif args[0] == 'off': view.runCommand('selectCtrlMode edit') PKQ4=A `T InputPanel.pyimport sublime, sublimeplugin # and type: view.runCommand('inputPanel') class InputPanelCommand(sublimeplugin.TextCommand): def run(self, view, args): self.view = view view.window().showInputPanel(":", "", self.on_done, self.on_change, self.on_cancel) def on_done(self, input): self.parse(input) def on_change(self, cmd): view = self.view if cmd == "s" or cmd == r'%s': view.window().runCommand('showPanel replace') def on_cancel(self): pass def parse(self, cmd): view = self.view if cmd == "w": view.window().runCommand('save') elif cmd == "wa": view.window().runCommand('saveAll') elif cmd == "q": view.window().runCommand('hotExit')PKQ4=1f  DeleteRange.pyimport sublime, sublimeplugin import re def abs(n): if n < 0: return -1 * n else: return n # and type: view.runCommand('deleteRange') class DeleteRangeCommand(sublimeplugin.TextCommand): def run(self, view, args): for command in " ".join(args).split(","): self.parse(view, command) ##------------------------------------------------------------------------------ def parse(self, view, command): match_line_pattern = "lines ([-]?\d+)" if re.match(match_line_pattern, command): self.line(view, int(re.match(match_line_pattern, command).group(1))) match_word_pattern = "words ([-]?\d+)" if re.match(match_word_pattern, command): self.word(view, int(re.match(match_word_pattern, command).group(1))) match_character_pattern = "characters ([-]?\d+)" if re.match(match_character_pattern, command): self.character(view, int(re.match(match_character_pattern, command).group(1))) match_eol_pattern = "eol" if re.match(match_eol_pattern, command): self.eol(view) match_bol_pattern = "bol" if re.match(match_bol_pattern, command): self.bol(view) ##------------------------------------------------------------------------------ def line(self, view, n): if n < 0: view.runCommand('move lines ' + str(n)) for i in range(abs(n)): view.runCommand('expandSelectionTo line') view.runCommand('leftDeleteCharacters') ##------------------------------------------------------------------------------ def word(self, view, n): if n < 0: direction = "left" else: direction = "right" for i in range(abs(n)): view.runCommand('deleteWord ' + direction) ##------------------------------------------------------------------------------ def character(self, view, n): if n < 0: direction = "left" else: direction = "right" for i in range(abs(n)): view.runCommand(direction + 'DeleteCharacters') ##------------------------------------------------------------------------------ def eol(self, view): view.runCommand('moveTo eol extend') view.runCommand('rightDeleteCharacters') ##------------------------------------------------------------------------------ def bol(self, view): view.runCommand('moveTo bol extend') view.runCommand('leftDeleteCharacters')PKQ4=r!zzDefault.sublime-keymap PKQ4=@tVim.pyPKQ4=A `T InputPanel.pyPKQ4=1f   DeleteRange.pyPKQ4=r!zzDefault.sublime-keymapPK.