On Tue, Mar 30, 2004 at 12:11:13PM -0600, Ben Kim wrote:
> Dear vimmers,
> I'm asking this question for embedded perl but perhaps it may apply to
> jsp/asp/php as well.
> I use vim to edit embedded perl files. Embedded perl files have incomplete
> code snippets of html which is intentional (because of breaking up a page
> into several files).
> Sometimes I have to edit files with the perl code and html code all mixed
> up and difficult to follow the logic. Embperl.vim is certainly helpful,
> but it does not actually rearrange the format.
> What I want is to enforce html formatting (indenting the table tags,
> especially) without touching embedded perl parts. Is there a way? If not,
> would there be a way within vim to reindent the code, even if it means
> embedded perl codes are all in strange shapes? For example, if I opened a
> file like A:
> <th>Count </th>
> Then with some keystrokes I want to be able to make it look like B.
> Would this be possible? I'd appreciate helps.
If you only want to change the initial indent, it should be pretty
easy to modify indent/html.vim to ignore the perl parts. (Is each line
of perl code set off with square brackets?)
If, in addition, you want to break <table><tr> into two lines and
remove the space in <th>Count </th> then it would be an enormous amount
of work to do it in vim. Probably html tidy is the right way to go,
assuming it is smart enough to deal with embedded perl.
HTH --Benji Fisher