Tuesday, April 19, 2011

Building a .vimrc: tabs

Just nuked my hard drive and am explicitly pulling data back from my Time Machine as I need it. I could grab my old .vimrc, but I think I'll build a new one instead. (the old one wasn't very big.)

First things first: tabs.



" whenever I hit the tab key, it now inserts spaces instead.
set expandtab


" whenever I hit << or >>, it now indents this many spaces instead.
set shiftwidth=2


" tabstop is how many spaces a tab character looks like.
set tabstop=2



Note that if you set expandtab, and if you never open a file that already contains tab characters, you wouldn't need tabstop.

More info: http://tedlogan.com/techblog3.html

1 comment:

  1. I would advise against inserting spaces into code that was written with tabs. However, I am wholeheartedly in favor of using spaces instead of tabs for projects, and do it for all of mine.

    ReplyDelete

Note: Only a member of this blog may post a comment.