* Vim wiki page updated @ 2016-11-01 13:13 Nicola 2016-11-02 7:37 ` Jan Willem Flamma 2016-11-02 18:39 ` Aditya Mahajan 0 siblings, 2 replies; 13+ messages in thread From: Nicola @ 2016-11-01 13:13 UTC (permalink / raw) To: ntg-context I have updated the Vim page at ConTeXt Garden: http://wiki.contextgarden.net/Vim It may be considered as the official documentation of the ConTeXt scripts in Vim, as the only other documentation is the source code :) Happy editing! 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-01 13:13 Vim wiki page updated Nicola @ 2016-11-02 7:37 ` Jan Willem Flamma 2016-11-02 18:39 ` Aditya Mahajan 1 sibling, 0 replies; 13+ messages in thread From: Jan Willem Flamma @ 2016-11-02 7:37 UTC (permalink / raw) To: mailing list for ConTeXt users Excellent piece of work. Many thanks! > On 1 Nov 2016, at 14:13, Nicola <nvitacolonna@gmail.com> wrote: > > I have updated the Vim page at ConTeXt Garden: > > http://wiki.contextgarden.net/Vim > > It may be considered as the official documentation of the ConTeXt scripts in Vim, as the only other documentation is the source code :) > > Happy editing! > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ ___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-01 13:13 Vim wiki page updated Nicola 2016-11-02 7:37 ` Jan Willem Flamma @ 2016-11-02 18:39 ` Aditya Mahajan 2016-11-02 19:20 ` Nicola 1 sibling, 1 reply; 13+ messages in thread From: Aditya Mahajan @ 2016-11-02 18:39 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: TEXT/PLAIN, Size: 1409 bytes --] On Tue, 1 Nov 2016, Nicola wrote: > I have updated the Vim page at ConTeXt Garden: > > http://wiki.contextgarden.net/Vim > > It may be considered as the official documentation of the ConTeXt > scripts in Vim, as the only other documentation is the source code :) Hi Nicola, I wonder if you have seen my vim runtime files: https://github.com/adityam/vim-context The main file to look at is the syntax highlighting file. I haven't compared carefully with your version (haven't installed vim 8 yet), but there are a few differences. It may be worthwhile to merge the two syntax files. The metapost syntax highlighting file defines a few keywords that are used by metafun. Could these be merged to your mp syntax highlighting file? The indent file is adapted from (I think) latex-suite's indent file with modificiations that suit my taste. I am not sure these should go into the default vim indent file, but it may be worthwhile for you to take a quick look. The ftplugin file mainly contains shortcuts like `a expand to α, etc; again, adapted from latex-suite (which in-turn borred the idea from auctex). These depend on a ftplugin file provided by latex-suite. There were also a few macros to reflow text, but your code is more robust and has more features. The compiler file is old and I haven't tested it in a few years, so please ignore it. Thanks, Aditya [-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-02 18:39 ` Aditya Mahajan @ 2016-11-02 19:20 ` Nicola 2016-11-02 22:35 ` Aditya Mahajan 0 siblings, 1 reply; 13+ messages in thread From: Nicola @ 2016-11-02 19:20 UTC (permalink / raw) To: ntg-context On 02/11/2016 19:39, Aditya Mahajan wrote: > On Tue, 1 Nov 2016, Nicola wrote: > >> I have updated the Vim page at ConTeXt Garden: >> >> http://wiki.contextgarden.net/Vim >> >> It may be considered as the official documentation of the ConTeXt >> scripts in Vim, as the only other documentation is the source code > > Hi Nicola, > > I wonder if you have seen my vim runtime files: > https://github.com/adityam/vim-context Unfortunately not, I worked only on those already in Vim. > The main file to look at is the syntax highlighting file. I haven't > compared > carefully with your version (haven't installed vim 8 yet), but there are a > few differences. It may be worthwhile to merge the two syntax files. Ok, I will take a look. I see that your file does not depend on plaintex.vim. It might be a good idea to remove that dependency... > The metapost syntax highlighting file defines a few keywords that are > used by > metafun. Could these be merged to your mp syntax highlighting file? The syntax scripts in Vim already cover all of MetaFun. MetaFun keywords are highlighted by default inside ConTeXt documents; for MetaPost files ('mp' filetype), you must put let g:mp_metafun_macros = 1 into your vimrc. > The indent file is adapted from (I think) latex-suite's indent file with > modificiations that suit my taste. I am not sure these should go into > the default vim indent file, but it may be worthwhile for you to take a > quick look. MetaPost indentation is tough. I have rewritten the indent script in Vim from scratch, and now it works reasonably well. I will try yours, but you might try the one currently in Vim, too. > The ftplugin file mainly contains shortcuts like `a expand to α, etc; > again, > adapted from latex-suite (which in-turn borred the idea from auctex). These > depend on a ftplugin file provided by latex-suite. There were also a few > macros to reflow text, but your code is more robust and has more features. I will look into those, too. Do you know that Vim has built-in support for digraphs (:h digraphs)? For example, α can be obtained by typing <c-k>a* in Insert mode. > The compiler file is old and I haven't tested it in a few years, so please > ignore it. OK. I could maybe create a GitHub repository, to make it easier to merge your work. 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-02 19:20 ` Nicola @ 2016-11-02 22:35 ` Aditya Mahajan 2016-11-03 9:45 ` Hans Hagen 2016-11-05 19:23 ` Nicola 0 siblings, 2 replies; 13+ messages in thread From: Aditya Mahajan @ 2016-11-02 22:35 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: TEXT/PLAIN, Size: 1875 bytes --] On Wed, 2 Nov 2016, Nicola wrote: > The syntax scripts in Vim already cover all of MetaFun. MetaFun keywords > are highlighted by default inside ConTeXt documents; for MetaPost files > ('mp' filetype), you must put > > let g:mp_metafun_macros = 1 > > into your vimrc. Ah, great! > > The indent file is adapted from (I think) latex-suite's indent file with > > modificiations that suit my taste. I am not sure these should go into > > the default vim indent file, but it may be worthwhile for you to take a > > quick look. > > MetaPost indentation is tough. I have rewritten the indent script in Vim > from scratch, and now it works reasonably well. I will try yours, but > you might try the one currently in Vim, too. I did not change metapost indenting, but defined some rules for indenting of context files. I believe that your indent file does not attempt to indent context files (I may be mistaken because I am just reading the .vim files, not testing it as I don't have vim8 yet). > > The ftplugin file mainly contains shortcuts like `a expand to α, etc; > > again, > > adapted from latex-suite (which in-turn borred the idea from auctex). > These > > depend on a ftplugin file provided by latex-suite. There were also a few > > macros to reflow text, but your code is more robust and has more > features. > > I will look into those, too. Do you know that Vim has built-in support > for digraphs (:h digraphs)? For example, α can be obtained by typing > <c-k>a* in Insert mode. I know of digraphis but it can be tricky to remember all the mapping (for example for \subset, \circ, etc.). Auctex uses fairly intuitive shortcuts. > I could maybe create a GitHub repository, to make it easier to merge > your work. That will be nice. Then I can also send you pull requests for specific things. Aditya [-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-02 22:35 ` Aditya Mahajan @ 2016-11-03 9:45 ` Hans Hagen 2016-11-03 10:25 ` Nicola 2016-11-05 19:23 ` Nicola 1 sibling, 1 reply; 13+ messages in thread From: Hans Hagen @ 2016-11-03 9:45 UTC (permalink / raw) To: ntg-context On 11/2/2016 11:35 PM, Aditya Mahajan wrote: > On Wed, 2 Nov 2016, Nicola wrote: > >> The syntax scripts in Vim already cover all of MetaFun. MetaFun >> keywords are highlighted by default inside ConTeXt documents; for >> MetaPost files ('mp' filetype), you must put >> >> let g:mp_metafun_macros = 1 >> >> into your vimrc. > > Ah, great! if you need a command list .. there are scripts for that (no vim yet, but for scite we ship simple lists of commands) >> > The indent file is adapted from (I think) latex-suite's indent file >> with >> > modificiations that suit my taste. I am not sure these should go into >> > the default vim indent file, but it may be worthwhile for you to take a >> > quick look. >> >> MetaPost indentation is tough. I have rewritten the indent script in >> Vim from scratch, and now it works reasonably well. I will try yours, >> but you might try the one currently in Vim, too. > > I did not change metapost indenting, but defined some rules for > indenting of context files. I believe that your indent file does not > attempt to indent context files (I may be mistaken because I am just > reading the .vim files, not testing it as I don't have vim8 yet). > >> > The ftplugin file mainly contains shortcuts like `a expand to α, etc; >> > again, >> > adapted from latex-suite (which in-turn borred the idea from >> auctex). These >> > depend on a ftplugin file provided by latex-suite. There were also a >> few >> > macros to reflow text, but your code is more robust and has more >> features. >> >> I will look into those, too. Do you know that Vim has built-in support >> for digraphs (:h digraphs)? For example, α can be obtained by typing >> <c-k>a* in Insert mode. > > I know of digraphis but it can be tricky to remember all the mapping > (for example for \subset, \circ, etc.). Auctex uses fairly intuitive > shortcuts. > >> I could maybe create a GitHub repository, to make it easier to merge >> your work. > > That will be nice. Then I can also send you pull requests for specific > things. > > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ > -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-03 9:45 ` Hans Hagen @ 2016-11-03 10:25 ` Nicola 2016-11-03 11:28 ` Hans Hagen 2016-11-05 15:01 ` Wolfgang Schuster 0 siblings, 2 replies; 13+ messages in thread From: Nicola @ 2016-11-03 10:25 UTC (permalink / raw) To: ntg-context On 03/11/2016 10:45, Hans Hagen wrote: > On 11/2/2016 11:35 PM, Aditya Mahajan wrote: >> On Wed, 2 Nov 2016, Nicola wrote: >> >>> The syntax scripts in Vim already cover all of MetaFun. MetaFun >>> keywords are highlighted by default inside ConTeXt documents; for >>> MetaPost files ('mp' filetype), you must put >>> >>> let g:mp_metafun_macros = 1 >>> >>> into your vimrc. >> >> Ah, great! > > if you need a command list .. there are scripts for that (no vim yet, > but for scite we ship simple lists of commands) Are these scripts available somewhere? I've rolled out my own, but I will happily use/adapt something "more official". >>> > The indent file is adapted from (I think) latex-suite's indent file >>> with >>> > modificiations that suit my taste. I am not sure these should go into >>> > the default vim indent file, but it may be worthwhile for you to >>> take a >>> > quick look. >>> >>> MetaPost indentation is tough. I have rewritten the indent script in >>> Vim from scratch, and now it works reasonably well. I will try yours, >>> but you might try the one currently in Vim, too. >> >> I did not change metapost indenting, but defined some rules for >> indenting of context files. I believe that your indent file does not >> attempt to indent context files (I may be mistaken because I am just >> reading the .vim files, not testing it as I don't have vim8 yet). Correct, no indentation for ConTeXt. This is something that may be worth adding. >>> I could maybe create a GitHub repository, to make it easier to merge >>> your work. >> >> That will be nice. Then I can also send you pull requests for specific >> things. Ok, I'll let you know when I've done it. Pull requests will make my life much easier :) 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-03 10:25 ` Nicola @ 2016-11-03 11:28 ` Hans Hagen 2016-11-03 14:37 ` Nicola 2016-11-05 15:01 ` Wolfgang Schuster 1 sibling, 1 reply; 13+ messages in thread From: Hans Hagen @ 2016-11-03 11:28 UTC (permalink / raw) To: ntg-context On 11/3/2016 11:25 AM, Nicola wrote: > On 03/11/2016 10:45, Hans Hagen wrote: >> On 11/2/2016 11:35 PM, Aditya Mahajan wrote: >>> On Wed, 2 Nov 2016, Nicola wrote: >>> >>>> The syntax scripts in Vim already cover all of MetaFun. MetaFun >>>> keywords are highlighted by default inside ConTeXt documents; for >>>> MetaPost files ('mp' filetype), you must put >>>> >>>> let g:mp_metafun_macros = 1 >>>> >>>> into your vimrc. >>> >>> Ah, great! >> >> if you need a command list .. there are scripts for that (no vim yet, >> but for scite we ship simple lists of commands) > > Are these scripts available somewhere? what kind of datafile do you need? > I've rolled out my own, but I will happily use/adapt something "more > official". > >>>> > The indent file is adapted from (I think) latex-suite's indent file >>>> with >>>> > modificiations that suit my taste. I am not sure these should go into >>>> > the default vim indent file, but it may be worthwhile for you to >>>> take a >>>> > quick look. >>>> >>>> MetaPost indentation is tough. I have rewritten the indent script in >>>> Vim from scratch, and now it works reasonably well. I will try yours, >>>> but you might try the one currently in Vim, too. >>> >>> I did not change metapost indenting, but defined some rules for >>> indenting of context files. I believe that your indent file does not >>> attempt to indent context files (I may be mistaken because I am just >>> reading the .vim files, not testing it as I don't have vim8 yet). > > Correct, no indentation for ConTeXt. This is something that may be worth > adding. > >>>> I could maybe create a GitHub repository, to make it easier to merge >>>> your work. >>> >>> That will be nice. Then I can also send you pull requests for specific >>> things. > > Ok, I'll let you know when I've done it. Pull requests will make my life > much easier :) > > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-03 11:28 ` Hans Hagen @ 2016-11-03 14:37 ` Nicola 2016-11-05 14:45 ` Alan Braslau 0 siblings, 1 reply; 13+ messages in thread From: Nicola @ 2016-11-03 14:37 UTC (permalink / raw) To: ntg-context On 03/11/2016 12:28, Hans Hagen wrote: >>> if you need a command list .. there are scripts for that (no vim yet, >>> but for scite we ship simple lists of commands) >> >> Are these scripts available somewhere? > > what kind of datafile do you need? I need the list of all macros, vardefs, internals, and global variables from all MetaFun files. The format should be Vim's syntax format: https://github.com/vim/vim/blob/master/runtime/syntax/mp.vim 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-03 14:37 ` Nicola @ 2016-11-05 14:45 ` Alan Braslau 2016-11-05 14:53 ` Nicola 0 siblings, 1 reply; 13+ messages in thread From: Alan Braslau @ 2016-11-05 14:45 UTC (permalink / raw) To: Nicola Vitacolonna, Hans Hagen; +Cc: mailing list for ConTeXt users Hans, Nicola, Being a vim user (and not presently taking much advantage of the syntax highlighting), and a MP fan, I will take care of this (in coordination with Hans, eventually). Alan > On 3 Nov 2016, at 08:37, Nicola <nvitacolonna@gmail.com> wrote: > > On 03/11/2016 12:28, Hans Hagen wrote: > >>>> if you need a command list .. there are scripts for that (no vim yet, >>>> but for scite we ship simple lists of commands) >>> >>> Are these scripts available somewhere? >> >> what kind of datafile do you need? > > I need the list of all macros, vardefs, internals, and global variables > from all MetaFun files. The format should be Vim's syntax format: > > https://github.com/vim/vim/blob/master/runtime/syntax/mp.vim > > 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-05 14:45 ` Alan Braslau @ 2016-11-05 14:53 ` Nicola 0 siblings, 0 replies; 13+ messages in thread From: Nicola @ 2016-11-05 14:53 UTC (permalink / raw) To: ntg-context [-- Attachment #1: Type: text/plain, Size: 373 bytes --] On 05/11/2016 15:45, Alan Braslau wrote: > Hans, Nicola, > > Being a vim user (and not presently taking much advantage of the syntax highlighting), and a MP fan, I will take care of this (in coordination with Hans, eventually). > > Alan For what is worth, I attach the Ruby script I am using. It outputs the keywords in a format that can be used directly in Vim. Nicola [-- Attachment #2: extract_mp_keywords.rb --] [-- Type: text/x-ruby-script, Size: 6485 bytes --] #!/usr/bin/env ruby # -*- coding: utf-8 -*- # Copyright (c) 2016 Lifepillar # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. VERSION = '1.0.0' def debug title, *info return unless $DEBUG puts "\033[1;35m[DEBUG]\033[1;39m #{title}\033[0m" info.each do |chunk| chunk.each_line do |l| puts "\033[1;35m[DEBUG]\033[0m #{l.chomp!}" end end end def help; <<-HELP Usage: parse_metafun [<path> ...] Options: -h, --help Show this help message and exit. --version Print version and exit. --debug Enable debugging. Example: parse_metafun mp-tool.mp mp-step.mp HELP end # Parse options paths = [] n = ARGV.length i = 0 while i < n case ARGV[i] when /^--version$/ puts VERSION exit(0) when /^--debug$/ $DEBUG = true when /^-h|--help$/ puts help exit(0) else # Assume it is a path paths << ARGV[i] end i += 1 end if paths.empty? paths << Dir.entries(".") end maxlinelen = 52 defs = {} saved_vars = {} known_commands = [ ] known_constants = [ ] known_defs = [ ] known_primary_defs = [ ] known_secondary_defs = [ ] known_tertiary_defs = [ ] known_vardefs = [ ] known_num_exps = [ ] known_types = [ ] false_positives = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', # just to be safe 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', # just to be safe 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', # just to be safe ] types = 'boolean|color|cmykcolor|numeric|pair|path|pen|picture|rgbcolor|string|transform' types += '|' + known_types.join('|') begin paths.each do |p| name = File.basename(p) defs[name] = { 'mpCommand' => [], 'mpDef' => [], 'mpVardef' => [], 'mpPrimaryDef' => [], 'mpSecondaryDef' => [], 'mpTertiaryDef' => [], 'mpNewInternal' => [], 'mpNumExp' => [], 'mpType' => [], 'mpVariable' => [], 'mpConstant' => [], 'LET' => [] } saved_vars[name] = [] File.open(p).each_line do |l| next if l =~ /^\s*%/ # skip comments /^[^%]*\bdef\s+(\w+)/.match(l) { |m| if m[1] !~ /^_|_$/ defs[name]['mpDef'] << m[1] end } /^[^%]*\bvardef\s+(\w+)/.match(l) { |m| if m[1] !~ /^_|_$/ defs[name]['mpVardef'] << m[1] end } /^[^%]*\bprimarydef\s+\w+\s+(\w+)/.match(l) { |m| if m[1] !~ /^_|_$/ defs[name]['mpPrimaryDef'] << m[1] end } /^[^%]*\bsecondarydef\s+\w+\s+(\w+)/.match(l) { |m| if m[1] !~ /^_|_$/ defs[name]['mpSecondaryDef'] << m[1] end } /^[^%]*\btertiarydef\s+\w+\s+(\w+)/.match(l) { |m| if m[1] !~ /^_|_$/ defs[name]['mpTertiaryDef'] << m[1] end } l.scan(/\bnewinternal\b\s+([^;]+);/).each { |m| m[0].split(/,/).each { |w| w.strip! if w !~ /^_|_$/ defs[name]['mpNewInternal'] << w end } } /^[^%]*\blet\s+(\w+)/.match(l) { |m| if m[1] !~ /^_|_$/ if !false_positives.include?(m[1]) if known_constants.include?(m[1]) defs[name]['mpConstant'] << m[1] elsif known_types.include?(m[1]) defs[name]['mpType'] << m[1] elsif known_defs.include?(m[1]) defs[name]['mpDef'] << m[1] elsif known_vardefs.include?(m[1]) defs[name]['mpVardef'] << m[1] elsif known_primary_defs.include?(m[1]) defs[name]['mpPrimaryDef'] << m[1] elsif known_secondary_defs.include?(m[1]) defs[name]['mpSecondaryDef'] << m[1] elsif known_tertiary_defs.include?(m[1]) defs[name]['mpTertiaryDef'] << m[1] elsif known_commands.include?(m[1]) defs[name]['mpCommand'] << m[1] elsif known_num_exps.include?(m[1]) defs[name]['mpNumExp'] << m[1] else defs[name]['LET'] << m[1] end end end } l.scan(/\bsave\b\s+([^;]+);/).each do |m| # This considers also save inside comments m[0].split(/,/).each do |w| saved_vars[name] << w.strip end end l.scan(/\b(#{types})\b\s+([^;]+);/).each { |m| m[1].split(/,/).each { |w| w.strip! w.gsub!(/[\[\]]/, '') next unless w =~ /^\w+$/ # Skip if it is not a single token next if false_positives.include?(w) unless saved_vars.has_key?(name) && saved_vars[name].include?(w) if w !~ /^_|_$/ if known_constants.include?(w) defs[name]['mpConstant'] << w else defs[name]['mpVariable'] << w end end end } } end end defs.each_key do |n| defs[n].each_key do |t| defs[n][t].sort!.uniq! end end defs.each_key do |n| print " \" #{n}" defs[n].each_pair do |t, l| pos = maxlinelen l.each do |w| if pos + w.length + 1 > maxlinelen puts print " syn keyword #{t}" print " " * (14 - t.length) pos = 0 end print " #{w}" pos += w.length + 1 end end puts end rescue Interrupt puts "parse_metafun interrupted" exit(1) rescue => ex puts debug 'Backtrace:', ex.backtrace.join("\n") "Unexpected exception raised:\n#{ex}" end [-- Attachment #3: Type: text/plain, Size: 492 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-03 10:25 ` Nicola 2016-11-03 11:28 ` Hans Hagen @ 2016-11-05 15:01 ` Wolfgang Schuster 1 sibling, 0 replies; 13+ messages in thread From: Wolfgang Schuster @ 2016-11-05 15:01 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 1053 bytes --] > Nicola <mailto:nvitacolonna@gmail.com> > 3. November 2016 um 11:25 > On 03/11/2016 10:45, Hans Hagen wrote: >> On 11/2/2016 11:35 PM, Aditya Mahajan wrote: >>> On Wed, 2 Nov 2016, Nicola wrote: >>> >>>> The syntax scripts in Vim already cover all of MetaFun. MetaFun >>>> keywords are highlighted by default inside ConTeXt documents; for >>>> MetaPost files ('mp' filetype), you must put >>>> >>>> let g:mp_metafun_macros = 1 >>>> >>>> into your vimrc. >>> >>> Ah, great! >> >> if you need a command list .. there are scripts for that (no vim yet, >> but for scite we ship simple lists of commands) > > Are these scripts available somewhere? > > I've rolled out my own, but I will happily use/adapt something "more > official". I guess Hans means the files under $TEXMF/texmf-context/context/data/scite/context - scite-context-data-context.properties - scite-context-data-interfaces.properties - scite-context-data-metafun.properties - scite-context-data-metapost.properties - scite-context-data-tex.properties Wolfgang [-- Attachment #1.2: Type: text/html, Size: 2169 bytes --] [-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Vim wiki page updated 2016-11-02 22:35 ` Aditya Mahajan 2016-11-03 9:45 ` Hans Hagen @ 2016-11-05 19:23 ` Nicola 1 sibling, 0 replies; 13+ messages in thread From: Nicola @ 2016-11-05 19:23 UTC (permalink / raw) To: ntg-context On 02/11/2016 23:35, Aditya Mahajan wrote: > On Wed, 2 Nov 2016, Nicola wrote: >> I could maybe create a GitHub repository, to make it easier to merge >> your work. > > That will be nice. Then I can also send you pull requests for specific > things. Here it is: https://github.com/lifepillar/vim-context-metapost The updates to the above repository will be periodically forwarded for inclusion in Vim. You may use the issue tracker at GitHub to suggest improvements or report bugs (I have already included a syntax highlighting enhancement suggested by Wolfgang Schuster). Pull requests are welcome, too! 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-11-05 19:23 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-11-01 13:13 Vim wiki page updated Nicola 2016-11-02 7:37 ` Jan Willem Flamma 2016-11-02 18:39 ` Aditya Mahajan 2016-11-02 19:20 ` Nicola 2016-11-02 22:35 ` Aditya Mahajan 2016-11-03 9:45 ` Hans Hagen 2016-11-03 10:25 ` Nicola 2016-11-03 11:28 ` Hans Hagen 2016-11-03 14:37 ` Nicola 2016-11-05 14:45 ` Alan Braslau 2016-11-05 14:53 ` Nicola 2016-11-05 15:01 ` Wolfgang Schuster 2016-11-05 19:23 ` Nicola
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).