There's an exception to the i{ text object that ignores ignores leading
whitespace before the final } character. I think it would be useful if this
extended to the i( and i[ text objects as well. In particular, as a PHP
developer, I run into code like this a lot:
$foo = array(
'one' => 'some value',
'two' => 'some other value',
'three' => 'yet another value',
);
With the current implementation, the i( object is not very useful when there is
indentation before the closing ) character. Typing ci( would leave me here
(cursor marked by a | character):
$foo = array(
|);
This is never useful to me, and requires a great deal more effort to accomplish
what I was hoping for.
My patch extends the exception used in i{ to i( and i[ as well. While I
personally don't have a use case for this behaviour in i[, I think it's easy to
agree that it should behave the same way as its brackety companions.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r bed71c37618c src/search.c
--- a/src/search.c Thu May 29 14:36:29 2014 +0200
+++ b/src/search.c Thu Jun 12 13:24:42 2014 -0400
@@ -3608,7 +3608,8 @@
/*
* Try to exclude the '(', '{', ')', '}', etc. when "include" is FALSE.
- * If the ending '}' is only preceded by indent, skip that indent.
+ * If the ending '}', ')', or ']' is only preceded by indent, skip that
+ * indent.
* But only if the resulting area is not smaller than what we started with.
*/
while (!include)
@@ -3616,7 +3617,7 @@
incl(&start_pos);
sol = (curwin->w_cursor.col == 0);
decl(&curwin->w_cursor);
- if (what == '{')
+ if (what == '{' || what == '(' || what == '[')
while (inindent(1))
{
sol = TRUE;