0

This question already has an answer here:

I am working with markdown and writing snippets like:

    ```c
    int
    main()
    {
        return 0;
    }
    ```

It is highlighted as a code in vim.

Vim

However would it possible for the c section to have the syntax of a normal c file? I was checking out pyvim and it has such a feature.

Pyvim

Wondering if I can bring it in vim?

marked as duplicate by Hotschke, Community Jan 13 at 12:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Upstream repo for the runtime files for markdown has a README which describes this. Add to your vimrc:

let g:markdown_fenced_languages = ['c']

enter image description here

  • Awesome stuff, @Hotschke. Thanks for demoing with my example and screen-shotting it. – Nishant Jan 13 at 12:38
  • 1
    Note, you can also use pasticboy/vim-markdown, which is more actively maintained. It might be more featureful. – Karl Yngve Lervåg Jan 14 at 8:07

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