Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function! SplitRegex()
    setlocal buftype=nofile bufhidden=hide noswapfile
    let numlines=len(@")
    execute "normal! V".numlines."pggjl"
    let tmp=@z
    let @z="hv0r wlv$r j"
    execute "normal! ".(numlines-2)."@z"
    let @z=tmp
    execute "normal! gglv$r\<space>"
    xnoremap <buffer> <SPACE> <Esc>:let tmp=@/<CR>gvJ:s;\S\zs\s\+\ze\S;;g \| let @/=tmp \| unlet tmp<CR>
    nmap <SPACE> Vj<SPACE>
xnoremap ,r y:call SplitRegex()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment