Capital A
in Vim takes me to the last character in insert mode, but can I go to the nth-to-last character in insert mode (or append mode) in vim?
Example:
this is some t|ext
how to go specifically to the location of the |
in insert mode, I would imagine something like <n>+A
where n
is an integer. I did see a similar question here: how-to-go-to-before-last-character-in-a-line and an answer suggested to use $i
, to go to the second-to-last character in insert mode, but this can't go to the nth character.
[Edit]:
I only want to end up in insert mode, not necessarily do all the commands in insert mode but rather do them in normal mode.
Ctrl+O
from Insert mode to enter a single Normal mode command and stay in Insert mode otherwise. So, for example, you can useCtrl+O 20 |
to go to column 20 in the current line (and continue in Insert mode) orCtrl+O gM
to go to the middle of the current line. Unfortunately there isn't a single Normal mode command to go to the nth-character before the end of the line, soCtrl+O
isn't that helpful then, but if you create a Normal-mode mapping to take the count and go to the nth character before the end,Ctrl+O
can help you access it.A
do.gM
takes you to the middle of the line, see:help gM
.