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?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---