md-vim

Markdown plugin for Vim

Includes syntax highlighting, fenced code blocks, and auto-formatting
md-vim on GitHub

Install

# vim-plug, in ~/.vimrc:
Plug 'hughbien/md-vim'

# Vundle, in ~/.vimrc:
Plugin 'hughbien/md-vim'

# Pathogen, clone this project under ~/.vim/bundle:
$ git clone https://hughbien.com/hughbien/md-vim.git
$ mv md-vim ~/.vim/bundle

# General, copy two files:
$ cp ftplugin/md.vim ~/.vim/ftplugin/md.vim
$ cp syntax/md.vim ~/.vim/syntax/md.vim

Install using your favorite package manager: Plug, Plugin, or Pathogen.

For preview support, install Mark.

Set g:md_fenced_languages to configure your fenced code blocks. For example: let g:md_fenced_languages = ['javascript', 'js=javascript', 'json=javascript']

Usage

# in ~/.vimrc:
filetype plugin on                     " if you don't already have it
au bufnewfile,bufread *.md set ft=md
au bufreadpost *.md call md#setup("q") " where q is your leader key

Setup Vim to automatically load plugin. Shortcuts include:

  • <leader>= turns current line into h1
  • <leader>- turns current line into h2
  • <leader>l re-numbers ordered lists
  • <leader>x toggles a task line
  • <leader>t formats a table
  • <leader>z folds current file according to headers
  • <leader>p preview in browser