Is there a key to insert something at the end of the line in Vim? It would be similar to A
, except it would insert before the last character, not after it.
A use case is for example in Python:
if ((a and b) or c:
and you want to insert the missing parenthesis before the colon. There are similar use cases in C-syntax languages when you want t开发者_StackOverflow中文版o insert something before the semi-colon.
To insert before the last character, use $i
. This isn't a common enough case to warrant a single-key command, apparently.
There isn't a built-in command that uses one single keystroke, but If you use it often consider creating a map:
nnoremap Q $i
Alternatively you can use A<left>
in your map to achieve the same effect.
精彩评论