aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-04-30 16:37:22 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-04-30 16:37:22 -0500
commit594877882bfaf4db8b2af15f5254eda273db1ab7 (patch)
treec66422db5d16a4d4d1d2694a95e755b8b375dad4
parent64c9b0a4bb353cefae57c2292e4fba52c839d77d (diff)
downloadvim-textobj-594877882bfaf4db8b2af15f5254eda273db1ab7.tar.gz
vim-textobj-594877882bfaf4db8b2af15f5254eda273db1ab7.zip
handle the cursor starting out on whitespace or a comma by repositioning it before running the function
-rw-r--r--vimrc11
1 files changed, 11 insertions, 0 deletions
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! \<BS>"
+ 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]