On 2016-01-08 21:48:22 +0000, David Fishburn said:
> So, for example, the default syntax file
> (sqloracle.vim) links sqlKeyword to sqlSpecial, while I would want to link
> it to a different highlight group (and, of course, still let the user
> override the plugin's choice).
>
> That shouldn't happen.
Thanks for your detailed answer. I followed your steps and you are right,
syntax group are reset. The issue is with highlight groups, though.
In my PostgreSQL syntax file I set, among the rest:
HiLink sqlKeyword Keyword
where HiLink has the usual definition:
command -nargs=+ HiLink hi def link <args>
The problem is that HiLink does not override an existing highlight group
definition. So, if sqloracle.vim is loaded first and it defines
HiLink sqlKeyword sqlSpecial
then `:SQLSetType pgsql.vim` does not change that. To test:
1. Open a SQL document.
2. :hi sqlKeyword
sqlKeyword xxx links to sqlSpecial
3. hi def link sqlKeyword Keyword
2. :hi sqlKeyword
sqlKeyword xxx links to sqlSpecial
It still links to sqlSpecial. I don't want to use hi! because users
would not (easily) be able to override syntax colors in their vimrc.
That's why I was asking:
> Is there a way to have the dialect be loaded directly without requiring
> the use to set g:sql_type_default?
> Is pgsql not a good choice as a default for you?
Yes, for me it is. But, in the perspective of making my plugin available
to a general audience, I can imagine a situation where a user would want
to use it only for files with a .pgsql extension and not for .sql files.
Besides, the issue described above may exist with other dialects.
How about introducing a buffer local b:sql_type_default? Your plugin
might check whether such a variable exists and, if it does, load the
corresponding file. In a dialect plugin one would then define:
au BufNewFile,BufRead *.pgsql let b:sql_type_default='pgsql' | setfiletype sql
Nicola
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Saturday, January 9, 2016
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment