Skip to content

Langmap #145

@Opisek

Description

@Opisek

While Vim for CM6 already supports simple map and unmap directives, it lacks the ability to interpret Vim's langmaps.

The purpose of a langmap is to allow typing in insert and replace mode using one's preferred keyboard layout, while still being able to use standard Vim mappings in normal and visual mode. This is crucial for people using other scripts like Greek and Cyrillic or using a different keyboard layout that would spread default bindings throughout the whole keyboard.

Example langmap for Greek:

Α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

Example langmap for Dvorak:

'q,\\,w,.e,pr,yt,fy,gu,ci,ro,lp,/[,=],aa,os,ed,uf,ig,dh,hj,tk,nl,s\\;,-',\\;z,qx,jc,kv,xb,bn,mm,w\\,,v.,z/,[-,]=,\"Q,<W,>E,PR,YT,FY,GU,CI,RO,LP,?{,+},AA,OS,ED,UF,IG,DH,HJ,TK,NL,S:,_\",:Z,QX,JC,KV,XB,BN,MM,W<,V>,Z?

You may find the exact format under :help langmap in Vim.

It seems to me like it could be possible to override defaultKeymap in the source code using such a langmap:
Given a parsed langmap, one would simply need to copy every binding once for each of the four contexts and then adjust the left side to the specified map.

My pull request under VsCodeVim includes a langmap parser, so that should not be an issue. The only remaining part would be the logic.

Would this be something you could look into? Otherwise, I could try and understand CM6 Vim's code a little better and make a pull request myself, provided it's something you would be interested in merging in first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions