ruby on rails - What's the most efficient way to modify multiple lines of text in Vim? -


this question has answer here:

let's have text file called index.html.slim looks this:

- if post.published?     section.post     h1 = post.title     p = post.description     = link_to 'read more', post 

what i'd indent last 3 lines file looks this:

- if post.published?     section.post       h1 = post.title       p = post.description       = link_to 'read more', post 

what's efficient way in vim?

right go line 3 3 return, i enter insert mode, spacebar twice indent 2 characters , esc exit insert mode. on line 4 , 5 move down j , press . followed , wq save.

that's total of 10 keystrokes. i'm sure there's better way accomplish this; however, i'm not sure best method is.

one way select column , insert 2 spaces last 3 lines.

  • move cursor character h.
  • press ctrl+v change selection mode
  • move cursor 2 down using j twice
  • press i (capital i) change insert mode
  • now press space twice , hit esc , press other key j, should it.

Comments