Nikolai Weibull wrote:

> OK, so it turns out, after having to go to the source, that the
> 'include' pattern only gets fed one line at a time.  For the DTD
> filetype, having multiple lines would be nice, as that would allow you
> to do the following:
> 
> setlocal 
> include=<!ENTITY\\_s\\+%\\_s\\+\\(\\S\\+\\)\\_s\\+\\%(PUBLIC\\_s\\+\\%(\"[^\"]\\+\"\\\|'[^']\\+'\\)\\\|SYSTEM\\)\\_s\\+\\zs\\%(\"[^\"]\\+\"\\\|'[^']\\+'\\)\\ze\\_s*>\\_.*%\\1;
> setlocal 
> includeexpr=substitute(v:fname,'^\\%(\"\\(.*\\)\"\\\|''\\(.*\\)''\\)$','\\1\\2','')
> 
> However, as stated, that doesn't work (unless 'include' actually
> matches on one line, which it rarely does), as you mostly write
> 
> <!ENTITY % blah
>   PUBLIC
>     "URL"
>     "file">
> %blah;
> 
> I did solve this by doing the following instead:
> 
> setlocal include=^\\s*%\\zs.*\\ze;\\s*$
> setlocal includeexpr=DTDIncludeExpr()
> 
> function! DTDIncludeExpr()
>   let saved_pos = getpos('.')
>   let [lnum, col] = searchpos('<!ENTITY\_s\+%\_s\+' . v:fname .
> '\_s\+\%(PUBLIC\_s\+\%("[^"]\+"\|''[^'']\+''\)\|SYSTEM\)\_s\+\zs\%("[^"]\+"\|''[^'']\+''\)\ze\_s*>')
>   if lnum == 0
>     return ""
>   endif
>   call setpos('.', saved_pos)
> 
>   return strpart(getline(lnum), col, col + strlen(v:fname) + 1)
> endfunction
> 
> But that's a bit bugged, as it doesn't take into account any ranges.
> 
> Suggestions welcome; allowing multi-line matches for 'include' would
> be even more welcome.
> 
> Second, the documentation states that changing 'isident' is more or
> less dangerous.  For DTDs, matching identifiers would be a lot better
> if one was allowed to set 'isident' to include things such as '-' and
> '.', as they are often used in identifiers in DTDs.  The documentation
> states that 'isident' is used for environment variables.  Why?  Why is
> 'isident' used for environment variables, for matching after a match
> to 'define', and for '\i' in patterns?  I can see why the two latter
> should use 'isident', but why environment variables?

There are a few options like 'isident' and 'iskeyword' that are used in
several places.  Setting them to have an effect in one place has the
side effect of changing things in other places.  I've been thinking of
splitting them up to have effect in only one place, but implementation
is quite a bit of work.  A good example is the use of 'iskeyword' for
syntax HL only.  We would need to have 'issynkeyword' for that.

-- 
If I tell you "you have a beautiful body", would you hold it against me?

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui