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

Re: [OT] CVS diff: hard vs. soft tabs



Nori Heikkinen wrote:
hey all,

this is kind of off-topic, but i figured this is the community most
likley to have dealt with this sort of thing in the past, and be
opinionated about it.

i've been editing a lot of code over the past few months that was
originally saved to disk with hard tabs for indenting.  i can't work
with hard tabs, and so managed to reformat the entire thing to use
spaces (basically a "s,^I,  ," iirc) before i began my massive
overhaul of this file.

now it's time to check it into CVS.  i don't want every single line to
show up as different just because of tab characters, so i need to find
a good solution on how to transform my indents back into tab
characters.  clearly the reverse -- "s,  ,^I," -- won't just work, as
there are places where two spaces exist that i wouldn't want a tab.

is there some way to open the file in emacs (in which i assumer it was
originally written; i use vim) and run it through a re-indentder with
hard tabs on?  or could i do this in vim?

suggestions & opinions welcome.  thanks a lot,

</nori>


You could probably write a quick script that will eliminate all leading
spaces on every line.  Once that is done, just run it through indent.

man indent shows that there are tons options that will let you tune the
look of your source file.

HTH,

-Roberto

Attachment: pgphTqq1iFzJR.pgp
Description: PGP signature


Reply to: