On 17/07/09 16:22, Linda W wrote:
>
> 01234567890123456789012345678901234567890123456789012345678901234567890123456789
> After changing tab stops and "expandtabs", one can retab to "reformat"
> the text according to the new tabsettings. There is also the "gq" option
> that will reformat text according to changed text options.
>
> I was wondering if there was a way to do the same according to a change
> of the 'syntax'.
>
> I read in a file of txt that has 1-64K line of text of of what I
> discovered was 'css-code'. I set syntax=css -- and it dutifully went
> through and colored the syntax, but it's still all one line. There are,
> also, several close curly brackets highlighted in red, though I don't
> know if these are real errors or just some confusion of the syntax
> coloring because of the lack of new lines.
>
> Nevertheless, is there anything like a 'resyn' option or is the
> only thing to rely on would be 'gq' and to manually search for, or find
> and external program for the given syntax, and manually setup up its
> options each time you change syntax.
>
> I'm not even sure how well that would work -- as one problem with
> 'syn' is there are many cases where the syntax isn't constant within
> one file. I suppose for those sections one could simply leave them
> unformatted (unless they were strongly related (like CSS in HTML).
> But parsing syntax of different languages embedded within other
> language files would be a neat option (will talk about that in another
> email to not confuse this issue) -- which is the desire to
> reformat a section of text according to new syntax rules.
>
> Thanks,
> -linda
If you have used ":filetype indent on" (with or without "plugin"),
gq{motion} or gq{object} will, IIUC, reindent the text moved over or the
object. Or even if you have ":filetype indent off", your 'cindent' and
'cinoptions', or 'indentexpr', settings will come into play if you've
set them.
I'm not sure what happens if there are regions with a different syntax,
like CSS or Javascript within HTML, or python or scheme within vimscript
-- or even here-documents within vimscript (with interpreter
interfacing) or shell script. I suppose experiment will tell. I suppose
a sufficiently complex 'indentexpr' could handle even that, but I don't
know what the standard indent plugins set that option to.
Best regards,
Tony.
--
A lack of leadership is no substitute for inaction.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---