Home

Awesome

Literate.vim

This is a vim plugin for the [Literate] (https://github.com/zyedidia/Literate) programming system.

See the Literate Manual for how to use it.

This plugin provides all sorts of niceties like syntax highlighting (it correctly syntax highlights the language embedded in code blocks using information from the @code_type), and keybindings to let you jump between code blocks. Also, if you have Syntastic or Neomake installed then this plugin will report errors from inside vim. If you use the @compiler feature of Literate, this plugin will even report compiler errors from any compiler or linter (like gcc, pyflakes, jshint...).

This plugin also integrates with Tagbar.

When you first open a .lit file, vim will syntax highlight commands like @code_type, and @title... correctly, but it will not syntax highlight the embedded code blocks right away. This is because when you opened the empty file, the code type was not defined, so vim was unable to know what language you are using. You can execute :e to reload the syntax highlighting (make sure the file is saved) once you have defined the codetype with the @code_type command.

Installation

To install, just use your favorite plugin manager:

Vundle:

Plugin 'zyedidia/literate.vim'

To get the most out of the plugin you should also install either Neomake or Syntastic:

Plugin 'scrooloose/syntastic'
" Or
Plugin 'benekastah/neomake'

You can also get ctags integration by installing Tagbar (you also need exuberant ctags installed):

Plugin 'majutsushi/tagbar'

Then add the following to your ~/.ctags file:

--langdef=literate
--langmap=literate:+.lit
--regex-literate=/^@s[ \t]+(.+)/\1/s,section/i
--regex-literate=/^---[ \t](.+)/\1/c,code/i
--regex-literate=/@{(.*)}/\1/i,includes/i

Mappings

Literate.vim has three mappings:

These are just default mappings and can be remapped in your .vimrc:

let g:literate_find_codeblock = "<C-]>"
let g:literate_open_code = "<leader>c"
let g:literate_open_html = "<leader>h"