You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow a key sequence binding like j,k to not prevent user from insert j #1701
You can bind a key sequence like j,k to a function or script block by Set-PSReadLineKeyHandler -Key 'j,k' -ViMode Insert -Function ViCommandMode, but a user cannot insert a character j after that.
Yeah, j will be bound after that and won't be treated as a literal character. I think that's just an example. Key sequences should be chosen to not interfere with the regular input, like Set-PSReadlineKeyHandler -Chord 'Ctrl+d,Ctrl+c' -Function CaptureScreen
Yeah, j will be bound after that and won't be treated as a literal character. I think that's just an example. Key sequences should be chosen to not interfere with the regular input, like Set-PSReadlineKeyHandler -Chord 'Ctrl+d,Ctrl+c' -Function CaptureScreen
I think Patrick Meinecke (@SeeminglyScience) explained it nicely. Many vim users have bindings of jj or jk to exit insert mode because it is so common to switch modes and this way it keeps your fingers on the home row vs. reaching for Esc key every time.
Anyway, I suppose a sequence timer/timeout is needed to make this work.
changed the title [-]Allow Set-PSReadLineKeyHandler to bind a key sequence[/-][+]Allow a key sequence binding like `j,k` to not prevent user from insert `j`[/+]on Jul 27, 2020
Since this is under not-planned, it seems, I'm trying to figure out how to change this so it's jj instead of jk but I can't figure it out. Do you have any ideas how I could do that?
Activity
daxian-dbw commentedon Jul 26, 2020
David Hatch (@dhatch48) You can do that by
Set-PSReadLineKeyHandler -Key 'j,k' -ViMode Insert -Function ViCommandModeSeeminglyScience commentedon Jul 26, 2020
Dongbo Wang (@daxian-dbw) I can't get that to work right. I mean it works, but you can't type j anymore.
daxian-dbw commentedon Jul 26, 2020
Yeah,
jwill be bound after that and won't be treated as a literal character. I think that's just an example. Key sequences should be chosen to not interfere with the regular input, likeSet-PSReadlineKeyHandler -Chord 'Ctrl+d,Ctrl+c' -Function CaptureScreenSeeminglyScience commentedon Jul 26, 2020
Nah
jkorjj(what I use) to exit insert mode is super common. Usually it works like this:jis written to the bufferjis removed from the buffer and the command firesdhatch48 commentedon Jul 27, 2020
I think Patrick Meinecke (@SeeminglyScience) explained it nicely. Many vim users have bindings of jj or jk to exit insert mode because it is so common to switch modes and this way it keeps your fingers on the home row vs. reaching for Esc key every time.
Anyway, I suppose a sequence timer/timeout is needed to make this work.
[-]Allow Set-PSReadLineKeyHandler to bind a key sequence[/-][+]Allow a key sequence binding like `j,k` to not prevent user from insert `j`[/+]daxian-dbw commentedon Jul 27, 2020
I see. Thanks for clarifying it.
I have changed the title and PR description to reflect what is really asked for.
Drllap commentedon Jan 23, 2022
This is what I added to my profile to make
jkgo to comand mode:slacksystem commentedon Jan 6, 2023
Since this is under not-planned, it seems, I'm trying to figure out how to change this so it's jj instead of jk but I can't figure it out. Do you have any ideas how I could do that?
Drllap commentedon Feb 25, 2023
Slack System (@slacksystem) try this: