# quick vim question



## UNIXgod (Jun 17, 2011)

How do I take a visual selected block and move it over two spaces

example:


```
module WordProcessor

module Rendering
  DEFAULT_FONT = Font.new( 'default')
  DEFAULT_PAPER_SIZE = PaperSize.new
end

end
```

if I select the area beginning with _module rendering_ and it's associated _end_ to look like this:

```
module WordProcessor

  module Rendering
    DEFAULT_FONT = Font.new( 'default')
    DEFAULT_PAPER_SIZE = PaperSize.new
  end

end
```


----------



## carlton_draught (Jun 18, 2011)

Get your cursor on the "m" in "module Rendering".
<CTRL>-v         (Note that this will select a VISUAL BLOCK as opposed to a VISUAL LINE)
j
j
j
I
<SPACE>
<SPACE> 
<ESCAPE>
j

If you have trouble figuring out why that works, let me know. The spaces could be any characters you wanted to put in front of the visual block. E.g. substitute a "#" to comment out a block. And use "x" instead of the "I" to delete something, e.g. the comment characters you have just highlighted.

Gotta love vim. Where text editing is concerned, it is a man among boys. Here is a link to the vim theme song.


----------



## Oxyd (Jun 18, 2011)

If you already have the block selected, just press >. That will shift the selection _shiftwidth_ characters to the right. See :help > for more info.


----------



## UNIXgod (Jun 18, 2011)

Thanks!!!

Both of you made my day. Both tips are great!


----------



## SirDice (Jun 20, 2011)

Without using blocks you can also use:


```
<ESC> <ESC>  # Make sure we're in command mode
I            # That's shift-I ; insert at the beginning of the line
<tab>        # Inserts a tab character
<ESC>        # Back to command mode
.            # The dot key (.) will repeat the last commands: Shift-I; <TAB> ; <ESC>
```


----------

