[NCLUG] Looking at programming languages...

Bob Proulx bob at proulx.com
Fri Jan 18 20:32:09 MST 2008


Chad Perrin wrote:
> 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.

I hate the expandtab misfeature and so wouldn't call it damage.  Tabs
and spaces both have their place in the world.

> 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.

Quote it verbatim.

> 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?

Use the Control-V prefix to quote the next character verbatim.  The
mnemonic is 'V' for Verbatim.

  C-v TAB

In Emacs the same is accomplished with the Control-Q prefix to quote
the next character.  The mnemonic is 'Q' for Quote.

  C-q TAB

Bob



More information about the NCLUG mailing list