Reputation: 131
How to write a key binding to replace specific character to another one?
For example I want to replace "[" and "]" to empty string "".
Upvotes: 0
Views: 112
Reputation: 102922
Unfortunately, to make a custom key binding you would need to write a plugin in Python to do the finding and replacing, as there are no built-in commands for doing so. However, what you want to do is easily accomplished using the Find -> Replace...
dialog. Make sure the regular expressions button is selected, then put \[|\]
in the Find What:
box, and nothing in the Replace With:
box (it's best to put your cursor in there and delete everything, just in case there are invisible characters such as spaces or tabs there). Hit Replace to replace characters one at a time, or Replace All to replace all of them in one go.
Upvotes: 1