From 3a7eb8a609d649e44cc62f6746a077c08b80d50f Mon Sep 17 00:00:00 2001 From: lolson Date: Thu, 9 Jul 2015 16:28:28 -0500 Subject: [PATCH] testing --- plugin/makecols.vim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugin/makecols.vim b/plugin/makecols.vim index ff67427..11f03da 100644 --- a/plugin/makecols.vim +++ b/plugin/makecols.vim @@ -2,17 +2,19 @@ " Author: Levi Olson " Version: 1.0 -function! s:beep() - exe "norm! \" - return "" -endfunction - function! s:makecols() - let lines = getpos("'<")-getpos("'>") - echo lines - return s:beep() + return s:get_visual_selection() endfunction +function! s:get_visual_selection() + let [lnum1, col1] = getpos("'<")[1:2] + let [lnum2, col2] = getpos("'>")[1:2] + let lines = getline(lnum1, lnum2) + let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)] + let lines[0] = lines[0][col1 - 1:] + return lines + " return join(lines, "\n") +endfunction