Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!iris.mincom.oz.au!lattice From: lattice@iris.mincom.oz.au (Lattice) Newsgroups: comp.editors Subject: Re: vi and emacs Summary: indent altered (not new) code Keywords: vi emacs Message-ID: <1152@iris.mincom.oz.au> Date: 14 Jun 91 03:27:31 GMT References: <1991Jun1.021505.4043@trl.oz.au> <1991Jun03.151727.9944@chinet.chi.il.us> <1148@iris.mincom.oz.au> <1991Jun11.203851.26928@chinet.chi.il.us> Reply-To: lattice@iris.mincom.oz.au () Distribution: comp Organization: Mincom, Brisbane, Australia Lines: 21 In article <1991Jun11.203851.26928@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >> 1. There is no need to use an external program for indentation - >> vi has an autoindent mode, invoked using >> :set autoindent > >That's fine for typing entirely new code, but 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. > In this case I would normally mark the top and bottom of the altered block and use the indent/undent option '>'/'<' respectively, i.e., /* mark the top and bottom of the block as a and b */ :'a, 'b < (or >) I must admit though to having encountered some difficulty with this method when the tabstops value is set to something other than a full tab. Still it can be quite adequate. mark stavar