-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: better composite key support #1917
feat!: better composite key support #1917
Conversation
New configurations: - compositeTimeout - compositeKeys BREAKING CHANGE: The old composite commands are removed.
} | ||
], | ||
"patternProperties": { | ||
"^[a-zA-Z]{2}$": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ollien VSCode does not warn about configuration errors here, not sure what's wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without altering the schema, I don't think we can do this without making the composite key itself a value (e.g. we could have an array of composite key mapping objects like {"mapping": "jj", ...}
). There's patternErrorMessage
in the schema, but I don't think that works for anything but string values (i.e. not keys).
Your in-line error is probably sufficient, but would be nice if it specified which composite key was the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx! I actually forgot the vscode docs...
FWIW, I've been using this most of today with no composites configured and haven't noticed any(?) perceptible delays on input |
So far, everything is normal. |
I used to have jk mapped to composeEscape 1 and 2 using the following:
after switching to:
I am getting a bug where when I have my cursor position set in insert mode (say on line x), then use my mouse to click elsewhere (say on line y), then press jk, my cursor ends up going back to line x instead of staying on line y. This throws me off and did not occur with the old settings. |
@MaheshNat Change args to |
Is there a benefit for doing the composite keys in VSCode vs having in my vim.keymap.set("n", "<Leader>fs", ":write<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<Leader>ff", ":e ", { noremap = true, silent = true }) I'm new to the extension (since about last week, and it's been great!). I just want to make sure I'm not cobbling something fragile vs. intended features. |
Composite escape should only be for insert mode commands. |
Hey thanks for the feature! This actually breaks my use case. My escape is Another feedback is that it's not clear in the documentation that we are removing a key config and replacing it with something |
hi! would it allow to use i.e. say, i press but rather than me configuring for each combination hard-codingly, it is performed automatically for at least good enough range of the most significant combos like this would help me immensly. |
@goyalyashpal please open a separate issue for this, as it's pretty unrelated to this PR |
The new setting will trigger a file save in "interactive python window" which I have no intention to save the results there. Can we use anything other than |
{
"vscode-neovim.compositeKeys": {
"jj": {
"command": "vscode-neovim.escape"
}
}
} @echaya |
I had made this error and was placing the code snippet in the keyboard shortcuts.json file. It would really help if I this specific change was mentioned on the composite Keys section of the Details panel. I had to find out about this by asking on Reddit. |
I second this. I also had to come to this post to figure out it is |
If there is a problem, please open an issue. |
Same! But now that I figured out |
The main idea is to always register the
type
command, but when there is no need to take over user input (generally in insert mode), forward the received inputs to thedefault:type
command.The implementation is to judge the input before forwarding. If it matches, call the configured command, otherwise continue to forward to the
default:type
At present, this implementation is normal, but it feels that forwarding input causes a slight delay in input (this may be a psychological effect). Need help testing this. If there is indeed a delay, consider forwarding inputs only when the user needs the composite keys. If the user does not need to use composite keys, then just dispose the command when there is no need to take over user input. ( Even if there is a delay, it is very slight.)
New configurations:
Removed commands:
vscode-neovim.compositeEscape1
vscode-neovim.compositeEscape2
Usage