Skip to content

Spenny1068/ciBracket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ciBracket

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

Use cases

  • 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.

If the cursor is already between brackets, ciX uses Vim's default functionality
  • 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; or cout << some_function(arg1, arg2) << en^dl;
  • after: cout << some_function(^) << endl;

if cursor is already between brackets with another pair of brackets on the same line.\

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;

Installation

Install using your favorite package manager:

  • Vim Plug example: `Plug 'Spenny1068/ciBracket'

License

Copyright (c) Spencer Lall. Distributed under the same terms as Vim itself. See :help license.

About

Vim Plugin for ci), ci}, ci], ci>, etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors