vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] Is there any easy way to change indent globally?


From: Chris Green
Subject: Re: [vile] Is there any easy way to change indent globally?
Date: Thu, 5 Apr 2012 10:37:22 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Apr 04, 2012 at 04:50:30PM -0400, Thomas Dickey wrote:
> On Wed, Apr 04, 2012 at 07:25:47PM +0100, Chris Green wrote:
> > Is there any easy way in vile/xvile to change the indenting of a file
> > that uses spaces for indenting?
> 
> yes/no: vile has the entab and entab-leading (and corresponding detab)
> commands, which can be used to alter the spaces to/from tabs (and with
> a suitable macro, change the tab-interval).
> 
> "detab-lines-til"             ^A-<space>
>   ( operator:  convert tabs to spaces in the region )
>   ( undoable, accepts range, may follow global command )
> "entab-lines-til"             ^A-^I
>   ( operator:  convert spaces to tabs where possible in the region )
>   ( undoable, accepts range, may follow global command )
> "leading-detab-lines-til"     ^X-<space>
>   ( operator:  convert leading tabs to spaces in the region )
>   ( undoable, accepts range, may follow global command )
> "leading-entab-lines-til"     ^X-^I
>   ( operator:  convert leading spaces to tabs where possible in the region )
>   ( undoable, accepts range, may follow global command )
> 
> I've used that, though not so much recently.  Over the past 10-12 years I've
> mostly used some external indent program, combined with a script to let me
> preview the changes and tweak the line-breaks.
> 
> Generally leading-entab is safer as I recall, since the plain entab doesn't
> know about quoted strings in C, etc.
> 
Of course, change spaces to tabs, change the tabstop and then change
tabs back to spaces.

I also in general use an external program (astyle) but I was just stuck
staring at some PHP code that was too wide and needed a way to reduce
the indentation a bit while I looked at it.

-- 
Chris Green



reply via email to

[Prev in Thread] Current Thread [Next in Thread]