diff --git a/apps/eclipse/eclipse_win.py b/apps/eclipse/eclipse_win.py index 4a974e560f..2df9020c66 100644 --- a/apps/eclipse/eclipse_win.py +++ b/apps/eclipse/eclipse_win.py @@ -110,7 +110,7 @@ def split_window(): # splits.py support end - # find_and_replace.py support begin + # find.py support begin def find(text: str): """Triggers find in current editor""" @@ -125,6 +125,10 @@ def find_next(): def find_previous(): actions.key("shift-enter") + # find.py support end + + # find_and_replace.py support begin + def find_everywhere(text: str): """Triggers find across project""" actions.key("ctrl-h") diff --git a/apps/notepad++/notepad++_win.py b/apps/notepad++/notepad++_win.py index eb522ed1c8..0b22befb29 100644 --- a/apps/notepad++/notepad++_win.py +++ b/apps/notepad++/notepad++_win.py @@ -96,7 +96,7 @@ def tab_final(): print("Notepad doesn't support this...") # actions.key("ctrl-numpad_0") - # find_and_replace.py support begin + # find.py support begin def find(text: str): """Triggers find in current editor""" @@ -111,6 +111,10 @@ def find_next(): def find_previous(): actions.key("shift-enter") + # find.py support end + + # find_and_replace.py support begin + def find_everywhere(text: str): """Triggers find across project""" diff --git a/apps/visualstudio/visual_studio.py b/apps/visualstudio/visual_studio.py index d4dc99b313..a86da7de6f 100644 --- a/apps/visualstudio/visual_studio.py +++ b/apps/visualstudio/visual_studio.py @@ -165,7 +165,7 @@ class UserActions: # splits.py support end - # find_and_replace.py support begin + # find.py support begin def find(text: str): """Triggers find in current editor""" @@ -180,6 +180,10 @@ def find_next(): def find_previous(): actions.key("shift-enter") + # find.py support end + + # find_and_replace.py support begin + def find_everywhere(text: str): """Triggers find across project""" actions.key("ctrl-shift-f") diff --git a/apps/vscode/vscode.py b/apps/vscode/vscode.py index 0e7844912d..edd68f03f3 100644 --- a/apps/vscode/vscode.py +++ b/apps/vscode/vscode.py @@ -276,7 +276,7 @@ def split_number(index: int): # splits.py support end - # find_and_replace.py support begin + # find.py support begin def find(text: str): """Triggers find in current editor""" @@ -294,6 +294,10 @@ def find_next(): def find_previous(): actions.user.vscode("editor.action.previousMatchFindAction") + # find.py support end + + # find_and_replace.py support begin + def find_everywhere(text: str): """Triggers find across project""" if is_mac: diff --git a/tags/README.md b/tags/README.md index 9596ff36d3..aa90373e35 100644 --- a/tags/README.md +++ b/tags/README.md @@ -7,7 +7,8 @@ The tags folder has several other subfolders containing various commands: - `debugger` has commands for use within debuggers such as GDB and WinDbg - `emoji` has commands for using emojis, emoticons, and kaomoji. In this repository, the tags activating them are only present within the Discord and Slack `.talon` files - `file_manager` has commands for navigating files and folders within a file explorer or terminal, as described in the top level [README](https://github.com/talonhub/community?tab=readme-ov-file#file-manager-commands) -- `find_and_replace` has commands for finding, selecting, and replacing text +- `find` has simple commands for finding text +- `find_and_replace` has more advanced commands for finding, selecting, and replacing text - `line_commands` has commands for navigating to and modifying the numbered lines of text within a text editor or IDE - `messaging` has commands for navigating multi-channel messaging applications - `multiple_cursors` has commands for managing multiple cursors in a text editor or IDE diff --git a/tags/find/find.py b/tags/find/find.py new file mode 100644 index 0000000000..eb8d5bb79d --- /dev/null +++ b/tags/find/find.py @@ -0,0 +1,16 @@ +from talon import Module + +mod = Module() +mod.tag("find", desc="Tag for enabling generic find commands") + + +@mod.action_class +class Actions: + def find(text: str): + """Finds text in current editor""" + + def find_next(): + """Navigates to the next occurrence""" + + def find_previous(): + """Navigates to the previous occurrence""" diff --git a/tags/find/find.talon b/tags/find/find.talon new file mode 100644 index 0000000000..17239d5966 --- /dev/null +++ b/tags/find/find.talon @@ -0,0 +1,10 @@ +tag: user.find +- +hunt this: user.find("") +hunt this (pace | paste): + user.find("") + sleep(25ms) + edit.paste() +hunt this : user.find(text) +hunt next: user.find_next() +hunt previous: user.find_previous() diff --git a/tags/find_and_replace/find_and_replace.py b/tags/find_and_replace/find_and_replace.py index 28d1279403..00c1556713 100644 --- a/tags/find_and_replace/find_and_replace.py +++ b/tags/find_and_replace/find_and_replace.py @@ -6,15 +6,6 @@ @mod.action_class class Actions: - def find(text: str): - """Finds text in current editor""" - - def find_next(): - """Navigates to the next occurrence""" - - def find_previous(): - """Navigates to the previous occurrence""" - def find_everywhere(text: str): """Finds text across project""" diff --git a/tags/find_and_replace/find_and_replace.talon b/tags/find_and_replace/find_and_replace.talon index d05bada787..2e3eb839d9 100644 --- a/tags/find_and_replace/find_and_replace.talon +++ b/tags/find_and_replace/find_and_replace.talon @@ -1,11 +1,7 @@ tag: user.find_and_replace - -hunt this: user.find("") -hunt this (pace | paste): - user.find("") - sleep(25ms) - edit.paste() -hunt this : user.find(text) +tag(): user.find + hunt all: user.find_everywhere("") hunt all (pace | paste): user.find_everywhere("") @@ -15,8 +11,6 @@ hunt all : user.find_everywhere(text) hunt case: user.find_toggle_match_by_case() hunt word: user.find_toggle_match_by_word() hunt expression: user.find_toggle_match_by_regex() -hunt next: user.find_next() -hunt previous: user.find_previous() replace this []: user.replace(text or "") replace all: user.replace_everywhere("") replace all: user.replace_everywhere(text)