Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnicollo committed Dec 17, 2023
2 parents 7350b22 + d4d1d1f commit 0c9c64a
Show file tree
Hide file tree
Showing 133 changed files with 2,035 additions and 701 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
Expand Down
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
minimum_pre_commit_version: "2.9.0"
minimum_pre_commit_version: "3.2.0"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -23,7 +23,7 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.1"
rev: "v3.1.0"
hooks:
- id: prettier
- repo: https://github.com/ikamensh/flynt/
Expand All @@ -35,11 +35,12 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.11.0
hooks:
- id: black
args: ["--target-version", "py310"]
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.3
rev: v1.5.4
hooks:
- id: remove-tabs
types: [file]
Expand Down
1 change: 0 additions & 1 deletion apps/eclipse/eclipse.talon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ app: eclipse
tag(): user.find_and_replace
tag(): user.line_commands
# tag(): user.multiple_cursors
# tag(): user.snippets
tag(): user.splits
tag(): user.tabs
# splits.py support end
Expand Down
17 changes: 0 additions & 17 deletions apps/eclipse/eclipse_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,6 @@ def save_all():

@ctx.action_class("user")
class UserActions:
# generic_snippet.py support beginHelp close
# def snippet_search(text: str):
# actions.user.vscode("Insert Snippet")
# actions.insert(text)

# def snippet_insert(text: str):
# """Inserts a snippet"""
# actions.user.vscode("Insert Snippet")
# actions.insert(text)
# actions.key("enter")

# def snippet_create():
# """Triggers snippet creation"""
# actions.user.vscode("Preferences: Configure User Snippets")

# generic_snippet.py support end

# splits.py support begin
# requires https://marketplace.eclipse.org/content/handysplit
def split_clear_all():
Expand Down
1 change: 1 addition & 0 deletions apps/firefox/firefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
apps.firefox = "app.name: Firefox"
apps.firefox = "app.name: Firefox Developer Edition"
apps.firefox = "app.name: firefox"
apps.firefox = "app.name: Firefox-esr"
apps.firefox = """
os: windows
and app.name: Firefox
Expand Down
1 change: 1 addition & 0 deletions apps/jetbrains/jetbrains.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def idea_commands(commands):
mod.apps.jetbrains = "app.name: /jetbrains/"
mod.apps.jetbrains = "app.name: CLion"
mod.apps.jetbrains = "app.name: IntelliJ IDEA"
mod.apps.jetbrains = "app.name: PhpStorm"
mod.apps.jetbrains = "app.name: PyCharm"
mod.apps.jetbrains = "app.name: WebStorm"
mod.apps.jetbrains = "app.name: RubyMine"
Expand Down
6 changes: 5 additions & 1 deletion apps/mintty/mintty_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@
def get_win_path(cyg_path):
path = ""
try:
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
path = (
subprocess.check_output([setting_cyg_path.get(), "-w", cyg_path])
subprocess.check_output(
[setting_cyg_path.get(), "-w", cyg_path], startupinfo=si
)
.strip(b"\n")
.decode()
)
Expand Down
10 changes: 7 additions & 3 deletions apps/tmux/tmux.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from talon import Context, Module, actions

ctx = Context()
mod = Module()

ctx.matches = r"""
tag: user.tmux
mod.apps.tmux = """
tag: terminal
and tag: user.tmux
"""

