2

I run gVim7.4 on Windows 7 with the English International keyboard layout. The keyboard layout works in a way so that pressing ` + i gives you ì.

In Vim insert mode that's the desired behavior. However it isn't in command mode where I effectively have to press ` + <Space> + i to go to the mark 'i'. I observed similar behavior for the caret ^ key. Pressing it makes vim wait for a vowel to be able to render â, î etc instead of directly going to be beginning of the line. It only goes there when I press ^ + <Space>.

In insert mode it's useful to be able to type â. It isn't in command mode and there it's completely useless to wait for another character.

Is there a way to get better behavior by editing the vimrc or writing a autohotkey script? Is there a way to make vim behave in command mode that still allows me to u?

  • Vim doesn't see any keycodes until you've completed the key chain (either as `i or as `<Space>), so there's little you can do in Vim. One thing you could maybe do is have AHK pick up on <Esc> and i/a/A/o/O/ and start "insert mode" there when Vim is active. I have no idea if this is possible with AHK. Another fix is ditching AHK altogether and do this sort of stuff with Vim; which has the obvious drawback that it will work only in vim and not your other applications... – Martin Tournoij Mar 30 '16 at 17:31
  • Posting answer because I don't have enough rep to comment. One workaround is to have both an international keyboard, and another keyboard. You can switch between them with win+space. – Reuben Steenekamp Sep 15 at 10:09
1

There is no easy way to avoid the <space>; that is why I use single quote instead, ' + i, which is similar enough for me (doesn't move to the column, but to the beginning of the line).

You could also consider using another mark related movements, such as ]' and `].

If you find that you use ` + i more often than ' + i you could use a set of mappings to switch them:

nnoremap 'a `a
nnoremap `a 'a

(possibly using a loop similar to the one in the capslock plugin).

Or you could switch just ]' and `] and its counterparts (8 mappings instead of 52), directly or through some plugin such as signature.

  • That doesn't help with <kbd>^</kbd> and <kbd>"</kbd> which seem more important than <kbd>`</kbd> and <kbd>'</kbd>. – Christian Mar 31 '16 at 9:48

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.