11

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?

3
  • 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 ... Commented Feb 15, 2015 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. Commented Feb 15, 2015 at 0:34
  • On a German Mac keyboard I have the same problem with ^, so in order to jump to the begin of a line, I have to hit ^␣, because it annoyingly is looking for the opportunity to write something like â. Commented Sep 30, 2022 at 21:23

2 Answers 2

15

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
3
  • 1
    This does work. And with no side effects. I should learn to use maps. Thank you. Commented Feb 14, 2015 at 19:36
  • You're welcome. Glad I could help.
    – John O'M.
    Commented Feb 15, 2015 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
    Commented Dec 12, 2016 at 16:20
0
" US-intl keyboard dead key re-mappings
nmap à `a|nmap á 'a
nmap ć 'c
nmap è `e|nmap é 'e
nmap ǵ 'g
nmap ì `i|nmap í 'i
nmap ḱ 'k
nmap ĺ 'l
nmap ḿ 'm
nmap ǹ `n|nmap ń 'n
nmap ò `o|nmap ó 'o
nmap ṕ 'p
nmap ŕ 'r
nmap ś 's
nmap ù `u|nmap ú 'u
nmap ǜ `v|nmap ǘ 'v
nmap ẁ `w|nmap ẃ 'w
nmap ỳ `y|nmap ý 'y
nmap ź 'z
1
  • 2
    Hi, welcome here. I think you could provide some explanation to describe why your answer is useful, and how it solves the problem :)
    – Biggybi
    Commented May 16, 2020 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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