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?
this is some t|ext
how to go specifically to the location of the
| in insert mode, I would imagine something like
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.
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+Ofrom Insert mode to enter a single Normal mode command and stay in Insert mode otherwise. So, for example, you can use
Ctrl+O 20 |to go to column 20 in the current line (and continue in Insert mode) or
Ctrl+O gMto 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, so
Ctrl+Oisn'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+Ocan help you access it.
gMtakes you to the middle of the line, see