98884Re: Reduced functionality (FASTER) xml syntax file?
- Dec 1, 2008Thanks David, an innovative solution.
I'm not quite sure what I'm doing wrong but the function isn't doing
anything for me though.
It prints out a decrementing status of how many lines are left to format,
so it seems to be working, but nothing gets formatted.
I suspected it was because I had tw=0 but setting it to 60 didn't help.
Any easy ideas? Otherwise, the synmaxcol suggestion may well be
(I could send you debug output - scriptnames, or other things - but I
don't want to waste you time unless you're keen.)
Thanks very much anyway,
On Tue, 02 Dec 2008 06:44:33 +1100, David Fishburn
> This is a simple work around that seems to keep things moving for me.
> I define the following in my vimrc.
> function! Format_SGML() range
> " Add a new line to the bottom of the mark to be removed later
> call cursor(a:lastline,1)
> put =''
> silent! exec "ma z"
> " Add a new line above the mark to be removed later
> call cursor(a:firstline,1)
> put! = ''
> silent! exec "ma y"
> " Record current filetype
> let save_ft = &filetype
> if save_ft != 'xml'
> " Change the filetype so we can format the selection
> setlocal filetype=xml
> " Put each tag on a newline
> exec line("'y").','.line("'z").'s/>\s*</>\r</ge'
> " Reformat using Vim's indenter
> call cursor(line("'y"),1)
> exec 'normal! '.(line("'z")-line("'y")+1).'=='
> if save_ft != 'xml'
> " Restore the filetype
> exec 'setlocal filetype='.save_ft
> " Delete the additional lines added
> silent! exe "norm! 'ydd'zdd"
> command! -range=% -nargs=0 FormatSGML <line1>,<line2>call Format_SGML()
> Then each time I open the file I run:
> It seems when the lines are shorter, the highlighting is quick.
> On 12/1/08, Gene Kwiecinski <gkwiecinski@...> wrote:
>>> was so slow. Disabling syntax highlighting proved to solve the problem
>>> but I was wondering, has anyone else hit this problem, and perhaps
>>> a reduced functionality xml syntax highlighter - so I still get
>>> useful, but maybe not quite as complex?
>> One person's opinion of what constitutes "stripped down" would likely
>> differ from someone else's opinion, which is the problem. Eg, you might
>> be happy with just tagstoff being one color, and textstoff being a
>> different color. Someone else might want attributes to be a 3rd color.
>> Someone else would make comments a different color. Before you know it,
>> you'd have a "stripped down" syntax file that's maybe 80% of the
>> original, not saving much.
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic Next post in topic >>