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.

In vim when I want to indent a section of code, I typically enter Visual mode and then use < or > to change the indentation. After doing that, vim puts me on the first line of the code that I indented.

Often the next thing I want to do is add code to the end. How do I quickly jump to the end so I can hit o and start adding more code?

I know I can type gv[esc] or gvo[esc] (depending on whether I had started my block from the beginning or the end) but I'm hoping for something more vim-like (i.e. not so many keystrokes).

share|improve this question
add comment

2 Answers

Brian's answer didn't work for me. To be explicit, I executed the following:

Shift-V
j
j #highlighted three lines in visual mode
'> #expected vim to indent, and then put me on the last line of the selection - instead, nothing happened (no indent, still in Visual Mode)
`> #expected vim to indent, and then put me on the last character of the selection - instead, I was just moved to the last character of the selection (no indent, still in Visual Mode)

The best solution I've found is

Shift-V
j
j #etc.
>`` #this indents and then jumps to the final line

Executing >'' as the final command has the same effect.

share|improve this answer
    
Just because you've earned a privilege on one SE site doesn't mean you should have it on all sites. Once you earn 200 rep on one site, you get an association bonus though, which will give you enough rep to comment on any other site. –  Oliver Salzburg Nov 27 '13 at 14:00
add comment

Ooh, I found the answer to my question. I can do either one of these:

'>
`>

The first one jumps to the last line of the previous visual selection.

The second one jumps to the last character of the previous visual selection.

After either one of these I can hit o to start adding more lines.

share|improve this answer
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.