I try to write a Python code, which find all the stinrgs and replace it with an other. This code works, but I must select all the strings manually. The best solution will be, I push my defined key and the Python script find and replace all my defined strings.
Please can some one help me with some examples or snippets.
- Code: Select all
import sublime, sublime_plugin, re
def run(self, edit):
REPL_STRING = "PAC"
for region in self.view.sel():
content = self.view.substr(region)
content = content.replace('SEARCH_STRING', REPL_STRING)
self.view.replace(edit, region, content)