ANN: Updated Vim scripts for ConTeXt
Hello, attached you find an update of the Vim scripts for ConTeXt. A few highlights: - jump commands ([[, ]], [{, ]}, ...); - jump to file included with \project, \component, etc... by typing gf when the cursor is above the filename; - tp (TeX paragraph) text object (e.g., use gqap to reflow a paragraph); - i$ and a$ text objects; - better integration with MetaPost (indentation and autocompletion inside \startMP...\stopMP... works automatically); - syntax highglighting can be enabled for any nested filetype (MetaPost and Lua are enabled by default); - compiler plugin, supporting mtxrun and Makefiles; - Asynchronous typesetting with :ConTeXt command. I plan to submit these changes for inclusion in Vim, but I'd like to get some feedback, especially re background typesetting and especially from Windows users. I recommend to test with Vim 8.0 patch 22 or later. Nicola
Hi Nicola, I’m relatively new to Vim and currently run it as installed (MacVIm 8.0 latest). Where do I have to place these files in order to use them? (~/.vim folder or do I have to copy the individual files into the respective Vim application subfolders?) After placing the files, is there anything else that needs to be done to ensure Vim picks up these files? Appreciate any help you can provide. Kind regards, Jan Willem Flamma
On 10 okt. 2016, at 12:49, Nicola
wrote: Hello, attached you find an update of the Vim scripts for ConTeXt. A few highlights:
- jump commands ([[, ]], [{, ]}, ...);
- jump to file included with \project, \component, etc... by typing gf when the cursor is above the filename;
- tp (TeX paragraph) text object (e.g., use gqap to reflow a paragraph);
- i$ and a$ text objects;
- better integration with MetaPost (indentation and autocompletion inside \startMP...\stopMP... works automatically);
- syntax highglighting can be enabled for any nested filetype (MetaPost and Lua are enabled by default);
- compiler plugin, supporting mtxrun and Makefiles;
- Asynchronous typesetting with :ConTeXt command.
I plan to submit these changes for inclusion in Vim, but I'd like to get some feedback, especially re background typesetting and especially from Windows users.
I recommend to test with Vim 8.0 patch 22 or later.
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 ___________________________________________________________________________________
On 2016-10-11 06:39:16 +0000, Jan Willem Flamma said:
Hi Nicola,
I’m relatively new to Vim and currently run it as installed (MacVIm 8.0 latest).
Where do I have to place these files in order to use them? (~/.vim folder or do I have to copy the individual files into the respective Vim application subfolders?)
The files must be copied into ~/.vim. The structure should be: ~/.vim/ autoload/ context.vim compiler/ context.vim ftplugin/ context.vim indent/ context.vim syntax/ context.vim By doing so, Vim will pick up your files instead of its own.
After placing the files, is there anything else that needs to be done to ensure Vim picks up these files?
No, everything just works(tm) :) See :help ftplugin-overrule for the details. Nicola
On 2016-10-11 07:26:20 +0000, Nicola said:
No, everything just works(tm) :)
Ehm, nearly. There was an error in setting the compiler. Please use the files attached below. You should be able to typeset the current document synchronously with :make or asynchronously with: :ConTeXt This latter command also accepts an optional path, in case you want to typeset a document different from the current buffer. In either case, 'mtxrun' must be in your $PATH. If necessary, you may set the path explicitly with let g:context_mtxrun = '/path/to/mtxrun' Something like let g:context_mtxrun = '$PATH=$HOME/context-beta/tex/texmf-osx-64/bin:$PATH mtxrun' should also work. Finally, you may check the status of the background jobs with :ConTeXtJobStatus and possibly kill all running jobs with :ConTeXtStopJobs Nicola
Am 2016-10-11 um 09:26 schrieb Nicola
No, everything just works(tm) :) See :help ftplugin-overrule for the details.
No, unfortunately not everything: Error detected while processing /Users/hraban/.vim/syntax/context.vim: line 22: E121: Undefined variable: v:t_list E15: Invalid expression: type(s:context_include) ==# v:t_list Error detected while processing /Users/hraban/.vim/ftplugin/context.vim: line 18: E539: Illegal character <j>: formatoptions+=tjcroql2 Maybe my vim is too old? VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 23 2016 20:20:57) Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer) GPG Key ID 1C9B22FD
On 2016-10-11 09:33:36 +0000, Henning Hraban Ramm said:
Am 2016-10-11 um 09:26 schrieb Nicola
: No, everything just works(tm) :) See :help ftplugin-overrule for the details.
No, unfortunately not everything:
Error detected while processing /Users/hraban/.vim/syntax/context.vim: line 22: E121: Undefined variable: v:t_list E15: Invalid expression: type(s:context_include) ==# v:t_list Error detected while processing /Users/hraban/.vim/ftplugin/context.vim: line 18: E539: Illegal character <j>: formatoptions+=tjcroql2
Maybe my vim is too old? VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 23 2016 20:20:57)
Yes, the scripts are meant to be used with Vim 8. You should be able to work around those errors by replacing v:t_list with 3 and removing 'j' from formatoptions, but other things, like asynchronous typesetting, won't work anyway. Nicola
Thanks a lot.
Autocompletation don't works for me. Perhaps I have a wrong .vimrc file.
Can you share your .vimrc file or a working .vimrc file.
I use MacVim only with Context.
Thanks a lot.
I'm in MacVim 8.0.27.
Have a nice day,
Jorge
2016-10-11 10:46 GMT+01:00 Nicola
On 2016-10-11 09:33:36 +0000, Henning Hraban Ramm said:
Am 2016-10-11 um 09:26 schrieb Nicola
: No, everything just works(tm) :) See :help ftplugin-overrule for the
details.
No, unfortunately not everything:
Error detected while processing /Users/hraban/.vim/syntax/context.vim: line 22: E121: Undefined variable: v:t_list E15: Invalid expression: type(s:context_include) ==# v:t_list Error detected while processing /Users/hraban/.vim/ftplugin/context.vim: line 18: E539: Illegal character <j>: formatoptions+=tjcroql2
Maybe my vim is too old? VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 23 2016 20:20:57)
Yes, the scripts are meant to be used with Vim 8. You should be able to work around those errors by replacing v:t_list with 3 and removing 'j' from formatoptions, but other things, like asynchronous typesetting, won't work anyway.
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/list info/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ____________________________________________________________ _______________________
-- Atentamente DesdeChaves
On 2016-10-12 10:18:10 +0000, DesdeChaves said:
Thanks a lot.
Autocompletation don't works for me. Perhaps I have a wrong .vimrc file. Can you share your .vimrc file or a working .vimrc file.
There is nothing to be configured. The mapping to trigger the completion is <C-X><C-O> (ctrl-x followed by ctrl-o) and it works inside \startMP...\stopMP... blocks. Doesn't that work for you? Maybe you expected the suggestions to pop-up without pressing any key? For that, you need a plugin like NeoComplete or AutoComplPop. Nicola
Hi Nicola,
Thanks for the vim scripts, I've been looking for something like this
for a while.
Just a minor problem, on windows the :make or :ConTeXt commands fail if
there is a space in the path or file name.
Changing fnameescape() to shellescape() in the definition of l:makeprg
in line 21 of compiler/context.vim seems to fix this, i.e.
let &l:makeprg =
\ 'cd ' . shellescape(fnamemodify(bufname("%"), ':p:h'))
\ . ' && ' . get(b:, 'context_mtxrun', get(g:, 'context_mtxrun',
'mtxrun'))
\ . ' --script context --autogenerate --nonstopmode --synctex='
\ . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ?
'1' : '0')
\ . ' ' . get(b:, 'context_extra_options', get(g:,
'context_extra_options', ''))
\ . ' ' . shellescape(expand('%:p:t'))
Regards,
Kevin
------ Original Message ------
From: "Nicola"
On 2016-10-11 09:33:36 +0000, Henning Hraban Ramm said:
Am 2016-10-11 um 09:26 schrieb Nicola
: No, everything just works(tm) :) See :help ftplugin-overrule for the details.
No, unfortunately not everything:
Error detected while processing /Users/hraban/.vim/syntax/context.vim: line 22: E121: Undefined variable: v:t_list E15: Invalid expression: type(s:context_include) ==# v:t_list Error detected while processing /Users/hraban/.vim/ftplugin/context.vim: line 18: E539: Illegal character <j>: formatoptions+=tjcroql2
Maybe my vim is too old? VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 23 2016 20:20:57)
Yes, the scripts are meant to be used with Vim 8. You should be able to work around those errors by replacing v:t_list with 3 and removing 'j' from formatoptions, but other things, like asynchronous typesetting, won't work anyway.
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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 21/10/2016 00:22, Sandiford Kevin wrote:
Hi Nicola,
Thanks for the vim scripts, I've been looking for something like this for a while.
Just a minor problem, on windows the :make or :ConTeXt commands fail if there is a space in the path or file name.
Changing fnameescape() to shellescape() in the definition of l:makeprg in line 21 of compiler/context.vim seems to fix this
Good catch, thanks! Could you please try the attached version, which should fix that and has other changes? Please note that in the current version, :make does not `cd` any more (that was causing other issues), so you have to do it yourself before typesetting (using :cd or :lcd). That said, :ConTeXt should be a better option under all circumstances. Nicola
participants (5)
-
DesdeChaves
-
Henning Hraban Ramm
-
Jan Willem Flamma
-
Nicola
-
Sandiford Kevin