Created
February 18, 2014 18:00
-
-
Save nelstrom/9076232 to your computer and use it in GitHub Desktop.
An autocommand to set up pandoc to reformat HTML with Vim's `gq{operator}` command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! FormatprgLocal(filter) | |
if !empty(v:char) | |
return 1 | |
else | |
let l:command = v:lnum.','.(v:lnum+v:count-1).'!'.a:filter | |
echo l:command | |
execute l:command | |
endif | |
endfunction | |
if has("autocmd") | |
let pandoc_pipeline = "pandoc --from=html --to=markdown" | |
let pandoc_pipeline .= " | pandoc --from=markdown --to=html" | |
autocmd FileType html setlocal formatexpr=FormatprgLocal(pandoc_pipeline) | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
FormatprgLocal()
function is based on the code attached to this vim-fish issue.