It depends upon the editor that you are using.
As a matter of practicality, rather than religious philosophy, I would recommend choosing one and getting very comfortable with it.
If you have to struggle a bit in other editors, it's probably okay: from my own anecdotal evidence, this gives you the best value for time spent.
That's all a bit of an aside, of course.
In gedit, you should be able to highlight the desired block and hit Tab
to indent the block.
Shift+Tab
should dedent blocks as well.
You might have to fiddle with preferences to get this working.
This is a pretty common way for graphical editors to handle this (some IDEs do it too).
In vim, the way I like to do this is to set shiftwidth
equal to my tabstop
at four spaces with :set shiftwidth=4 tabstop=4 expandtab
You can then indent or dedent blocks by selecting them in visual or visual line mode (V
or Shift+V
), and typing <<
or >>
.
One of the nice things about this is that it has a very intuitive feel, like you are drawing arrows to indent or dedent.