Skip to content

Instantly share code, notes, and snippets.

@rbnvrw
Created March 15, 2016 21:38
Show Gist options
  • Save rbnvrw/0dc2fcfe2b43de1d7d7d to your computer and use it in GitHub Desktop.
Save rbnvrw/0dc2fcfe2b43de1d7d7d to your computer and use it in GitHub Desktop.
Pandoc tables
function! s:tablePandoc() range
exe "'<,'>Tabularize /|"
let hsepline= substitute(getline("."),'[^|]','-','g')
exe "norm! o" . hsepline
exe "'<,'>s/-|/ |/g"
exe "'<,'>s/|-/| /g"
exe "'<,'>s/^| \\|\\s*|$\\||//g"
exe "'<,'>!pandoc -f markdown -t rst"
endfunction
command! -range=% TablePandoc :call <SID>tablePandoc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment