TransWikia.com

Using 'd%' to delete a bracket pair and its contents is now broken

Vi and Vim Asked by D Culley on August 31, 2021

I’ve long been editing code in Vim 7.4 with matchit and matchparen plugins. In my old setup it was easy to delete { some string } by placing the cursor on the { and then use the d% command.

I’ve now moved to a new computer system (and new job) with a fresh install of Vim 8.2 and I believe I’ve got the same plugins, but now when I use the d% command, it keeps the closing }.

This change in behavior now makes editing my code much more cumbersome as I have to deal with the closing } (or [)], etc]) separately.

Could someone who understands the plugins or key mapping please tell me how to get back to the behavior where the terminating character is also deleted (or selected/yanked/etc).

One Answer

Thank you to filbranden for expanding my Vim command library with the :map % and da{ / di{ commands - those will surely prove useful.

Using those commands, and some useful diff tools, I identified that I was using a badly obsolete version of matchit. Deleting my bad plugin, and following the instructions in :help matchit-install, I was able to correct my installation, and return to the expected behavior of d%

.

Answered by D Culley on August 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP