Skip to content

Instantly share code, notes, and snippets.

@rbnvrw
Created March 15, 2016 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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