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
___________________________________________________________________________________