Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creates the "find" tag and removes that functionality from "find_and_replace" #1404

Merged
merged 10 commits into from
Jun 1, 2024
6 changes: 5 additions & 1 deletion apps/eclipse/eclipse_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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")
Expand Down
6 changes: 5 additions & 1 deletion apps/notepad++/notepad++_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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"""

Expand Down
6 changes: 5 additions & 1 deletion apps/visualstudio/visual_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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")
Expand Down
6 changes: 5 additions & 1 deletion apps/vscode/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,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"""
Expand All @@ -292,6 +292,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:
Expand Down
3 changes: 2 additions & 1 deletion tags/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions tags/find/find.py
Original file line number Diff line number Diff line change
@@ -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"""
10 changes: 10 additions & 0 deletions tags/find/find.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tag: user.find
-
hunt this: user.find("")
hunt this (pace | paste):
user.find("")
sleep(25ms)
edit.paste()
hunt this <user.text>: user.find(text)
hunt next: user.find_next()
maxbruening marked this conversation as resolved.
Show resolved Hide resolved
hunt previous: user.find_previous()
9 changes: 0 additions & 9 deletions tags/find_and_replace/find_and_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down
10 changes: 2 additions & 8 deletions tags/find_and_replace/find_and_replace.talon
Original file line number Diff line number Diff line change
@@ -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.text>: user.find(text)
tag(): user.find

hunt all: user.find_everywhere("")
hunt all (pace | paste):
user.find_everywhere("")
Expand All @@ -15,8 +11,6 @@ hunt all <user.text>: 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.text>]: user.replace(text or "")
replace all: user.replace_everywhere("")
replace <user.text> all: user.replace_everywhere(text)
Expand Down