Created
October 26, 2013 19:21
-
-
Save mhinz/7173477 to your computer and use it in GitHub Desktop.
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
" | |
" Works in visual line and visual block mode. | |
" | |
" Select one character more in visual block mode... | |
" | |
function! Transform(prefix, suffix) | |
let [startcol, endcol ] = [col("'<"), col("'>") ] | |
let [startline, endline] = [line("'<"), line("'>")] | |
let startcol = '%'. (startcol ? startcol : 1) .'c' | |
let endcol = endcol ? ('%'. (endcol) .'c') : '%10c' | |
execute startline.','.endline.'s/\v'.startcol.'(.*)'.endcol.'/'.a:prefix.'\1'.a:suffix.'/' | |
endfunction | |
vnoremap <leader>M :<c-u>call Transform('<% ', ' %>')<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment