find_and_replace.py (1393B)
1 from talon import Context, actions, ui, Module, app 2 from typing import Union 3 4 mod = Module() 5 mod.tag("find_and_replace", desc="Tag for enabling generic find and replace commands") 6 7 8 @mod.action_class 9 class Actions: 10 def find(text: str): 11 """Finds text in current editor""" 12 13 def find_next(): 14 """Navigates to the next occurrence""" 15 16 def find_previous(): 17 """Navigates to the previous occurrence""" 18 19 def find_everywhere(text: str): 20 """Finds text across project""" 21 22 def find_toggle_match_by_case(): 23 """Toggles find match by case sensitivity""" 24 25 def find_toggle_match_by_word(): 26 """Toggles find match by whole words""" 27 28 def find_toggle_match_by_regex(): 29 """Toggles find match by regex""" 30 31 def replace(text: str): 32 """Search and replace for text in the active editor""" 33 34 def replace_everywhere(text: str): 35 """Search and replaces for text in the entire project""" 36 37 def replace_confirm(): 38 """Confirm replace at current position""" 39 40 def replace_confirm_all(): 41 """Confirm replace all""" 42 43 def select_previous_occurrence(text: str): 44 """Selects the previous occurrence of the text, and suppresses any find/replace dialogs.""" 45 46 def select_next_occurrence(text: str): 47 """Selects the next occurrence of the text, and suppresses any find/replace dialogs."""