Created
May 23, 2013 23:42
-
-
Save dahu/5640326 to your computer and use it in GitHub Desktop.
Bubble visual selection horizontally within the line - primer
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
" BubbleLeft() | |
" Demo of bubbling in visual mode | |
" Barry Arthur, 2013-05-24 | |
" When you get BubbleRight() working, collapse them into a | |
" single Bubble(dir) function. | |
function! BubbleLeft() | |
let sel_save = &selection | |
let &selection = "inclusive" | |
let reg_save = @@ | |
normal! `<v`>x | |
let len = len(@@) | |
normal! hP | |
exe "normal! v" . (len - 1) . "h" | |
let &selection = sel_save | |
let @@ = reg_save | |
endfunction | |
vnoremap <left> :<c-u>call BubbleLeft()<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment