Last active
October 5, 2015 05:57
-
-
Save connermcd/2759774 to your computer and use it in GitHub Desktop.
How to ask for help on #vim
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
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