KillBrackets : Removes matching brackets/parens. Very handy in LISP/Scheme
| script karma
Downloaded by 427
Comments, bugs, improvements
script versions (upload new version)
|This script adds a feature I've often missed when hacking away at some code in Vim.
I recommend adding a keybinding, such as "<Leader>) :Killbracks"
To use it, just place the cursor on top of either a closing or opening bracket while in normal mode (vim will highlight the other one) and either type ":Killbracks" or use the keybinding you just added.
Problems (IMPORTANT FOR LISP):
There are problems associated with parens and bracks inside of quotes messing with "the order of things." Killbrackets is set up to ignore everything within "double quotes" and 'single quotes' but if you're programming in a language that uses 'single quotes' for something completely different (like in LISP) you might be in trouble, if you had something like '(LIST OF STUFF) in your program.
To fix this, you go into the "KillBrackets.vim" file and search for "QUOTES SETTINGS" then uncomment the behaviour you want, and comment the behaviour you don't want (explained a bit further in the source)
Note that if you are "(inside quotes)" or '(inside quotes)', KillBrackets will do it's magic perfectly if the parens inside of the quotes are correctly matched. But if you are outside of the quotes ("wasd)wasd") KillBrackets will ignore everything within the quotes and only kill the matching bracket on the outside, and you'll end up with "wasd)wasd".
Put the "KillBrackets.vim" file inside ~/.vim/plugin/ and restart vim
Put the "KillBrackets.vim" file inside C:\Program Files (x86)\Vim\vim74\plugin (requires admin rights) and restart vim.
Click on the package to download.
ip used for rating: 18.104.22.168