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

feat: add line commands to unify with community #13

Merged
merged 2 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 14 additions & 1 deletion core/edit/edit_line.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from talon import Context, actions, app
from talon import Context, Module, actions, app

import time

mod = Module()
# Context valid in some sort of motion mode, so not including terminal or command mode
ctx_motion = Context()
ctx_motion.matches = r"""
Expand Down Expand Up @@ -47,6 +48,7 @@ def line_end():
actions.user.vim_run_any_motion_key("$")

def select_line(n: int = None):
# FIXME: Support the argument
actions.user.vim_run_visual("V")

def extend_line_up():
Expand Down Expand Up @@ -108,6 +110,7 @@ def delete_line():
class EditActions:
def select_line(n: int = None):
if n is not None:
# FIXME: Implement this
app.notify("select_line() with argument not implemented")
return
actions.user.vim_run_normal_exterm("V")
Expand All @@ -133,3 +136,13 @@ def extend_line_end():

def delete_line():
actions.insert("D")


# FIXME: TEMPORARY: Once https://github.com/talonhub/community/pull/1449 is merged, this should be removed
@mod.action_class
class LineActions:
def line_find_forward(key: str):
"""Finds the next character in the line"""

def line_find_backward(key: str):
"""Finds the previous character in the line"""
7 changes: 7 additions & 0 deletions core/lines/line_commands.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# FIXME: TEMPORARY: Once https://github.com/talonhub/community/pull/1449 is merged, this file shoulid be removed
saidelike marked this conversation as resolved.
Show resolved Hide resolved

find <user.unmodified_key>:
user.line_find_forward(unmodified_key)

find last <user.unmodified_key>:
user.line_find_backward(unmodified_key)