🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #2840

Re: Altering indentation of C code in vi

#2840
From: Leslie Mikesell
Date: Wed, 19 Jun 1991 19:02
26 lines
1566 bytes
In article <2744@root44.co.uk> gwc@root.co.uk (Geoff Clare) writes:
>[I changed the subject line, as "vi and emacs" doesn't seem appropriate
>any more].

Actually, lots of good things come out of the vi vs. emacs discussions
once they get down to the nitty-gritty.

>>... what do you do when you
>>add or delete a loop surrounding existing code and want the indentation
>>fixed?.   I usually just pipe through cb.

>Place the cursor on the opening { or closing } of the block and use >%
>to increase indentation (by the current shiftwidth setting) or <% to
>decrease it.

Works great, thanks!  You do have to remember to shift left *before*
deleting the braces and to put your new outside loop code and braces
one shiftwidth to the left because the right shift will take those
lines along with the inner code.

I'll probably continue to use cb for larger changes, though, because
it will do many levels at once and I can tell at a glance afterwards
if there are mismatched braces anywhere.

Les Mikesell
  les@chinet.chi.il.us
Technical Details
Message-ID: <1991Jun19.190248.21767@chinet.chi.il.us>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!midway!clout!chinet!les
References: <1148@iris.mincom.oz.au> <1991Jun11.203851.26928@chinet.chi.il.us> <2744@root44.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!midway!clout!chinet!les
From: les@chinet.chi.il.us (Leslie Mikesell)
Newsgroups: comp.editors
Subject: Re: Altering indentation of C code in vi
Keywords: vi C indent
Message-ID: <1991Jun19.190248.21767@chinet.chi.il.us>
Date: 19 Jun 91 19:02:48 GMT
References: <1148@iris.mincom.oz.au> <1991Jun11.203851.26928@chinet.chi.il.us> <2744@root44.co.uk>
Distribution: comp
Organization: Chinet - Chicago Public Access UNIX
Lines: 26