Skip to content

Commit

Permalink
Merge branch 'main' of github.com:talonhub/community
Browse files Browse the repository at this point in the history
* 'main' of github.com:talonhub/community: (23 commits)
  Add menu choosing helper from pokey_talon (talonhub#1393)
  Delete dead Windows-specific code (talonhub#1441)
  Add space after Kotlin keywords so that you can chain in keyword commands (talonhub#1429)
  Creates the "find" tag and removes that functionality from "find_and_replace" (talonhub#1404)
  More emacs commands, including xref commands (go-to-definition) (talonhub#1443)
  allow "help last" as synonym for "help previous" (talonhub#1444)
  imperative: Add `state match` alias for Python/Rust (talonhub#1440)
  Get vscode.py to recognize cursor IDE for macos (talonhub#1436)
  Update talonfmt (talonhub#1434)
  micro-optimization for dictation_insert (talonhub#1422)
  [pre-commit.ci] pre-commit autoupdate (talonhub#1417)
  define "zoom reset" for VSCode (talonhub#1420)
  Get snippets actions (talonhub#1315)
  Add basic kotlin support (talonhub#1408)
  [pre-commit.ci] pre-commit autoupdate (talonhub#1413)
  Support for Foxit Reader for PDFs (talonhub#1403)
  Meld (talonhub#1402)
  Add vscode command to search for views by name (talonhub#1390)
  Talon v0.4 support: common commands for talon python / talon files / .talon-list files (talonhub#1240)
  [pre-commit.ci] pre-commit autoupdate (talonhub#1389)
  ...
  • Loading branch information
sisi-sh committed Jun 3, 2024
2 parents f150dff + 43974b9 commit eeb8de3
Show file tree
Hide file tree
Showing 55 changed files with 852 additions and 146 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
minimum_pre_commit_version: "3.2.0"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -35,18 +35,18 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
rev: 24.4.0
hooks:
- id: black
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
rev: v1.5.5
hooks:
- id: remove-tabs
types: [file]
files: \.talon$
args: ["--whitespaces-count=4"]
- repo: https://github.com/wenkokke/talonfmt
rev: 1.10.1
rev: 1.10.2
hooks:
- id: talonfmt
args: ["--in-place"]
1 change: 1 addition & 0 deletions BREAKING_CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ applied given the delay between changes being submitted and the time they were r
and merged.

---
* 2024-05-30 Deprecate 'drop down <user.number_small>' in favor of overridable 'choose' helper
* 2024-01-27 Deprecate '<user.number_string>' command without a spoken prefix like `numb`.
See `numbers.talon` and `numbers_unprefixed.talon.` If in the future you want to still use
unprefixed numbers, you will need to comment out the
Expand Down
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
13 changes: 12 additions & 1 deletion apps/emacs/emacs.talon
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@ rectangle (yank | paste): user.emacs("yank-rectangle")
rectangle copy: user.emacs("copy-rectangle-as-kill")
rectangle number lines: user.emacs("rectangle-number-lines")

# ----- XREF SUPPORT ----- #
[xref] find definition: user.emacs("xref-find-definitions")
[xref] find definition other window: user.emacs("xref-find-definitions-other-window")
[xref] find definition other frame: user.emacs("xref-find-definitions-other-frame")
[xref] find references: user.emacs("xref-find-references")
[xref] find references [and] replace: user.emacs("xref-find-references-and-replace")
xref find apropos: user.emacs("xref-find-apropos")
xref go back: user.emacs("xref-go-back")
visit tags table: user.emacs("visit-tags-table")

# ----- PROJECT SUPPORT ----- #
project [find] file: user.emacs("project-find-file")
project [find] (regex | grep): user.emacs("project-find-regexp")
Expand Down Expand Up @@ -324,7 +334,8 @@ merge next: user.emacs("smerge-next")
merge last: user.emacs("smerge-prev")
merge keep upper: user.emacs("smerge-keep-upper")
merge keep lower: user.emacs("smerge-keep-lower")
merge keep this: user.emacs("smerge-keep-current")
merge keep base: user.emacs("smerge-keep-base")
merge keep (this | current): user.emacs("smerge-keep-current")
merge refine: user.emacs("smerge-refine")
merge split: user.emacs("smerge-resolve")

Expand Down
11 changes: 10 additions & 1 deletion apps/emacs/emacs_commands.csv
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ global-hl-line-mode,, g-hl-l-m
global-visual-line-mode,, gl-v-l-m
goto-line, meta-g meta-g
highlight-lines-matching-regexp, meta-s h l
highlight-regexp, meta-s h r
highlight-phrase, meta-s h p
highlight-regexp, meta-s h r
hl-line-mode,, hl-l-m
indent-region, meta-ctrl-\
indent-rigidly, ctrl-x tab
Expand Down Expand Up @@ -102,6 +102,7 @@ next-buffer, ctrl-x right
next-error, meta-g n
occur, meta-s o
open-rectangle, ctrl-x r o
other-frame, ctrl-x 5 o
other-window, ctrl-x o
outline-backward-same-level, ctrl-c @ ctrl-b
outline-demote, ctrl-c @ ctrl->
Expand Down Expand Up @@ -214,9 +215,17 @@ unhighlight-regexp, meta-s h u
universal-argument, ctrl-u
vc-annotate, ctrl-x v g
view-lossage, ctrl-h l
visit-tags-table,, v-t-t
visual-line-mode,, visu-l-m
whitespace-cleanup,, wh-cl
whitespace-mode,, white-m
widen, ctrl-x n w
xref-find-apropos, meta-ctrl-.
xref-find-definitions, meta-.
xref-find-definitions-other-frame, ctrl-x 5 .
xref-find-definitions-other-window, ctrl-x 4 .
xref-find-references, meta-?
xref-find-references-and-replace
xref-go-back,"meta-,"
yank, ctrl-y
yank-rectangle, ctrl-x r y
64 changes: 64 additions & 0 deletions apps/foxit_reader/foxit_reader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
from talon import Context, Module, actions

mod = Module()
ctx = Context()

# --- App definition ---
mod.apps.foxit_reader = r"""
os: windows
and app.name: /^Foxit Reader/
os: windows
and app.exe: /^foxitreader\.exe$/i
os: windows
and app.name: Foxit PDF Reader
os: windows
and app.exe: /^foxitpdfreader\.exe$/i
"""
# Context matching
ctx.matches = """
app: foxit_reader
"""


@ctx.action_class("app")
class AppActions:
# app.tabs
def tab_open():
actions.key("ctrl-o")

def tab_reopen():
actions.app.notify("Foxit does not support this action.")


@ctx.action_class("user")
class UserActions:
# user.tabs
def tab_jump(number):
actions.app.notify("Foxit does not support this action.")

def tab_final():
actions.app.notify("Foxit does not support this action.")

def tab_duplicate():
actions.app.notify("Foxit does not support this action.")

# user.pages
def page_current() -> int:
actions.key("ctrl-g")
page = actions.edit.selected_text()
return int(page)

def page_next():
actions.key("right")

def page_previous():
actions.key("left")

def page_jump(number: int):
actions.key("ctrl-g")
actions.insert(str(number))
actions.key("enter")

def page_final():
# actions.key("fn-right")
actions.key("end")
11 changes: 11 additions & 0 deletions apps/foxit_reader/foxit_reader.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
app: foxit_reader
-
tag(): user.tabs
tag(): user.pages

tab close all: key(ctrl-shift-w)

[page] rotate right: key("shift-ctrl-keypad_equals")
[page] rotate left: key("shift-ctrl-keypad_minus")

go back: key(alt-left)
44 changes: 44 additions & 0 deletions apps/meld/meld.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from talon import Context, Module, actions

mod = Module()
ctx = Context()

apps = mod.apps
apps.meld = """
os: windows
and app.name: Visual diff and merge tool
os: windows
and app.exe: meld.exe
"""

ctx.matches = r"""
app: meld
"""


@ctx.action_class("app")
class AppActions:
def tab_open():
actions.key("ctrl-n")

def tab_previous():
actions.key("ctrl-alt-pageup")

def tab_next():
actions.key("ctrl-alt-pagedown")

def tab_reopen():
print("Meld does not support this action.")


@ctx.action_class("user")
class UserActions:
def tab_jump(number):
if number < 10:
actions.key(f"alt-{number}")

def tab_final():
print("Meld does not support this action.")

def tab_duplicate():
print("Meld does not support this action.")
6 changes: 6 additions & 0 deletions apps/meld/meld.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
app: meld
-
tag(): user.tabs

change next: key(alt-down)
change (previous | last): key(alt-up)
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
16 changes: 16 additions & 0 deletions apps/talon/talon_debug_window/talon_debug_window.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# this functionality is only available in the talon beta
from talon import Module

mod = Module()
mod.apps.talon_debug_window = """
os: mac
and app.bundle: com.talonvoice.Talon
win.title: Talon Debug
"""
mod.apps.talon_debug_window = """
os: windows
and app.name: Talon
os: windows
and app.exe: talon.exe
win.title: Talon Debug
"""
24 changes: 24 additions & 0 deletions apps/talon/talon_debug_window/talon_debug_window.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# this functionality is only available in the talon beta
# note: these commands are only useful when the search box is focused
app: talon_debug_window
-
# uncomment user.talon_populate_lists tag to activate talon-specific lists of actions, scopes, modes etcetera.
# Do not enable this tag with dragon, as it will be unusable.
# with conformer, the latency increase may also be unacceptable depending on your cpu
# see https://github.com/talonhub/community/issues/600
# tag(): user.talon_populate_lists

tag {user.talon_tags}: "{talon_tags}"

#commands for dictating key combos
key <user.keys> over: "{keys}"
key <user.modifiers> over: "{modifiers}"

action {user.talon_actions}: "{talon_actions}"
# requires user.talon_populate_lists tag. do not use with dragon
list {user.talon_lists}: "{talon_lists}"

# requires user.talon_populate_lists tag. do not use with dragon
capture {user.talon_captures}: "{talon_captures}"
set {user.talon_settings}: "{talon_settings}"
application {user.talon_apps}: "{talon_apps}"
File renamed without changes.
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
11 changes: 10 additions & 1 deletion apps/vscode/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
and app.bundle: com.microsoft.VSCodeInsiders
os: mac
and app.bundle: com.visualstudio.code.oss
os: mac
and app.bundle: com.todesktop.230313mzl4w4u92
"""
mod.apps.vscode = """
os: linux
Expand Down Expand Up @@ -128,6 +130,9 @@ def jump_line(n: int):
actions.key("enter")
actions.edit.line_start()

def zoom_reset():
actions.user.vscode("workbench.action.zoomReset")


@ctx.action_class("win")
class WinActions:
Expand Down Expand Up @@ -271,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"""
Expand All @@ -289,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:
Expand Down
4 changes: 4 additions & 0 deletions apps/vscode/vscode.talon
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ 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 "")

# Sidebar
bar explore: user.vscode("workbench.view.explorer")
bar extensions: user.vscode("workbench.view.extensions")
Expand Down
Loading

0 comments on commit eeb8de3

Please sign in to comment.