* Custom syntax highlighting @ 2016-03-01 15:26 Nicola 2016-03-01 15:35 ` Aditya Mahajan 2016-03-01 21:53 ` Hans Hagen 0 siblings, 2 replies; 19+ messages in thread From: Nicola @ 2016-03-01 15:26 UTC (permalink / raw) To: ntg-context 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 :) If I am not wrong, I'd like to write my own syntax file, but not starting from scratch. I cannot find any pret-* files in the beta, though. Should they be downloaded separately? Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-01 15:26 Custom syntax highlighting Nicola @ 2016-03-01 15:35 ` Aditya Mahajan 2016-03-01 18:14 ` Nicola 2016-03-02 18:21 ` Nicola 2016-03-01 21:53 ` Hans Hagen 1 sibling, 2 replies; 19+ messages in thread From: Aditya Mahajan @ 2016-03-01 15:35 UTC (permalink / raw) To: mailing list for ConTeXt users 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 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-01 15:35 ` Aditya Mahajan @ 2016-03-01 18:14 ` Nicola 2016-03-02 2:14 ` Aditya Mahajan 2016-03-02 18:21 ` Nicola 1 sibling, 1 reply; 19+ messages in thread From: Nicola @ 2016-03-01 18:14 UTC (permalink / raw) To: ntg-context 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? 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. Finally, your Readme tells to use \definevimtyping[...][...], but I have found that I need to use put all the options together: \defienvimtyping[...]. Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-01 18:14 ` Nicola @ 2016-03-02 2:14 ` Aditya Mahajan 2016-03-02 8:46 ` Nicola 2016-03-02 11:06 ` Nicola 0 siblings, 2 replies; 19+ messages in thread From: Aditya Mahajan @ 2016-03-02 2:14 UTC (permalink / raw) To: mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 2:14 ` Aditya Mahajan @ 2016-03-02 8:46 ` Nicola 2016-03-02 14:45 ` Aditya Mahajan 2016-03-02 11:06 ` Nicola 1 sibling, 1 reply; 19+ messages in thread From: Nicola @ 2016-03-02 8:46 UTC (permalink / raw) To: ntg-context On 2016-03-02 02:14:33 +0000, Aditya Mahajan said: > > I do not load the default vimrc, because that drastically slows down the > module. That makes sense. So, Vim is run with something like `vim -u NONE`, I guess. > 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. I had to set both runtimepath and nocompatible. Maybe this should be noted in the docs, or the module could run `vim -u NONE -N` (who needs compatible nowadays?). So, for future reference, this works: \startvimrc[name=pgsql] set nocompatible set runtimepath+=~/.vim/bundle/pgsql let g:sql_type_default='pgsql' % ... \stopvimrc > >> 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). Perfect, thanks! >> 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. Ops, dumb oversight on my part. Thanks for your help and your amazing module, Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 8:46 ` Nicola @ 2016-03-02 14:45 ` Aditya Mahajan 2016-03-02 15:23 ` Nicola 0 siblings, 1 reply; 19+ messages in thread From: Aditya Mahajan @ 2016-03-02 14:45 UTC (permalink / raw) To: mailing list for ConTeXt users On Wed, 2 Mar 2016, Nicola wrote: > On 2016-03-02 02:14:33 +0000, Aditya Mahajan said: >> >> I do not load the default vimrc, because that drastically slows down the >> module. > > That makes sense. So, Vim is run with something like `vim -u NONE`, I > guess. Yes. And if the vimrc option is used, then it is saved on file, and vim -u \vimrc_filename is run. >> 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. > > I had to set both runtimepath and nocompatible. Maybe this should be noted > in the docs, or the module could run `vim -u NONE -N` (who needs compatible > nowadays?). So, for future reference, this works: I explicitly set compatible (but I don't remember why I did that anymore). This is the full command that is run: \def\vimtyping@filter_command {vim -u \vimrc_filename\space % read global config file % --startuptime log % -V3log -X % dont connect to X server -i NONE % dont use viminfo file --noplugin % dont load plugins -e % run in ex mode -s % silent -C % set compatible -n % no swap file -c "syntax manual" % don't load filetype detection -c "set syntax=\externalfilterparameter\c!syntax" % -c "set tabstop=\externalfilterparameter\c!tab" % % vim only accepts 10 -c commands, so we combine a few let statements -c "let contextstartline=\externalfilterparameter\c!start \letterbar\space % let contextstopline=\externalfilterparameter\c!stop \letterbar\space % let strip=\getvalue{\vimtyping@id-\c!strip-\externalfilterparameter\c!strip}" % -c "let escapecomments=\getvalue{\vimtyping@id-\c!escape-\externalfilterparameter\c!escape}" % -c "let highlight=[\externalfilterparameter\c!highlight]" % \vimrc_extras\space -c "source \vimtyping@script_name" % -c "qa" % \externalfilterinputfile\space \externalfilteroutputfile} I'll run my test suite with -N instead of -C. If everything works, I'll change to -N. > \startvimrc[name=pgsql] > set nocompatible > set runtimepath+=~/.vim/bundle/pgsql > let g:sql_type_default='pgsql' > % ... > \stopvimrc I will add a note to the docs about runtimepath. When I wrote the module, bundle was not popular, but it is the default now. 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 14:45 ` Aditya Mahajan @ 2016-03-02 15:23 ` Nicola 0 siblings, 0 replies; 19+ messages in thread From: Nicola @ 2016-03-02 15:23 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1: Type: text/plain, Size: 989 bytes --] On 2016-03-02 14:45:54 +0000, Aditya Mahajan said: > On Wed, 2 Mar 2016, Nicola wrote: > >> On 2016-03-02 02:14:33 +0000, Aditya Mahajan said: >>> >>> I do not load the default vimrc, because that drastically slows down the >>> module. >> >> That makes sense. So, Vim is run with something like `vim -u NONE`, I >> guess. > > Yes. And if the vimrc option is used, then it is saved on file, and vim -u > \vimrc_filename is run. Crystal clear, thanks! >> \startvimrc[name=pgsql] >> set nocompatible >> set runtimepath+=~/.vim/bundle/pgsql >> let g:sql_type_default='pgsql' >> % ... >> \stopvimrc > > I will add a note to the docs about runtimepath. When I wrote the module, > bundle was not popular, but it is the default now. I use Pathogen, and `bundle` is its default path for plugins. But recently Vim has introduced a feature called `packages` in the core (:h packages), so one may expect that in the future the default will be `pack`. Nicola [-- Attachment #1.2: Type: text/html, Size: 3158 bytes --] [-- Attachment #2: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 2:14 ` Aditya Mahajan 2016-03-02 8:46 ` Nicola @ 2016-03-02 11:06 ` Nicola 2016-03-02 11:20 ` Nicola 1 sibling, 1 reply; 19+ messages in thread From: Nicola @ 2016-03-02 11:06 UTC (permalink / raw) To: ntg-context On 2016-03-02 02:14:33 +0000, Aditya Mahajan said: > 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 I have a relatively minor problem with linked highlight groups. As far as I can see, the module resolves linked groups so that, for example, if String links to Constant, then the generated code for 'a string' will be something like \SYN[Constant]{'a string'}, rather than \SYN[String]{'a string'}. In my specific case, strings use the sqlString group, which links by default to String, which in turn links to Constant. Is there a way to decouple linked highlight groups, so that, for example, I may distinguish Constant from String? I have already tried to put commands like hi! clear sqlString hi! link String NONE etc... in the vimrc block, to no avail. Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 11:06 ` Nicola @ 2016-03-02 11:20 ` Nicola 0 siblings, 0 replies; 19+ messages in thread From: Nicola @ 2016-03-02 11:20 UTC (permalink / raw) To: ntg-context On 2016-03-02 11:06:34 +0000, Nicola said: > On 2016-03-02 02:14:33 +0000, Aditya Mahajan said: > >> 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 > > I have a relatively minor problem with linked highlight groups. > As far as I can see, the module resolves linked groups so that, > for example, if String links to Constant, then the generated code > for 'a string' will be something like \SYN[Constant]{'a string'}, > rather than \SYN[String]{'a string'}. In my specific case, strings > use the sqlString group, which links by default to String, which in > turn links to Constant. > > Is there a way to decouple linked highlight groups, so that, for > example, I may distinguish Constant from String? I have already > tried to put commands like > > hi! clear sqlString > hi! link String NONE > etc... > > in the vimrc block, to no avail. Ok, I have found it: hi! link sqlString NONE With that, I get \SYN[sqlString]{'a string'}, as expected. Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-01 15:35 ` Aditya Mahajan 2016-03-01 18:14 ` Nicola @ 2016-03-02 18:21 ` Nicola 2016-03-02 19:34 ` Aditya Mahajan 1 sibling, 1 reply; 19+ messages in thread From: Nicola @ 2016-03-02 18:21 UTC (permalink / raw) To: ntg-context 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 I've set up your module and it works perfectly. It saved me a lot of time! But I need help for one more thing: \inlineMYLANG{X} adds a new line before and after X, as in \startMYLANG X \stopMYLANG. How do I prevent that? Well, why is that the case to begin with? Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 18:21 ` Nicola @ 2016-03-02 19:34 ` Aditya Mahajan 2016-03-02 19:58 ` Nicola 0 siblings, 1 reply; 19+ messages in thread From: Aditya Mahajan @ 2016-03-02 19:34 UTC (permalink / raw) To: mailing list for ConTeXt users On Wed, 2 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 > > I've set up your module and it works perfectly. It saved me a > lot of time! But I need help for one more thing: > \inlineMYLANG{X} adds a new line before and after X, as in > \startMYLANG X \stopMYLANG. How do I prevent that? Well, why > is that the case to begin with? It shouldn't. Can you send me a minimal example. 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 19:34 ` Aditya Mahajan @ 2016-03-02 19:58 ` Nicola 2016-03-02 20:11 ` Aditya Mahajan 0 siblings, 1 reply; 19+ messages in thread From: Nicola @ 2016-03-02 19:58 UTC (permalink / raw) To: ntg-context On 2016-03-02 19:34:00 +0000, Aditya Mahajan said: > On Wed, 2 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 >> >> I've set up your module and it works perfectly. It saved me a >> lot of time! But I need help for one more thing: >> \inlineMYLANG{X} adds a new line before and after X, as in >> \startMYLANG X \stopMYLANG. How do I prevent that? Well, why >> is that the case to begin with? > > It shouldn't. Can you send me a minimal example. I have figured out myself: I have defined \definevimtyping[pgsql][..., before={\blank},after={\blank}, ...] which, I have realized, applies to inline text, too. How do I set up the environment so that there is some blank space before and after without affecting inline code? Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 19:58 ` Nicola @ 2016-03-02 20:11 ` Aditya Mahajan 2016-03-02 20:29 ` Nicola 0 siblings, 1 reply; 19+ messages in thread From: Aditya Mahajan @ 2016-03-02 20:11 UTC (permalink / raw) To: mailing list for ConTeXt users On Wed, 2 Mar 2016, Nicola wrote: > On 2016-03-02 19:34:00 +0000, Aditya Mahajan said: > >> On Wed, 2 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 >>> >>> I've set up your module and it works perfectly. It saved me a >>> lot of time! But I need help for one more thing: >>> \inlineMYLANG{X} adds a new line before and after X, as in >>> \startMYLANG X \stopMYLANG. How do I prevent that? Well, why >>> is that the case to begin with? >> >> It shouldn't. Can you send me a minimal example. > > I have figured out myself: I have defined > > \definevimtyping[pgsql][..., before={\blank},after={\blank}, ...] > > which, I have realized, applies to inline text, too. How do I set up > the environment so that there is some blank space before and after > without affecting inline code? You can change the space before and after display environments using spacebefore and spaceafter keys (see the documentation of filter module[1], which is used by the vim module) There are two modes: location=paragraph and location=text. In location=paragraph you get \blank[<spacebefore>] <before> <filtered content> <after> \blank[<spaceafter>] In location=text (which is used by \inline...) you get <left> <filtered content> <right> The behaviour that you see is because, by default, I have set \c!left=\externalfilterparameter\c!before, \c!right=\externalfilterparameter\c!after, Looking at git-blame, I see that this was always the case, ever since the left and right keys were added (I guess to keep backward compatibility at that time). Looking back, I think that this is not a good default and I will change it. In the meanwhile, simply use \definevimtyping[...][left=, right=,] Aditya [1]: https://github.com/adityam/filter ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 20:11 ` Aditya Mahajan @ 2016-03-02 20:29 ` Nicola 0 siblings, 0 replies; 19+ messages in thread From: Nicola @ 2016-03-02 20:29 UTC (permalink / raw) To: ntg-context On 2016-03-02 20:11:56 +0000, Aditya Mahajan said: > You can change the space before and after display environments using > spacebefore and spaceafter keys (see the documentation of filter > module[1], which is used by the vim module) Thanks, it works! Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-01 15:26 Custom syntax highlighting Nicola 2016-03-01 15:35 ` Aditya Mahajan @ 2016-03-01 21:53 ` Hans Hagen 2016-03-02 8:56 ` Nicola 1 sibling, 1 reply; 19+ messages in thread From: Hans Hagen @ 2016-03-01 21:53 UTC (permalink / raw) To: ntg-context On 3/1/2016 4:26 PM, 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 :) > > If I am not wrong, I'd like to write my own syntax file, but > not starting from scratch. I cannot find any pret-* files in > the beta, though. Should they be downloaded separately? just fyi (as aditya already provided you a solution) there are three highlighters - the build-in one, for which one can define additional variants (there are few defined, some assume proper syntax, some are line based) - the module by aditya which (i assume) also needs vim installed - a relative new mechanism based on the scite lexers that i use (for not it is loaded by \usemodule[scite] The last option is supports combined tex/mp/lua as well as xml, web, pdf, bibtex, lua so basically all the formats used by context and i now also added the sql one (i needed that one a while ago but never added it to the upcoming beta) \usemodule[scite] \starttext % \scitebuffer[sql][x] % \scitefile[sql][abc.sql] \startscite[sql] .... \stopscite \stoptext no upload yet btw, there's also: mtxrun --extra=listing --scite --compact foo.sql or whatever known suffix Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-01 21:53 ` Hans Hagen @ 2016-03-02 8:56 ` Nicola 2016-03-02 9:13 ` Hans Hagen 0 siblings, 1 reply; 19+ messages in thread From: Nicola @ 2016-03-02 8:56 UTC (permalink / raw) To: ntg-context On 2016-03-01 21:53:10 +0000, Hans Hagen said: > > just fyi (as aditya already provided you a solution) there are three > highlighters > > - the build-in one, for which one can define additional variants (there > are few defined, some assume proper syntax, some are line based) Just to clarify, this is the Lua-based "pretty printers" mentioned in the wiki, is it? > - the module by aditya which (i assume) also needs vim installed > > - a relative new mechanism based on the scite lexers that i use (for not > it is loaded by \usemodule[scite] ...which does require Scite? (I've tried your example and it doesn't get highlighted.) Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 8:56 ` Nicola @ 2016-03-02 9:13 ` Hans Hagen 2016-03-02 10:45 ` Nicola 0 siblings, 1 reply; 19+ messages in thread From: Hans Hagen @ 2016-03-02 9:13 UTC (permalink / raw) To: ntg-context On 3/2/2016 9:56 AM, Nicola wrote: > On 2016-03-01 21:53:10 +0000, Hans Hagen said: >> >> just fyi (as aditya already provided you a solution) there are three >> highlighters >> >> - the build-in one, for which one can define additional variants (there >> are few defined, some assume proper syntax, some are line based) > > Just to clarify, this is the Lua-based "pretty printers" mentioned in the > wiki, is it? > >> - the module by aditya which (i assume) also needs vim installed >> >> - a relative new mechanism based on the scite lexers that i use (for not >> it is loaded by \usemodule[scite] > > ...which does require Scite? (I've tried your example and it doesn't get > highlighted.) the sql lexer is in the upcoming beta and i just added the start/stop but this should work \usemodule[scite] \starttext \startbuffer[x] for i=1cm step 1cm upto 10cm : draw fullcircle scaled (0cm,i) ; endfor ; \stopbuffer \scitebuffer[mps][x] \stoptext You don't need scite installed so it's quite efficient as it's the method that is used, not the binary (and the context related lexers ship with the context distribution). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 9:13 ` Hans Hagen @ 2016-03-02 10:45 ` Nicola 2016-03-02 23:16 ` Alan BRASLAU 0 siblings, 1 reply; 19+ messages in thread From: Nicola @ 2016-03-02 10:45 UTC (permalink / raw) To: ntg-context On 2016-03-02 09:13:07 +0000, Hans Hagen said: > On 3/2/2016 9:56 AM, Nicola wrote: >> On 2016-03-01 21:53:10 +0000, Hans Hagen said: >>> >>> - a relative new mechanism based on the scite lexers that i use (for not >>> it is loaded by \usemodule[scite] >> >> ...which does require Scite? (I've tried your example and it doesn't get >> highlighted.) > > the sql lexer is in the upcoming beta and i just added the start/stop > but this should work > [snip] Indeed it does. > You don't need scite installed so it's quite efficient as it's the > method that is used, not the binary (and the context related lexers ship > with the context distribution). That's clear now, thanks! Nicola ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Custom syntax highlighting 2016-03-02 10:45 ` Nicola @ 2016-03-02 23:16 ` Alan BRASLAU 0 siblings, 0 replies; 19+ messages in thread From: Alan BRASLAU @ 2016-03-02 23:16 UTC (permalink / raw) To: ntg-context On Wed, 2 Mar 2016 11:45:54 +0100 Nicola <nvitacolonna@gmail.com> wrote: > > You don't need scite installed so it's quite efficient as it's the > > method that is used, not the binary (and the context related lexers > > ship with the context distribution). > > That's clear now, thanks! Hans is referring to syntax highlighting within ConTeXt and a method that uses the lua lexers that he originally wrote for SciTe. I would like to point out that in order to use this highlighting *in the SciTe editor* itself, one needs to have the lpeg library compiled for SciTe. Currently, this only exists as a DLL for Windows and has not been ported to any other system. This was our conclusion at the last ConTeXt meeting where we spent a little time, probably not enough, trying to compile this library without success. Alan ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2016-03-02 23:16 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-03-01 15:26 Custom syntax highlighting Nicola 2016-03-01 15:35 ` Aditya Mahajan 2016-03-01 18:14 ` Nicola 2016-03-02 2:14 ` Aditya Mahajan 2016-03-02 8:46 ` Nicola 2016-03-02 14:45 ` Aditya Mahajan 2016-03-02 15:23 ` Nicola 2016-03-02 11:06 ` Nicola 2016-03-02 11:20 ` Nicola 2016-03-02 18:21 ` Nicola 2016-03-02 19:34 ` Aditya Mahajan 2016-03-02 19:58 ` Nicola 2016-03-02 20:11 ` Aditya Mahajan 2016-03-02 20:29 ` Nicola 2016-03-01 21:53 ` Hans Hagen 2016-03-02 8:56 ` Nicola 2016-03-02 9:13 ` Hans Hagen 2016-03-02 10:45 ` Nicola 2016-03-02 23:16 ` Alan BRASLAU
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).