Thread (95 messages) flat view 95 messages, 33 authors, 2016-06-15

Re: On Tabs and Spaces

From: David <hidden>
Date: 2016-06-15 22:43:42

On 10/16/07, Petr Baudis [off-list ref] wrote:
On Tue, Oct 16, 2007 at 07:40:26PM +0200, Sam Ravnborg wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help