Entering text in fragment fields uses the wrong character when using langmap

I use a special key combination using the langmap option in vimrc.

I am trying to use snipmate but I am having problems. When I type a word and click on a tab, it allows me to edit the parameter. The problem is that the first character is reassigned, and I want it to be the actual key.

For example, I’ll type the following:

 for 

and click on the tab to expand the fragment:

 for (i = 0; i < COUNT; ++i) 

I is underlined, which means that I can edit it. I type "aaa":

 for (baa = 0; i < COUNT; ++i) 

It turns out baa , although I typed aaa . This is due to the fact that I mixed up a and b .

How can i fix this?


Here is my key combination:

 set langmap=nj,N},ek,E{,il,IL,{^,}$,lb,LB,uw,UW,ye,YE,jg,JG,\\;z,f\\.,F\\,,zu,ZU,.?,\\,/,/v,? V,ta,TA,si,SI,ro,RO,ac,AC,wr,WR,xx,XX,dd,DD,bs,BS,gf,GF,pt,PT,kn,KN,cy,CY,vp,VP,o\\; 

It will not make much sense to others, and I have not finalized how I want it to look.

+1
source share
3 answers

C is a program that displays comparisons of similar behavior in langmap, but not for select:

 /* input: lhs rhs optional-descripton lhs rhs ... */ #include <stdlib.h> #include <stdio.h> int main() { FILE *fi = fopen("in.txt", "r"); FILE *fo = fopen("out.txt", "w"); char lc[8], rc[8]; while (fscanf(fi, "\n%s %s", lc, rc) != EOF) { fprintf(fo, "nnoremap %s %s\n", lc, rc); fprintf(fo, "xnoremap %s %s\n", lc, rc); fprintf(fo, "onoremap %s %s\n", lc, rc); while (fgetc(fi) != '\n'); } fclose(fo); fclose(fi); } 

It does not work the same with langmap and therefore may break other bindings.

0
source

From your :set langmap I understand that you matched a with c , so by typing aaa , did you expect to get ccc ?

From what I understand ( :help langmap ), your custom substitutions are not available in INSERT mode to actually insert material, and I don’t see mention of the SELECT mode you are in when overwriting SnipMate substitutes.

If i do it

 :set langmap+=ac,bs 

and I type aaa in SELECT mode, I get caa .

This is because langmap is applied to the first a ( :help Select-mode ) and therefore inserts c . But after this first character, I am in INSERT mode for all subsequent characters. Since langmap not used in INSERT mode, aa inserted as is.

It’s not clear to me why you get baa instead of caa . Your langmap seems to be pretty clear about your intention: you want a insert c and b to insert s . Input a must not be inserted b .

I smell the dangers of typos in your .vimrc . Try: reset your set langmap and start adding your mappings one at a time.

May I ask you what is the purpose of such a massive reassignment?

+2
source

Now this is fixed in vim 7.4.1150. See https://github.com/vim/vim/issues/572 for details.

0
source

Source: https://habr.com/ru/post/900039/


All Articles