1

Let's say I want to indent everything between lines 40 and 60 (both lines included). One way of doing this is to go to line 40 and indent 21 lines:

:40
21>>

I am slightly bothered by having to enter two commands to do this. Is there a single command that lets me indent everything between two line numbers without having to compute the number of lines between the two lines?

4

See the last command mentioned here :h shift-left-right

:[range]> {count} [flags]

So for your example

:40> 21

Alternatively, if you don't want to do any arithmetic in your head:

:40,60>
| improve this answer | |
  • I didn't explain my requirement properly (edited now). What I want to do is to indent everything between two line numbers with one command and without having to calculate the number of lines between the two line numbers. – user1124109 Dec 24 '19 at 19:32
  • The command signature says [range] so put the line range there. I updated my answer. – B Layer Dec 24 '19 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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