开发者

Vim: inserting at the end of the line

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