From 594877882bfaf4db8b2af15f5254eda273db1ab7 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Wed, 30 Apr 2008 16:37:22 -0500 Subject: handle the cursor starting out on whitespace or a comma by repositioning it before running the function --- vimrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vimrc b/vimrc index a42e6e6..092c92c 100644 --- a/vimrc +++ b/vimrc @@ -406,6 +406,17 @@ call Textobj('f', 'Textobj_fold') " , for function arguments {{{ function Textobj_arg(inner, count) let pos = getpos('.') + let curchar = getline(pos[1])[pos[2] - 1] + if curchar == ',' + exe "normal! \" + let pos = getpos('.') + let curchar = getline(pos[1])[pos[2] - 1] + endif + while curchar =~ '\s' + normal! W + let pos = getpos('.') + let curchar = getline(pos[1])[pos[2] - 1] + endwhile let line = strpart(getline(pos[1]), 0, pos[2]) let lines = getline(1, pos[1] - 1) + [line] -- cgit v1.2.3-54-g00ecf