From: David Date: Wed, 17 Oct 2007 03:41:34 GMT Subject: Re: On Tabs and Spaces Message-ID: <402731c90710162041q457c7dd3tf906ba0c6faf29ca@mail.gmail.com> In-Reply-To: <20071016230952.GA18099@machine.or.cz> On 10/16/07, Petr Baudis wrote: > On Tue, Oct 16, 2007 at 07:40:26PM +0200, Sam Ravnborg wrote: > > Tabs should be used for indent and not general alignment. > > > > Consider: > > if (some long condition that > > ....&& spans two lines) { > > my_private_printf("bla bla bla" > > .................."more bla bla\n"); > > } > > > > This will look good and align "more bla bla\n" as > > intended no matter your tab setting. > > But replacing the 8 spaces with a tab will > > cause it to look bad. > > I'd so much love to have this and sometimes do this even manually, but > does anyone have an idea how to make vim do this for me? I never got > around to investigate this in depth or possibly make a patch... > > -- > Petr "Pasky" Baudis > Early to rise and early to bed makes a male healthy and wealthy and dead. > -- James Thurber Hello I use both vim and emacs so I must be weird. Anyways, here's some useful vim settings that I've come across: set tabstop=8 set softtabstop=8 set shiftwidth=8 set noexpandtab set list set listchars=:.\ The last two are extremely useful, especially if you're hacking on python. That's listchars=(less-than)tab(greater-than)(colon)(dot)(backslash)(space) (don't forget the space!). That makes vim display tabs with a "." indicator, so you have a very clear view of when tabs are in use. This has helped me countless times. You can use any character in there instead of dot. I actually use an extended ascii character since it looks nicer but I didn't want to risk email mangling it. -- David