diff --git a/src/main/java/com/maddyhome/idea/vim/extension/sneak/IdeaVimSneakExtension.kt b/src/main/java/com/maddyhome/idea/vim/extension/sneak/IdeaVimSneakExtension.kt index c71b1b782a..8818b55894 100644 --- a/src/main/java/com/maddyhome/idea/vim/extension/sneak/IdeaVimSneakExtension.kt +++ b/src/main/java/com/maddyhome/idea/vim/extension/sneak/IdeaVimSneakExtension.kt @@ -26,10 +26,13 @@ import com.maddyhome.idea.vim.api.injector import com.maddyhome.idea.vim.api.options import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.OperatorArguments +import com.maddyhome.idea.vim.common.CommandAliasHandler import com.maddyhome.idea.vim.common.TextRange +import com.maddyhome.idea.vim.ex.ranges.Ranges import com.maddyhome.idea.vim.extension.ExtensionHandler import com.maddyhome.idea.vim.extension.VimExtension import com.maddyhome.idea.vim.extension.VimExtensionFacade +import com.maddyhome.idea.vim.extension.VimExtensionFacade.addCommand import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping import com.maddyhome.idea.vim.extension.VimExtensionHandler import com.maddyhome.idea.vim.helper.StrictMode @@ -63,6 +66,8 @@ internal class IdeaVimSneakExtension : VimExtension { mapToFunctionAndProvideKeys(";", SneakRepeatHandler(highlightHandler, RepeatDirection.IDENTICAL), MappingMode.NXO) mapToFunctionAndProvideKeys(",", SneakRepeatHandler(highlightHandler, RepeatDirection.REVERSE), MappingMode.NXO) + + addCommand("SneakReset", SneakReset()); } private class SneakHandler( @@ -113,6 +118,13 @@ internal class IdeaVimSneakExtension : VimExtension { } } + private class SneakReset: CommandAliasHandler { + override fun execute(command: String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) { + Util.lastSDirection = null + Util.lastSymbols = "" + } + } + private object Util { var lastSDirection: Direction? = null var lastSymbols: String = ""