1

For work I use a certain SQL-like DSL. We'll call it lang. I write my docs in vim(wiki), and these docs contain a lot of lang snippets. I have written my simple syntax highlight rules for lang, and they are contained within a lang-syntax.vim script.

For pure lang files, (which I call something.lang), it is really easy to write an autocmd that sources the lang-syntax.vim when .lang file is opened.

However, I can't figure out how to do this for markdown code blocks. For example, if I have this kind of code block in my vimwiki:

```lang
lang code
```

I don't have a clue how to make markdown source the lang-syntax.vim script only for the code block.

8
  • The vim markdown syntax plugin supports including other languages, this is shown here: github.com/tpope/… Mar 8 at 15:21
  • @ChristianBrabandt I'm using vimwiki for highlighting
    – Fedja
    Mar 8 at 15:23
  • don't know what vimwiki is using for markdown highlighting Mar 8 at 15:26
  • The syntax can be made to change automatically if you set a filetype using a ftdetect script
    – D. Ben Knoble
    Mar 8 at 18:45
  • 1
    I believe the following answer should help you to find the solution to your problem. Mar 9 at 15:45

1 Answer 1

1

The following answer that explain how to have C section within an Haskell program.

Remark: You could also be interested by the @IngoKarkat SyntaxRange plugin.

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