Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to select the last inserted text in vim? For example I want to be able to type a text, exit the insert mode, select what I have just inserted, and change it to uppercase.

Note: I do not consider Caps Lock a solution here.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

You can use

v`[

to select the last insert if you are still at the correct cursor position.

`[

jumps to the beginning of your last insert,

`]

jumps to the end of the last insert respectively. So to be independent of your current cursor position, you'd type

`[v`]~

to toggle the capitalization of your last insert.

share|improve this answer
3  
An alternative to v ~ is gU and gu to capitalize/lowercase the next move. –  tidbeck Jan 26 '12 at 13:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.