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

Created a centralized please command #1537

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/arc/arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ def tab_close_wrapper():
actions.sleep("180ms")
actions.app.tab_close()

def command_search(command: str = ""):
actions.key("cmd-l")
if command != "":
actions.sleep("200ms")
actions.insert(command)


@ctx.action_class("browser")
class BrowserActions:
Expand Down
6 changes: 1 addition & 5 deletions apps/arc/arc_mac.talon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@ os: mac
-
tag(): browser
tag(): user.tabs

please [<user.text>]:
key("cmd-l")
sleep(200ms)
insert(user.text or "")
tag(): user.command_search
5 changes: 1 addition & 4 deletions apps/eclipse/eclipse.talon
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ tag(): user.line_commands
# tag(): user.multiple_cursors
tag(): user.splits
tag(): user.tabs
tag(): user.command_search
# splits.py support end

please [<user.text>]:
key(ctrl-3)
insert(user.text or "")

# Sidebar
bar explore: key(alt-shift-w p)
# bar extensions:
Expand Down
5 changes: 5 additions & 0 deletions apps/eclipse/eclipse_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ def split_window_vertically():
def split_window():
actions.key("alt-ctrl-s s")

def command_search(command: str = ""):
actions.key("ctrl-3")
if command != "":
actions.insert(command)

# splits.py support end

# find_and_replace.py support begin
Expand Down
7 changes: 6 additions & 1 deletion apps/jetbrains/jetbrains.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def select_range(line_start: int, line_end: int):
# if it's a single line, select the entire thing including the ending new-line5
if line_start == line_end:
actions.user.idea(f"goto {line_start} 0")
actions.user.idea("action EditorSelectLine"),
actions.user.idea("action EditorSelectLine")
else:
actions.user.idea(f"range {line_start} {line_end}")

Expand All @@ -314,6 +314,11 @@ def camel_left():
def camel_right():
actions.user.idea("action EditorNextWordInDifferentHumpsMode")

def command_search(command: str = ""):
actions.user.idea("action GotoAction")
if command != "":
actions.insert(command)

def line_clone(line: int):
actions.user.idea(f"clone {line}")

Expand Down
7 changes: 2 additions & 5 deletions apps/jetbrains/jetbrains.talon
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ tag(): user.line_commands
tag(): user.multiple_cursors
tag(): user.splits
tag(): user.tabs
tag(): user.command_search
# multiple_cursors.py support end

# Auto complete
Expand All @@ -14,11 +15,7 @@ smart: user.idea("action SmartTypeCompletion")
(done | finish): user.idea("action EditorCompleteStatement")
# Copying
grab <number>: user.idea_grab(number)
# Actions
(action | please): user.idea("action GotoAction")
(action | please) <user.text>:
jaresty marked this conversation as resolved.
Show resolved Hide resolved
user.idea("action GotoAction")
insert(text)
action [<user.text>]: user.deprecate_command("2024-09-02", "action", "please")
# Refactoring
refactor: user.idea("action Refactorings.QuickListPopupAction")
refactor <user.text>:
Expand Down
6 changes: 6 additions & 0 deletions apps/vivaldi/vivaldi.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def tab_close_wrapper():
def tab_jump(number: int):
actions.key(f"ctrl-{number}")

def command_search(command: str = ""):
actions.user.vivaldi_toggle_quick_commands()
if command != "":
actions.sleep("180ms")
actions.insert(command)


@ctx.action_class("browser")
class BrowserActions:
Expand Down
6 changes: 1 addition & 5 deletions apps/vivaldi/vivaldi.talon
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ app: vivaldi
-
tag(): browser
tag(): user.tabs
tag(): user.command_search

(sidebar | panel) history: user.vivaldi_history_panel()
(sidebar | panel) downloads: user.vivaldi_downloads_panel()
(sidebar | panel) bookmarks: user.vivaldi_bookmarks_panel()
(sidebar | panel) notes: user.vivaldi_notes_panel()

please [<user.text>]:
user.vivaldi_toggle_quick_commands()
sleep(180ms)
insert(user.text or "")
5 changes: 5 additions & 0 deletions apps/vscode/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ def multi_cursor_select_more_occurrences():
def multi_cursor_skip_occurrence():
actions.user.vscode("editor.action.moveSelectionToNextFindMatch")

def command_search(command: str = ""):
actions.user.vscode("workbench.action.showCommands")
if command != "":
actions.insert(command)

def tab_jump(number: int):
if number < 10:
if is_mac:
Expand Down
6 changes: 2 additions & 4 deletions apps/vscode/vscode.talon
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ tag(): user.line_commands
tag(): user.multiple_cursors
tag(): user.splits
tag(): user.tabs
tag(): user.command_search

window reload: user.vscode("workbench.action.reloadWindow")
window close: user.vscode("workbench.action.closeWindow")
#multiple_cursor.py support end

please [<user.text>]:
user.vscode("workbench.action.showCommands")
insert(user.text or "")

go view [<user.text>]:
user.vscode("workbench.action.openView")
insert(user.text or "")
Expand Down
13 changes: 13 additions & 0 deletions tags/please_command/please_command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from talon import Module

mod = Module()
mod.tag(
"command_search",
desc="A command for running an arbitrary command based on a search",
)


@mod.action_class
class command_search_actions:
def command_search(command: str = ""):
"""Searches for command based on text"""
3 changes: 3 additions & 0 deletions tags/please_command/please_command.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tag: user.command_search
-
^please [<user.text>]$: user.command_search(user.text or "")