Last active
August 27, 2015 12:32
-
-
Save digital-carver/668e7bb496f1fc20f2fc to your computer and use it in GitHub Desktop.
An `after/plugin` function for Tabular.vim to allow PCRE (using eregex.vim)
This file contains hidden or 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
if exists(':E2v') | |
function! AlignByRE() range | |
let range = a:firstline . ',' . a:lastline | |
let cmd = range | |
let re = input('Enter PCRE to align by: ') | |
if re == "" | |
" Run empty to use previous pattern | |
let cmd .= 'Tabularize' | |
execute cmd | |
else | |
let vim_re = E2v(re) | |
let cmd .= 'Tabularize/' . vim_re | |
endif | |
execute cmd | |
endfunction | |
nnoremap <leader>A :call AlignByRE()<CR> | |
vnoremap <leader>A :call AlignByRE()<CR> | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment