[gentoo-user] [OT] vim c syntax

2006-04-13 Thread Dan LaMotte
really simple problem, but quite annoying.

% vim --version
VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Jan 12 2006 12:36:23)

i am editing a C file and this is the problem i'm having:

in vim i have   set ts=4   to make my tabs 4 spaces instead of 8. I
really dislike 8 spaces for tabs. anyways...

i type in vim

void main ( void )
{enter
int c;

The enter autoindent indents it 8 spaces ?!?
my tabstop is 4 though !

I want this

void main ( void )
{enter
int c;

If anyone knows how to fix this or if its like a bug or something...
that'd be great.

thanks.

-- 
# - dan lamotte -- lamotte {at} cs.umn.edu - #
## - systems staff -  - uofm -  - cs department - 
### fpr: 690F C162 4AE5 F85F FE94 88E5 D123 FBAC 0852 A280 ###
-- 
gentoo-user@gentoo.org mailing list



[gentoo-user] [OT] vim c syntax

2006-04-13 Thread Dan LaMotte
really simple problem, but quite annoying.

% vim --version
VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Jan 12 2006 12:36:23)

i am editing a C file and this is the problem i'm having:

in vim i have   set ts=4   to make my tabs 4 spaces instead of 8. I
really dislike 8 spaces for tabs. anyways...

i type in vim

void main ( void )
{enter
int c;

The enter autoindent indents it 8 spaces ?!?
my tabstop is 4 though !

I want this

void main ( void )
{enter
int c;

If anyone knows how to fix this or if its like a bug or something...
that'd be great.

thanks.

-- 
# - dan lamotte -- lamotte {at} cs.umn.edu - #
## - systems staff -  - uofm -  - cs department - 
### fpr: 690F C162 4AE5 F85F FE94 88E5 D123 FBAC 0852 A280 ###

-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] [OT] vim c syntax

2006-04-13 Thread Kevin O'Gorman
You probably want something like this in your .vimrc:

set expandtab
set
tabstop=8 
ts, number of spaces that a tab *in the original file* is

equivalent to 
set softtabstop=4  how much a tab *that you type* is worth
set shiftwidth=4  sw, number of spaces shifted left and right when issuing

  commands
set autoindent
set smartindent

YMMV

++ kevinOn 4/13/06, Dan LaMotte [EMAIL PROTECTED] wrote:
really simple problem, but quite annoying.% vim --versionVIM - Vi IMproved 6.4 (2005 Oct 15, compiled Jan 12 2006 12:36:23)i am editing a C file and this is the problem i'm having:in vim i have set ts=4 to make my tabs 4 spaces instead of 8. I
really dislike 8 spaces for tabs. anyways...i type in vimvoid main ( void ){enterint c;The enter autoindent indents it 8 spaces ?!?my tabstop is 4 though !
I want thisvoid main ( void ){enterint c;If anyone knows how to fix this or if its like a bug or something...that'd be great.thanks.--# - dan lamotte -- lamotte {at} 
cs.umn.edu - ### - systems staff -- uofm -- cs department - ### fpr: 690F C162 4AE5 F85F FE94 88E5 D123 FBAC 0852 A280 ###--
gentoo-user@gentoo.org mailing list-- Kevin O'Gorman, PhD


Space v. Tabs (was: Re: [gentoo-user] [OT] vim c syntax)

2006-04-13 Thread Boyd Stephen Smith Jr.
On Thursday 13 April 2006 11:01, Kevin O'Gorman [EMAIL PROTECTED] 
wrote about 'Re: [gentoo-user] [OT] vim c syntax':
 set expandtab

Converting tabs to spaces or vice-versa automatically is evil.  They have 
distinct uses so just don't do it.

Tabs are used to indicate separate levels of text where items are or can 
be nested and are appropriate for use in tables of contents (subsection 
titles have one more tab than section titles, section titles have one more 
tab than chapter titles, etc.), lists (numbered or bulletted), block 
quotation (imagine quoting an article that had quoted a speech), and the 
nested block structure of many programming languages.

In addition their the language-specific roles, spaces are used to align 
arbitrary text, tabs alone are inappropriate because of the varying tab 
settings on varying computers.  Even if 8 spaces was some kind of 
standard, it makes very little sense in non-fixed-width fonts, and trying 
to force end-user behavior is both arrogant and doomed to failure.  
(That's not what standards are about anyway -- standards give the 
end-user/consumer MORE choice by forcing programmer/producer OUTPUT to be 
interchangeable.)

Tabs and spaces together can also be used for alignment, and when done 
properly the output changes based on the end-users preferences but looks 
good independent of those preferences.  How this is done is left as an 
exercise to the reader.

Tabs w/o spaces can only be used for alignment when the file format you are 
dealing with allows you to embed information about what tab-stops you are 
using.  (Thus, ignoring the users' preferences entirely.)

 set shiftwidth=4 sw, number of spaces shifted left and right

This is all the OP needed to get the behavior he wanted.

For completeness, here's the relevant lines of my .vimrc:
set ts=2  Small tabs
set sw=2  Matching shift width
set list  Visible tabs

set ai  Auto-indent
set si  Smart indent
(I like my tabs /tiny/.)

-- 
If there's one thing we've established over the years,
it's that the vast majority of our users don't have the slightest
clue what's best for them in terms of package stability.
-- Gentoo Developer Ciaran McCreesh


pgpSjSvg1ugzG.pgp
Description: PGP signature