9

I am using a keyboard layout in which the backtick (`) is a dead key.

This means that when I type a backtick followed by a vowel (for example `a) what Vim sees is an accented character (à). So if I set a mark with ma I can jump to the line of the mark with 'a. But jumping to the specific location of the mark with `a won't work.

I found a workaround for this: when typing a dead key I can make Vim receive a backtick by striking the backtick and then the space bar. So if I want to go to mark a I type `␣a.

Is there a way to jump to the mark without having to strike that extra space? With no side effects?

  • Can't use type 2 backticks to get a backtick? Or configure your OS to do that? That's still an extra keystoke, but better than ` + space ... – Martin Tournoij Feb 15 '15 at 0:10
  • @Carpetsmoker No. Typing two backticks normally results in `` for me. But in Normal mode it seems like another thing happens: I type ``a and Vim says "E78: Unknown mark." From showcmd I think Vim understands this as `à. Also I would like to make the behaviour OS independent. map seems to do the work. – Gonçalo Ribeiro Feb 15 '15 at 0:34
12

Try making it a mapping:

" Mapping dead keys in normal mode
nmap á 'a

That way, when Vim gets the accented a, it interprets it as `+a

Using nmap allows this to happen in normal mode only; in insert mode or command mode, you'll get the accented a as you'd expect.

It is possible to apply this to other keys:

nmap à `a
nmap Á 'A
nmap À `A
nmap ç 'c
nmap Ç 'C
nmap é 'e
nmap è `e
nmap É 'E
nmap È `E
nmap í 'i
nmap ì `i
nmap Í 'I
nmap Ì `I
nmap ó 'o
nmap ò `o
nmap Ó 'O
nmap Ò `O
nmap ú 'u
nmap ù `u
nmap Ú 'U
nmap Ù `U
  • This does work. And with no side effects. I should learn to use maps. Thank you. – Gonçalo Ribeiro Feb 14 '15 at 19:36
  • You're welcome. Glad I could help. – John O'M. Feb 15 '15 at 3:05
  • What about the ^ (soft first character of the line)? Since this is a standalone command, what can be done? Does the OS cache the dead key until another key is pressed? – Spidey Dec 12 '16 at 16:20

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.