[NCLUG] Looking at programming languages...

Chad Perrin perrin at apotheon.com
Fri Jan 18 18:42:16 MST 2008


On Thu, Jan 17, 2008 at 11:03:49AM -0700, Stephen Warrren wrote:
> 
> <rant>
> Indent with spaces. It solves all your problems with TABs, and lets you
> configure your editor's definition of TABs to match the correct
> 8-character definition.
> 
> If you don't indent with spaces, you'll find your indentation is screwed
> when somebody else has a different setting for TAB width (like perhaps the
> correct one), or they print your code, etc.
> </rant>

By the way . . .

I use Vim.  When hitting Enter with autoindent turned on, if I have an
indentation of eight or more spaces, it turns the first eight spaces into
a tab.  The common means of getting around this is to use the expandtab
feature, which causes Vim to turn all tabs into spaces, thus undoing the
damage.

This is not good enough.  There are times I need a tab, and when I
explicitly use the tab key (or hit enter after a line where I've
explicitly used the tab key), I damned well expect there to be a tab.
Sometimes, I need this in files where I might be using more than eight
spaces in a row, too -- so just remembering to turn expandtab on or off
as needed is a huge pain in the butt.

Is there some way to make Vim behave sanely in this regard that has
escaped my attention?

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Kent Beck: "I always knew that one day Smalltalk would replace Java.  I
just didn't know it would be called Ruby."



More information about the NCLUG mailing list