# ConTeXt : inline code highlighting with t-vim

I am trying to insert code in a ConTeXt document, so I tryed to use the vimtyping module. It works well for text blocks, but not for inline text, since it makes a new line. Here is my MWE:

``````\setuppapersize[A5][A5]
\usemodule[vim]
\definevimtyping[python][
syntax=python,
strip=yes,
tab=4,
margin=2em,
before={\blank[samepage,line]},
after={\blank[line]},
]

\starttext
The block works
\startpython
def function(foo):  # test
a = foo
return(foo**a)
\stoppython
But the inline writing of \inlinepython{def function} makes new lines.
\stoptext
``````

Is there an option I need to activate to use this module inline macro ?

• Leave out the `before` and `after` options. – Henri Menke Jul 16 '16 at 10:50
• Can you make a detailed answer so I can validate it as ok ? It would be better than if it is I who answers... – A. Licari Jul 16 '16 at 18:57

There are `spacebefore` and `spaceafter` keys that you should use to set up spaces.

This is not a bug, but is due to misconfigured defaults. The `before` and `after` values are used only when you use `\start<vim-typing>` ... `\stop<vim-typing>`; when you use `\inline<vim-typing>`, `left` and `right` keys get used.

But, in `t-filter`, I had defined:

``````\c!left=\externalfilterparameter\c!before,
\c!right=\externalfilterparameter\c!after,
``````

So, the default values of `left` and `right` were same as that of `before` and `after`. So, to avoid the wrong behaviour, add:

``````\definevimtyping[python]
[
...,
left=,
right=,
]
``````

so that `left` and `right` keys are set to be empty.

NOTE: Actually, I had fixed this bug a while back, but modules.contextgarden.net is down; so I haven't been able to update the module in the distribution.