0

If I want the output 𐐀g, I can create a map like this:

imap <F2> <C-V>U10400g

However for output 𐐀f, it causes a problem:

imap <F2> <C-V>U10400f

as the f is confused as part of the character. I can work around by adding leading zeros:

imap <F2> <C-V>U00010400f

but I would prefer a terminating key if possible. I came up with this:

imap <F2> <C-V>U10400<CR>f

but it puts a newline between the two characters. Is it possible to do what I am trying to do?

1

The documentation explicitly recommends using the maximum number of digits. See :help i_CTRL-V_digit:

Normally you would type the maximum number of characters. Thus to enter a space (value 32) you would type <C-V>032. You can omit the leading zero, in which case the character typed after the number must be a non-digit. This happens for the other modes as well: As soon as you type a character that is invalid for the mode, the value before it will be used and the "invalid" character is dealt with in the normal way.

I have found, however, that a command such as CTRL-], which triggers abbreviation, without inserting a character, is enough to break the sequence, without an undesirable side effect.

This seems to work fine:

inoremap <F2> <C-V>U10400<C-]>f

But I'd still recommend the solution using the three leading zeroes, as it's less "hacky" and it's the one recommended in the documentation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.