Change-inside-surroundings.vim

Because memory is a fragile thing


Project maintained by briandoll Hosted on GitHub Pages — Theme by mattgraham

change-inside-surroundings.vim

change-inside-surroundings.vim provides two commands:

Examples

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:

Change inside curly braces:

Change inside brackets:

Change inside quotes:

Change-inside-surroundings.vim makes this simpler

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

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

Installation

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

cd ~/.vim/bundle
git clone git://github.com/briandoll/change-inside-surroundings.vim.git

License

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