I am facing some weird behavior using a key card in vim that uses the ctrl key. I would suggest that this has a simple reason and solution, but I just don't see it.
While editing a restructured text, I find things like
:math:`x`
often (this: math: role will cause everything inside the ticks to be typed like math, for example, latex output).
I want to map a key such as m to type: math: `` in the text and place the cursor inside the ticks.
I did it
map mi:math:``ha
and it seems to be working fine.
However, I would like to be able to use this card in insert mode. For this, I thought it was better to use ctrl + m . I did
imap <cm> :math:``ha
Although this correctly enters: math: `` and positions the cursor inside the ticks when I do ctrl + m , the problem is that after this point every time I press enter in insert mode, this executes the same command as if I typed ctrl + m . In other words, entering insert mode now seems to be displayed on
:math:``ha
.
This seems to be definitely related to using the ctrl key. If I tie, for example. F5 key as follows
imap <F5> :math:``ha
everything is good.
I can use, for example, F5 and keep myself further concerned, but I would like to know what is happening for future reference.
Is there anything basic about using the ctrl key in a key card that I am missing?
Thank you,
source share