setting_tmux_prefix_key = mod.setting(
Expand Down Expand Up @@ -45,6 +45,10 @@ def tmux_execute_command_with_confirmation(command: str, confirmation_prompt: st
actions.key("\n")


ctx = Context()
ctx.matches = "app: tmux"


@ctx.action_class("app")
class AppActions:
def tab_open():
Expand Down
13 changes: 12 additions & 1 deletion apps/tmux/tmux.talon
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
tag: user.tmux
app: tmux
-
tag(): user.splits
tag(): user.tabs

# Note that you will need to add something to match the tmux app in your configuration
# This is not active by default
# Adding a file with a matcher for detecting tmux active in your terminal and activating
# the tmux tag is required
# Something like:
#
# title: /^tmux/
# -
# tag(): user.tmux

# pane management - these commands use the word split to match with the splits
# tag defined in tags/splits/splits.talon
Expand Down
13 changes: 0 additions & 13 deletions apps/visualstudio/visual_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,6 @@ def filename():

@ctx.action_class("user")
class UserActions:
# snippet.py support beginHelp close
def snippet_search(text: str):
"""TEST"""
actions.key("ctrl-k ctrl-x")

# def snippet_insert(text: str):
# """Inserts a snippet"""

# def snippet_create():
# """Triggers snippet creation"""

# snippet.py support end

# def select_word(verb: str):
# actions.key("ctrl-w")
# actions.user.perform_selection_action(verb)
Expand Down
1 change: 0 additions & 1 deletion apps/visualstudio/visual_studio.talon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ app: visual_studio
tag(): user.tabs
tag(): user.line_commands
tag(): user.find_and_replace
tag(): user.snippets
tag(): user.multiple_cursors
#multiple_cursor.py support end

Expand Down
40 changes: 0 additions & 40 deletions apps/vscode/snippets/csharp_snippets.py

This file was deleted.

40 changes: 0 additions & 40 deletions apps/vscode/snippets/python_snippets.py

This file was deleted.

24 changes: 7 additions & 17 deletions apps/vscode/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
and app.name: VSCodium
os: windows
and app.exe: VSCodium.exe
os: windows
and app.name: Azure Data Studio
os: windows
and app.exe: azuredatastudio.exe
"""

ctx.matches = r"""
Expand Down Expand Up @@ -237,23 +241,6 @@ def multi_cursor_select_more_occurrences():
def multi_cursor_skip_occurrence():
actions.user.vscode("editor.action.moveSelectionToNextFindMatch")

# snippet.py support begin
def snippet_search(text: str):
actions.user.vscode("editor.action.insertSnippet")
actions.insert(text)

def snippet_insert(text: str):
"""Inserts a snippet"""
actions.user.vscode("editor.action.insertSnippet")
actions.insert(text)
actions.key("enter")

def snippet_create():
"""Triggers snippet creation"""
actions.user.vscode("workbench.action.openSnippets")

# snippet.py support end

def tab_jump(number: int):
if number < 10:
if is_mac:
Expand Down Expand Up @@ -376,3 +363,6 @@ def select_next_occurrence(text: str):
actions.edit.find(text)
actions.sleep("100ms")
actions.key("esc")

def insert_snippet(body: str):
actions.user.run_rpc_command("editor.action.insertSnippet", {"snippet": body})
8 changes: 6 additions & 2 deletions apps/vscode/vscode.talon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ app: vscode
tag(): user.find_and_replace
tag(): user.line_commands
tag(): user.multiple_cursors
tag(): user.snippets
tag(): user.splits
tag(): user.tabs
# chrisnicollo EDIT: enabling wrapper snippets with cursorless
Expand Down Expand Up @@ -57,6 +56,10 @@ show shortcuts: user.vscode("workbench.action.openGlobalKeybindings")
show shortcuts json: user.vscode("workbench.action.openGlobalKeybindingsFile")
show snippets: user.vscode("workbench.action.openSnippets")

# VSCode Snippets
snip (last | previous): user.vscode("jumpToPrevSnippetPlaceholder")
snip next: user.vscode("jumpToNextSnippetPlaceholder")

# Display
centered switch: user.vscode("workbench.action.toggleCenteredLayout")
fullscreen switch: user.vscode("workbench.action.toggleFullScreen")
Expand Down Expand Up @@ -183,7 +186,7 @@ git merge: user.vscode("git.merge")
git output: user.vscode("git.showOutput")
git pull: user.vscode("git.pullRebase")
git push: user.vscode("git.push")
git push focus: user.vscode("git.pushForce")
git push force: user.vscode("git.pushForce")
git rebase abort: user.vscode("git.rebaseAbort")
git reveal: user.vscode("git.revealInExplorer")
git revert: user.vscode("git.revertChange")
Expand Down Expand Up @@ -269,6 +272,7 @@ join lines: user.vscode("editor.action.joinLines")
full screen: user.vscode("workbench.action.toggleFullScreen")

curse undo: user.vscode("cursorUndo")
curse redo: user.vscode("cursorRedo")

select word: user.vscode("editor.action.addSelectionToNextFindMatch")
skip word: user.vscode("editor.action.moveSelectionToNextFindMatch")
Expand Down
8 changes: 7 additions & 1 deletion core/app_switcher/app_switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,13 @@ def get_running_app(name: str) -> ui.App:
def switcher_focus(name: str):
"""Focus a new application by name"""
app = actions.user.get_running_app(name)
actions.user.switcher_focus_app(app)

# Focus next window on same app
if app == ui.active_app():
actions.app.window_next()
# Focus new app
else:
actions.user.switcher_focus_app(app)

def switcher_focus_app(app: ui.App):
"""Focus application and wait until switch is made"""
Expand Down
4 changes: 2 additions & 2 deletions core/edit/edit.talon
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ go right: edit.right()
go up: edit.up()
go down: edit.down()

go line start: edit.line_start()
go line end: edit.line_end()
go line start | head: edit.line_start()
go line end | tail: edit.line_end()

go way left:
edit.line_start()
Expand Down
2 changes: 1 addition & 1 deletion core/edit/edit_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def save():
actions.key("cmd-s")

def save_all():
actions.key("cmd-shift-s")
actions.key("cmd-alt-s")

def select_all():
actions.key("cmd-a")
Expand Down
Loading

0 comments on commit 0c9c64a

Please sign in to comment.