0

When I press the caret button in normal mode, vim first prints a caret at the cursor position. Only with the second press of the caret button does the cursor actually move to the beginning of the line. The caret character then disappears.

enter image description here

I remember the cursor moving to the beginning of the line immediately the last time I used vim. Is this expected behavior? If yes, how can I tell vim to move to the beginning of the line immediately?

The Vim extension of Visual Studio Code replicates this behavior.

  • Vim 8.0.1365
  • no .vimrc
  • macOS 10.14.6
  • German keyboard layout, but it happens with an english layout as well

EDIT: :verbose map ^ yields No mapping found

  • If you want to enter a ^ as text, do you need one or two key presses? – Ralf May 30 at 20:02
  • I need just one. But in contrast to other characters the cursor turns yellow (as in the GIF) and I can replace it with a circumflexed vowel by typing a vowel character next. Maybe this means that the character has not been printed yet as typing a caret could be just the first step of writing a letter with a diacritic circumflex. Maybe this has something to do with it. – 303 May 30 at 20:10
1

This has to do with the ^ being a dead key. A dead key doesn't insert a character, but composes a character with the key pressed next.

This is the "normal" keyboard layout in some languages. In a german layout the ^ is a dead key. A example usage is ^a which would produce a â.

This happens in the keyboard driver. So, to get a ^ delivered to Vim you need to enter ^^.

I have such a layout on one of my work machines, very annoying.

BTW: For German, Linux has a special keyboard layout called "German (no dead keys)". This might also exist for your OS.

Also check this question about problems with the backtick.

| improve this answer | |
  • Thanks. That's it. I could fix it with github.com/oschrenk/keylayout-de_DE-no-deadkeys. Unfortunately as the problem is caused on the OS level there seems to be no way to deactivate dead keys only in normal mode. – 303 May 30 at 21:32
  • @303 Correct, no way. If you want to enter this type of characters in Vim, use digraphs. See :help digraph and :help digraph-table. – Ralf May 30 at 21:36
0

I ussualy use SHIFT + A end of line and insert, and SHIFT + I beggining of line and insert. There are also $ and and 0 to move to the end and beghining of a line.

| 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.