To use the Spanish layout one has to remap an accent like the one over o: ö to : in Normal Mode. How can I do this in my .vimrc? I have to handle the accent only, not a character; I have no idea how to approach this task.

  • Do you mean insert mode? You dont want to lose : in Normal mode. – D. Ben Knoble May 27 '19 at 13:42
  • Sure I don't want to loose colon in Normal Mode. I want to keep it, because in Spanish layout it is stolen by an umlaut. I want to catch half a character (umlaut) and map it back to colon. All in Normal Mode, yes. – Alexey Orlov May 27 '19 at 14:19
  • Take a look at help langremap – D. Ben Knoble May 27 '19 at 14:24
  • Already taken :) . I don't need a character. I need just an umlaut. Half a character, that is. – Alexey Orlov May 27 '19 at 14:25
  • Depends on how youre entering the umlaut (or tréma) then. If it’s at the OS level, you might be stuck (and need to fix it at that level) – D. Ben Knoble May 27 '19 at 14:26

Open vim. Enter insert mode (i), then type Ctrl-V (<C-V> in vim notation) and hit your umlaut key. That should give you the key that vim sees, if any. You can map that key by

nnoremap <umlaut> :

Where <umlaut> you enter via the Ctrl-V as above.

If that method doesn’t produce a distinct key, but instead waits at another level (the terminal emulator, keyboard, window manager, OS, &c.) then you’ll need to fix it at that level somehow.

  • We are almost there :) . After <C-V> umlaut shows all right. On Esc it disappears. – Alexey Orlov May 27 '19 at 17:00
  • When you hit the umlaut normally does it show the umlaut while waiting for the next key? – D. Ben Knoble May 27 '19 at 17:02
  • Yes, it does. Probably, it still does not count as a complete character. – Alexey Orlov May 27 '19 at 17:21
  • @AlexeyOrlov my guess as well. Somebody will need to show you how to map that key at a higher level to do the right thing. Do you have a colon somewhere else on the keyboard? – D. Ben Knoble May 27 '19 at 17:27

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.