My Introduction
Adam has kindly let me post here, and it’s only fitting that I use my first post to introduce myself. I’m Johannes Sasongko, I live in Brisbane, Australia, and I’m currently studying for my IT degree. I’m involved in a few open-source projects at the moment: Ruby.NET (as tester), Exaile (as programmer), and K-Meleon (as bug triager / BTS cleaner, though the quality of the recent versions has left me with little work).
Following Adam, and in the spirit of this site’s domain name, I will of course post Vim tips after my posts. And since this is his blog, I’ll be writing about things that he would be interested in. I have little interest in leaving ‘Web-space junk’ anyways; the signal-to-noise ratio of the ‘Net is already bad as it is.
vim tip: Indentation
Vim has a few settings you can use to configure the indentation of your
code. expandtab
(et
) is a boolean setting that does
what it says, it specifies whether to expand tabs into spaces; set
noexpandtab
(noet
) to disable it.
tabstop
(ts
) specifies how wide tabs characters are
displayed. softtabstop
(sts
) specifies the
‘virtual tabstop’, the tabstop that you feel when you press Tab or
Backspace. shiftwidth
(sw
) specifies the indentation
applied when using autoindent (e.g. the line after an if statement will get
indented by this amount).
For example, while working with Exaile, you have to :set et sts=4
sw=4
because Exaile always uses four spaces for indentation. However,
while editing a makefile you would normally set noet
and use the
same number for ts
, sts
, and sw
.
Restored from VimTips archive
This article was restored from the VimTips archive. There's probably missing images and broken links (and even some flash references), but it was still important to me to bring them back.