guillermooo / Vintageous

Vi/Vim emulation for Sublime Text 3
http://guillermooo.bitbucket.org/Vintageous/
Other
1.64k stars 115 forks source link

How to unmap action `s` #1089

Open srghma opened 7 years ago

srghma commented 7 years ago

Here I want to make ss and others keystrokes to call external plugin AceJump

from Vintageous import plugins
from Vintageous.vi.cmd_defs import ViOperatorDef
from Vintageous.vi.utils import modes

class VintageousAceJump(ViOperatorDef):
    def __init__(self, *args, **kwargs):
        ViOperatorDef.__init__(self, *args, **kwargs)

        self.repeatable = False
        self.motion_required = False

@plugins.register('ss', (modes.NORMAL,))
class VistageousAceJumpChar(VintageousAceJump):

    def translate(self, state):
        return {
          'action': 'ace_jump_char',
          'action_args': {},
        }

@plugins.register('sw', (modes.NORMAL,))
class VintageousAceJumpWord(VintageousAceJump):

    def translate(self, state):
        return {
          'action': 'ace_jump_word',
          'action_args': {},
        }

@plugins.register('sl', (modes.NORMAL,))
class VintageousAceJumpLine(VintageousAceJump):

    def translate(self, state):
        return {
          'action': 'ace_jump_line',
          'action_args': {},
        }

But this code dont work, s call substitute and keystroke stumble. I tried to add No Operation but this dont help.

@plugins.register('s', (modes.NORMAL, ))
class VistageousAceJumpChar(VintageousAceJump):

    def translate(self, state):
        return { }

The only way that I see is to unmap s entirely on plugin_loaded, how to do this without hacking Vintageous.vi.keys.mappings?