Skip to content

Instantly share code, notes, and snippets.

@connermcd
Last active October 5, 2015 05:57
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 connermcd/2759774 to your computer and use it in GitHub Desktop.
Save connermcd/2759774 to your computer and use it in GitHub Desktop.
How to ask for help on #vim
I want to visually select this and hit \t
| thi s | is | a | test | of |
| epic | proportions | that | i'm | trying |
| out | today | as | I | make |
| this | table | with | tabul | arize |
to make it look like this:
thi s is a test of
===== =========== ==== ===== ======
epic proportions that i'm trying
out today as I make
this table with tabul arize
This is what I have:
vnoremap <leader>t :call <SID>table()<cr>
function! s:table()
mark a
let hsepline= substitute(getline("."),'[^|]','=','g')
exe "norm! o" . hsepline
exe "'a,'>s/=|/ |/g"
exe "'a,'>s/|=/| /g"
exe "'a,'>s/^| \\| |$\\||//g"
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment