Editor Tab Expansion

Jim Greer jgreer@midsouth.rr.com
Fri, 3 Jan 2003 11:51:30 -0600


Greets -

[ Better late than never. ]
Ran across this thread while perusing list trying to figure out whether
to join or not.  In the interest of sharing info with the great
collective unconscious (i.e. Internet), thought I'd include part of my
.vimrc so that Vim users (and others considering the same) can see how
it handles the embedded tab/whitespace layout problems of various
languages:

  set background=dark
  syntax on
  filetype on
  set textwidth=72
  autocmd Filetype haskell set ai
  autocmd Filetype haskell set expandtab
  autocmd Filetype haskell set tabstop=8
  autocmd Filetype haskell set shiftwidth=8
  autocmd Filetype mail set ai
  autocmd Filetype mail set tabstop=4
  autocmd Filetype mail set shiftwidth=4
  autocmd Filetype ruby set ai
  autocmd Filetype ruby set tabstop=2
  autocmd Filetype ruby set shiftwidth=2

A complete ('enhanced') install of Vim includes syntax recognition for a
great number of file formats, including Haskell (apparently, haven't
done much yet).  Setting

	syntax on

manages the syntax recognition part, so that you get colorized syntax.
Setting

	filetype on

recognizes files (by extension?), so that you can use the

	autocmd FileType haskell ....

commands to tailor settings for particular filetypes.  In this case, I'm 
using expandtab and setting the tab settings to 8, as mentioned
previously.

Cordially,
Jim G

p.s. 	http://www.vim.org/

p.p.s.  I'm suprised that the *macs crowd hasn't chimed in with ways
to configure their editos^Hr to set tabs differing by day of week, phase
of moon, etc.

-- 
James B. Greer <jgreer@midsouth.rr.com> [expires: 2004-12-27]
7F49 3D20 03C6 E859 E4F9  0735 E1F9 B259 21FA 1494