ftqcla
Last Updated: March 02, 2016
·
3.623K
· tylerhunt
625cb1796316a98d3bbe205a040035c3

Markdown with Fenced Code Blocks in Vim

Enable syntax highlighting within fenced code blocks in Markdown documents in Vim:

  1. Install the latest version of the vim-markdown plugin. If you have pathogen.vim installed, this is as simple as:

    cd ~/.vim/bundle
    git clone git@github.com:tpope/vim-markdown.git
  2. Add this to your ~/.vimrc:

    " Markdown
    let g:markdown_fenced_languages = ['coffee', 'css', 'erb=eruby', 'javascript', 'js=javascript', 'json=javascript', 'ruby', 'sass', 'xml']
  3. Modify the list to add any other languages you use in your Markdown documents. You can use mappings like js=javascript to map between the language name in the code block (js) and the filetype name used by Vim (javascript). See the Linguist library for the full list of languages supported by GitHub.

Say Thanks
Respond

2 Responses
Add your response

12121
0ca8515ca904d986789d68e1216fa56b

This is great. Thanks!

over 1 year ago ·
17529
None

Thanks ! Exactly what I was looking for.

over 1 year ago ·