Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Pass count to the command called by remapper

Open stevenguh opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. This is to solve https://github.com/VSpaceCode/VSpaceCode/issues/278.

When a user used vim.normalModeKeyBindingsNonRecursive to remap to a command,

  1. there's no way for an extension to integrate with the count information
  2. The count still persist after the command executed

For example:

"vim.normalModeKeyBindingsNonRecursive": [
	{
		"before": ["<space>"],
		"commands": ["vspacecode.space"],
	},
]

VSpaceCode has no way to get the count when a user press 2 <space>, and after the command has been executed the 2 still exists.

Describe the solution you'd like Is there any way we can pass the count (or more general the vim state) when we call the command?

For example:

"vim.normalModeKeyBindingsNonRecursive": [
	{
		"before": ["<space>"],
		"commands": [
			{"command": "whichkey.triggerKey", args: "$count"}
		],
	},
]

The remapper will inspect the args and replace $count with the count. This can also support other variables like $registers.

Describe alternatives you've considered

"vim.normalModeKeyBindingsNonRecursive": [
	{
		"before": ["<space>"],
		"commands": [
			{"commandWithVimState": "whichkey.triggerKey"}
		],
	},
]

When space is entered, it will pass vim state as parameter when executing command the vscode.commands.executeCommand(commandString, vimState).

stevenguh avatar Jul 21 '22 05:07 stevenguh