Key Bind Regex Find and Replace


I’m trying to bind a find-and-replace query to a key so that the following is executed when a series of buttons is pressed:

Regex Find-and-replace: | with \n |

Does anyone have experience doing this sort of thing?


No, but you can do it in your file or better yet a package.


Is what I’m trying to effect called something particular that would help with searching?

Is there a similar implementation that would be useful as a guide?


It’s all in the API. Go there and look up “commands” and "texteditor and/or “textbuffer” commands. Doing a regex on the buffer is a supported API operation.


You’re looking for the TextEditor.scan method for performing the search and replace function. And if you search for here on Discuss, there are plenty of examples of creating commands in your … this topic has a number of samples:


Thanks – this will get me started!