Tab stops (Re: [prog] C and curly braces - question of style?)
Kathryn Andersen
kat_lists at katspace.com
Fri Aug 27 08:43:57 EST 2004
On Tue, Aug 24, 2004 at 12:03:03PM -0400, John Stoneham wrote:
> > > As someone mentioned (I think it was Akkana?), though, you tend to end
> > > up with some combinations of tabs and spaces if you use
> > > auto-indentation, and vi is no exception to that rule/problem. I wish
> > > it'd pick up the characters used in the previous line and just
> > > duplicate them, but I don't think it does.
> >
> > I mentioned this but perhas someone else did too. I think vi uses tabs for
> > autoindent, and since I use tabs I haven't had this troble with vi, its other
> > editors that mix them up.
>
> It's possible to change this in vim (though old-school vi doesn't support it)
> with 'set expandtab'.
>
> Other options to check out are smartindent, cindent, smarttab.
C-indent is really useful, because it takes into account not just
indenting, but all the other things we've been talking about, like brace
style and paren style and so forth. It's worth taking a look at, even
if the options are cryptic. I set up the global vimrc at work to match
our coding standards, and that makes it easier for everyone.
I'm glad that my current work allows people to choose which editor they
use. One my previous employers mandated emacs because someone had set
up emacs settings -- ugh! No, I don't want to get into an
emacs-versus-vim religious war; I'm just glad that my current work has
"freedom of religion" in that respect, rather than a compulsory State
Religion... There are those who use emacs, and those who use vim, and we
agree to differ. I guess I'm the unofficial vim person, being the one
who tends to install it on new machines, while this other friend of mine
is the chief emacs person.
> While we're talking indents, I should share the following useful function:
>
> fun TotalFileIndent()
> let oldLine=line('.')
> normal(gg=G)
> execute ':' . oldLine
> endfun
> map -- :call TotalFileIndent()<cr>
Cool!
I admit I haven't gone as far as writing vim functions; it tends to work
well enough for me as it is.
Kathryn Andersen
-=-=-=-=-=-=-=-=-
Tarvin: Have you forgotten Zolaf Four?
Jenna: Is it worth remembering?
Tarvin: Just the two of us in the mountains.
Jenna: And three hundred customs guards.
Tarvin: You saved my life.
Jenna: We all make mistakes. (Blake's 7: Bounty [A11])
--
_--_|\ | Kathryn Andersen <http://www.katspace.com>
/ \ |
\_.--.*/ | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
v |
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha! | -> Earth -> Sol -> Milky Way Galaxy -> Universe
More information about the Programming
mailing list