Vim Plugin that extends ci" to ci(, ci{, ci[, ci< with forward and backward searching as well.
One of Vim's best and seldom known features is that ci" and ci' ( but not ci(, ci{, ci[, ci< ) still executes "change inner quote" even if the cursor is not inside the quotes, but before the quotes (on the same line).
ciBracket is a script that extends this functionality to work on brackets as well as quotes. Now you can manipulate any text between quotes or brackets on the same line no matter where the cursor is. Which means significantly less horizontal line movement with cursor
- Let X denote the particular bracket or quote you would like to edit between.
- Let ^ denote the position of cursor
- Ofcourse this works with any of (, {, [, <, ", ' but for examples I will just use brackets.
- before:
cout << some_function(arg1 ^, arg2) << endl; - after:
cout << some_function(^) << endl;
If the cursor is not already between brackets, but is on the same line as a pair of brackets, ciX jumps forward or backwards to it
- before:
cout << som^e_function(arg1 , arg2) << endl;orcout << some_function(arg1, arg2) << en^dl; - after:
cout << some_function(^) << endl;
ciX edits the immediate brackets
- before:
cout << some_function(ar^g1) << ", " << another_function(arg2) << endl; - after:
cout << some_function(^) << ", " << another_function(arg2) << endl;
another example
- before:
cout << some_function(ar^g1, sizeof(arg2) ) << ", " << another_function(arg2) << endl; - after:
cout << some_function(^) << ", " << another_function(arg2) << endl;
cIX (capital I) edits the other brackets
- before:
cout << some_function(ar^g1) << ", " << another_function(arg2) << endl; - after:
cout << some_function(arg1) << ", " << another_function(^) << endl;
another example
- before:
cout << some_function(ar^g1, sizeof(arg2) ) << endl; - after:
cout << some_function(sizeof(^)) << endl;
Install using your favorite package manager:
- Vim Plug example: `Plug 'Spenny1068/ciBracket'
Copyright (c) Spencer Lall. Distributed under the same terms as Vim itself.
See :help license.