Awesome Open Source
Awesome Open Source


change-inside-surroundings.vim provides a single command :ChangeInsideSurrounding (also accessible via <leader>ci) that will change the contents of the innermost 'surrounding'.


Vim already provides fairly easy ways to change the 'surrounding' as long as you specify the opening 'surrounding' character. Vim also understands HTML and XML tags, so you can change inside those as well. I wanted a single command that would intelligently just do the right thing.

Normal Vim can do this:

Change inside an HTML tag:

  • Given: <div>London Calling</div>
  • To replace the contents of the div tag I can use: cit

Change inside curly braces:

  • Given: { death: "or glory!" }
  • To replace the contents of the curly braces I can use: ci{

Change inside brackets:

  • Given: [ Clampdown those Spanish Bombs ]
  • To replace the contents of the square brackets I can use: ci[

Change inside quotes:

  • Given: "The Guns of Brixton"
  • To replace the contents of the quotes I can use: ci"

I wanted something simpler. This plugin provides a single command that works for all of these examples.

Currently supported surroundings are: {}, (), "", ><, [], '', ``


:ChangeInsideSurrounding or <leader>ci will remove the contents of the innermost 'surrounding', leaving you in insert mode.

:ChangeAroundSurrounding or <leader>cas will remove the entire text object, including the 'surrounding' characters, leaving you in insert mode.


If you're using pathogen.vim, just copy and paste:

cd ~/.vim/bundle
git clone git://


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

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
vim-script (1,293
vim (853
viml (513
editor (455
character (31
quotes (22

Find Open Source By Browsing 7,000 Topics Across 59 Categories