mapleoin's Vim tips #1

Here’s this week’s vim tips:


Let’s break that. If you’ve ever read any kind of vim tutorial, you’re probably familiar with it’s recording feature (otherwise do this: :h recording NOW GODAMMIT!). So we first choose a letter for our recording (i chose u). Afterwards, we go into VISUAL MODE (v), then we select a(a) word(w) and uppercase(gU) it (You could also lowercase it by using gu instead). So now, that we’ve stored our magic in the u key, we can use it on any word with @u.


For people who can’t be bothered to install those cool plugins on their blog (or make their own) – now you have a way to output all the html+formatting with this plugin. It’s got cool options to use your own css :h TOhtml . Here’s a sneakpeek:

  1 #!ruby
  2 #!/usr/local/bin/ruby -rubygems
  3 require camping
  4 require feed-normalizer
  5 require open-uri
  7 Camping.goes :Planet
  9 module Planet::Controllers
 11   # Yay!
 12   class Index < R /
 13     def get
 14       render :index 
 15     end
 16   end
 17 end

There’s a wonderful way to indent many lines and then unindent them in vim. You can select a block in vim (like a rectangle) by using the visual block mode. Press Ctrl-v. Now you can delete that or if you’d rather, you can replace it with zeroes by doing r0. To indent a block you would go to the first character on the line, get into visual block mode, and press j until you’ve selected all your desired lines. Now comes the magic: press I (that’s an uppercase i) and your desired indenting or number of zeroes if that’s what you like and then escape. You can thank me for the enlightening now.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.