diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-30 16:37:22 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-30 16:37:22 -0500 |
commit | 594877882bfaf4db8b2af15f5254eda273db1ab7 (patch) | |
tree | c66422db5d16a4d4d1d2694a95e755b8b375dad4 | |
parent | 64c9b0a4bb353cefae57c2292e4fba52c839d77d (diff) | |
download | vim-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-- | vimrc | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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] |