2

Consider the following code:

\usemodule[vim]

\definevimtyping
  [somecode]
  [numbering=yes,lines=split]

\starttext
\startsomecode
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
\stopsomecode
\stoptext

It is obvious that the code line (which is of course not actual code) is rather long, but it is one line. In the output one will see:

vim typing

Note that line numbers have been introduced that do not reflect the line numbers in source. Is it possible to get the "original" line numbering in the output?

Bonus: If there is an option, does anyone know of a way to indent text after a line wrap?

  • 1
    If there is no option with the vim module, but with another ConTeXt module that allow syntax highlighting, I would appreciate an answer showing that. – TeXnician Nov 17 '18 at 9:48
  • Maybe this plugin is using a set texwdith .vimrc option by default. Did you try using a .vimrc that would turn off line breaks? – sztruks Nov 17 '18 at 10:21
  • @sztruks Not yet (I am using vim by opening, editing and saving files and have never looked into the configuration, so I do not know about these parameters). – TeXnician Nov 17 '18 at 10:22
  • 1
    numbering=yes,lines=split” What did you expect? – Henri Menke Nov 17 '18 at 10:23
  • @HenriMenke Coming from a LaTeX package background concerning listings, I would expect it to break lines in ouput as minted (and listings?) does, but keep the correct line numbering. – TeXnician Nov 17 '18 at 10:26
2

This is too long to be a comment so I am posting this as an answer. I am the current maintainer of t-vim and the one who added the functionality for line numbering. In principle, this is possible. The 2context.vim script converts a line to the following

\SYNBOL ... \SYNEOL

The initial implementation of line numbering was to redefine \SYNBOL to add a number in the left margin. This worked but did not provide any of the other options of line numbering environment (set style of number, distance of number, skip, start, conversion, referencing, etc.). I didn't want to reimplement all those features in t-vim. So, I eventually settled for piggy-packing on the built-in line numbering environment, which currently doesn't have the option to specify that some content which belongs to the same line is actually split into two lines.

I don't plan to rewrite the way line numbering is handled in t-vim. I'll check on the context mailing list if it is possible to add support for "skip linenumber if on sameline". The code for that is already there in page-lin.lua (line 415-422) but is commented out for some reason.

  • Thanks for the insight. Let's hope that it will be uncommented soon :) – TeXnician Nov 18 '18 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.