On Tue, 1 Mar 2016, Nicola wrote:
On 2016-03-01 15:35:07 +0000, Aditya Mahajan said:
On Tue, 1 Mar 2016, Nicola wrote:
I'm using the latest beta, and I need syntax coloring for SQL
(PostgreSQL variant). According to the wiki, there is no SQL
syntax coloring available for MKIV yet, but I'd be happy to
be wrong :)
You can use the vim module:
https://github.com/adityam/filter/blob/master/vim-README.md
That's a pretty impressive module, thanks! I didn't know about it.
I have a couple of questions:
1) Vim's SQL highlighting is a bit peculiar, in that a user is allowed to
set
a SQL dialect (:h sql-dialects) with SQLSetType or by setting
g:sql_type_default or b:sql_type_override. For example, the effect of
putting
let g:sql_type_default='pgsql'
in my vimrc is that, when a sql buffer is created, Vim searches for
syntax/pgsql.vim instead of the default syntax file (sqloracle.vim, I
think).
Note that the filetype remains 'sql'. I have tried to set a SQL dialect
inside
a \startvimrc/\stopvimrc block, but without success (if that matters, I
have
this plugin in my ~/.vim folder: https://github.com/lifepillar/pgsql.vim).
I have also tried \definevimtyping[SQL][syntax=pgsql], but then I don't get
any highlighting, which makes me think that the module does not search my
~/.vim folder. Does the module work only with syntaxes in core Vim?
I do not load the default vimrc, because that drastically slows down the
module. Instead, there is an option to create a specific vimrc using:
\startvimrc[name=pgsql]
let g:sql_type_default='pgsql'
\stopvimrc
and then
\definevimtyping[SQL][..., vimrc=pgsql, ...]
By default, the script searches everything in `runtimepath`. If your local
vim folder is not in runtimepath, you can set the runtimepath in the vimrc
above.
2) Are pscolor and blackandwhite the only possibilities to customize the
colors? This is important, I need the syntax highlighting to match my
document's colors.
It is relatively easy to tune the color scheme. See, for example how
pscolor is defined:
https://github.com/adityam/filter/blob/cc9d9017bfdd7fe0d67b4723570e960ec6c52e43/t-vim.tex#L280
You can create similar mappings for your favorite color scheme (It does
require a bit of knowledge of vim syntax groups).
Finally, your Readme tells to use \definevimtyping[...][...], but I have
found
that I need to use put all the options together: \defienvimtyping[...].
What I mean is \definevimtyping[SQL][numbering=on], etc.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________