Re: On Tabs and Spaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/16/07, Petr Baudis <pasky@xxxxxxx> 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:
> > <tab>if (some long condition that
> > <tab>....&& spans two lines) {
> > <tab><tab>my_private_printf("bla bla bla"
> > <tab><tab>.................."more bla bla\n");
> > <tab><tab>}
> >
> > 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=<tab>:.\

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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux