Vim
Vim copied to clipboard
[Feature Request] add in a langmap setting
- Click thumbs-up 👍 on this issue if you want it!
- Click confused 😕 on this issue if not having it makes VSCodeVim unusable.
The VSCodeVim team prioritizes issues based on reaction count.
This a FEATURE REQUEST:
Environment:
- VSCode Version: 1.19.1
- VsCodeVim Version: v0.10.6
- OS: Linux
What the feature is: Langmaps are a feature which allows you to do a string of simplistic mappings with ease on a single line. For example, as a Dvorak user i have several keys I like to remap in order to improve my ability to navigate and to greatly improve comfort while using vim or vim emulators. This could be achieved with normal mappings of each key (although VSCode Vim doesn't do this properly - see #2233 and #2234) or using a single langmap.
important differences between langmaps and maps Langmaps are inflexible and only allow mapping one key to one other key, many times. Maps allow mapping a key or key combination to another key, key combination, or action. They allow you to do much more complex things and are more flexible.
Why i feel like this is important: I use a Dvorak keyboard, and Vim was made for use on a QWERTY keyboard. This can make some default commands very very awkward for me, including using w and especially j and k. Langmaps can be very very useful to those who use an alternate keyboard layout, whether it means restoring the ability to go off of muscle memory by using a langmap to recreate a QWERTY layout in normal mode, or moving awkward keys to better locations. I personally feel langmaps do a better job of this specific use case than maps, which, especially in VSCode Vim, bloat the settings file and can draw attention away from or overshadow the more complex and important mappings that may be present and need tweaking, or just to freshen up on what one or more mappings you created but rarely use actually do.
Adding in a langmap at this point could shrink my current settings file to half its current size.
For reference: in Vim it's set with the syntax <desiredKey><originalKey> OR <desired keys>;<original keys> and separated by commas. Such as
set langmap=tj,nk,sl,.>;wW,\\,';nN
Although I'd expect only a single backslash would be needed for the escape on the comma.
For example, mapping '.' to 'w' means that '.' will act as the command 'w', but only on it's own. Typing 'd.' will do nothing since '.' is not a movement.
Check it out in vim (and neovim): Remap n
to j
then type dn
and you get what dj
used to give you. Works in both vim and neovim, only VsCodeVim fails to support the mapping.
Either it's a bug in vim/neovim or more likely you've made an error in your interpretation.
BTW also check out #2233 where in visual mode only the first keypress fails to respect remappings.
The problem seems a bit more complex than this issue makes out, multi key mappings work when a vim command (like d/v/c) expects a "movement key". When vim doesn't expect a movement key then remappings don't work (e.g. after ctrl-w).
In this respect VsCodeVim deviates from vim/neovim behaviour.
@aCuteLittleBox can you fix this issue description to reflect actual vim behaviour, as it stands this will confuse people when they try out your example in vim and find it works.
Just got home and tested, i'm not sure how i made that mistake in the first place. I'll update the issue. Thank you for pointing it out @ohjames
@aCuteLittleBox Cool thanks, I'm working on fixing some other issues affecting colemak/dvorak users and I didn't want any potential confusion to conflict with any of that work. BTW I'd strongly recommend you to not use langmaps for the purproses of dvorak remappings, they're great for dealing with cyrillic character sets etc. but standard mappings are much better when it comes to remapping for layouts.
@ohjames I am happy to work on the full remapping or even a dvorak mode, I think I need a little help by what you mean by standard mapping. The issue I am running into currently is jk
is dt
but when I use that it will just delete two lines. I am using this remapping:
"vim.visualModeKeyBindings": [
{
"before": ["d"],
"after": ["h"]
},
{
"before": ["h"],
"after": ["j"]
},
{
"before": ["t"],
"after": ["k"]
},
{
"before": ["n"],
"after": ["l"]
},
{
"before": ["j"],
"after": ["d"]
},
{
"before": ["k"],
"after": ["t"]
},
],
"vim.normalModeKeyBindings": [
{
"before": ["d"],
"after": ["h"]
},
{
"before": ["h"],
"after": ["j"]
},
{
"before": ["t"],
"after": ["k"]
},
{
"before": ["n"],
"after": ["l"]
},
{
"before": ["j"],
"after": ["d"]
},
{
"before": ["k"],
"after": ["t"]
},
],
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": ["d"],
"after": ["h"]
},
{
"before": ["h"],
"after": ["j"]
},
{
"before": ["t"],
"after": ["k"]
},
{
"before": ["n"],
"after": ["l"]
},
{
"before": ["j"],
"after": ["d"]
},
{
"before": ["k"],
"after": ["t"]
},
],
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["d"],
"after": ["h"]
},
{
"before": ["h"],
"after": ["j"]
},
{
"before": ["t"],
"after": ["k"]
},
{
"before": ["n"],
"after": ["l"]
},
{
"before": ["j"],
"after": ["d"]
},
{
"before": ["k"],
"after": ["t"]
},
],
@fzf see https://github.com/VSCodeVim/Vim/issues/2234 it's linked higher up on this very issue.
This feature is extremely useful when writing in a non-Latin script but maybe a cousin of, basically Greek and Cyrillic. For example, when I'm doing non-programming related work and writing in Greek I would have to constantly change the layout to issue commands, not feasible or use “hacks” to trigger a switch to the system layout. In Vim I just have this setting.
set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,
\ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz
Any news? I can't use command mode while Cyrillic layout is activated. So annoying.
There is official workaroud https://github.com/VSCodeVim/Vim#input-method . Not as good as we need but more than nothing. It switches layout on exit input mode. So it saves one layout switch. But ofc it won't help if you switched outside code.
This feature is extremely useful when writing in a non-Latin script but maybe a cousin of, basically Greek and Cyrillic. For example, when I'm doing non-programming related work and writing in Greek I would have to constantly change the layout to issue commands, not feasible or use “hacks” to trigger a switch to the system layout. In Vim I just have this setting.
Totally agree with this!
This feature is extremely useful when writing in a non-Latin script but maybe a cousin of, basically Greek and Cyrillic. For example, when I'm doing non-programming related work and writing in Greek I would have to constantly change the layout to issue commands, not feasible or use “hacks” to trigger a switch to the system layout. In Vim I just have this setting.
set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX, \ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz
It would be really useful, and I use that config in real vim. Any updates?
Just a headsup to people following this thread. I have added the feature here, but it doesn't look like the maintainers are looking to merge it.