Skip to content

Commit

Permalink
Merge branch 'main' into various-snap-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
jaresty committed Sep 5, 2024
2 parents b0cd5a1 + 940fe69 commit 3e1e786
Show file tree
Hide file tree
Showing 31 changed files with 741 additions and 473 deletions.
183 changes: 90 additions & 93 deletions README.md

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions apps/git/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,6 @@
mod.list("git_command", desc="Git commands.")
mod.list("git_argument", desc="Command-line git options and arguments.")

dirpath = Path(__file__).parent
arguments_csv_path = str(dirpath / "git_arguments.csv")
commands_csv_path = str(dirpath / "git_commands.csv")


def make_list(path):
with resource.open(path, "r") as f:
rows = list(csv.reader(f))
mapping = {}
# ignore header row
for row in rows[1:]:
if len(row) == 0:
continue
if len(row) == 1:
row = row[0], row[0]
if len(row) > 2:
print("{path!r}: More than two values in row: {row}. Ignoring the extras.")
output, spoken_form = row[:2]
spoken_form = spoken_form.strip()
mapping[spoken_form] = output
return mapping


ctx.lists["self.git_argument"] = make_list(arguments_csv_path)
ctx.lists["self.git_command"] = make_list(commands_csv_path)


@mod.capture(rule="{user.git_argument}+")
def git_arguments(m) -> str:
Expand Down
69 changes: 69 additions & 0 deletions apps/git/git_argument.talon-list
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
list: user.git_argument
-
abort: --abort
all: --all
allow empty: --allow-empty
amend: --amend
cached: --cached
cashed: --cached
color words: --color-words
colour words: --color-words
continue: --continue
copy: --copy
create: --create
delete: --delete
detach: --detach
dir diff: --dir-diff
directory diff: --dir-diff
dry run: --dry-run
edit: --edit
fast forward only: --ff-only
force: --force
force create: --force-create
force with lease: --force-with-lease
global: --global
global: --global
hard: --hard
ignore case: --ignore-case
include untracked: --include-untracked
interactive: --interactive
keep index: --keep-index
list: --list
local: --local
mixed: --mixed
move: --move
no edit: --no-edit
no keep index: --no-keep-index
no rebase: --no-rebase
no track: --no-track
no verify: --no-verify
orphan: --orphan
patch: --patch
prune: --prune
quiet: --quiet
quit: --quit
rebase: --rebase
remote: --remote
set up stream: --set-upstream
set up stream to: --set-upstream-to
short: --short
short stat: --shortstat
skip: --skip
soft: --soft
staged: --staged
stat: --stat
system: --system
track: --track
update: --update
verbose: --verbose
branch: -b
combined: -c
deep: -d
very verbose: -vv
HEAD
main
master
origin
upstream
origin main: origin/main
origin master: origin/master
68 changes: 0 additions & 68 deletions apps/git/git_arguments.csv

This file was deleted.

31 changes: 16 additions & 15 deletions apps/git/git_commands.csv → apps/git/git_command.talon-list
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
Subcommand, Spoken form (optional)
list: user.git_command
-
add
archive
bisect
blame
branch
checkout
cherry-pick, cherry pick
cherry pick: cherry-pick
clean
clone
commit
config
diff
difftool, diff tool
diff tool: difftool
fetch
gc
grep
help
init, in it
in it: init
log
ls-files, ls files
ls files: ls-files
merge
mergetool, merge tool
mv, move
merge tool: mergetool
move: mv
pull
push
range-diff, range diff
range diff: range-diff
rebase
reflog,ref log
ref log: reflog
remote
remote add
remote remove
remote rename
remote set-url, remote set url
remote set-url, remote set you are el
remote set url: remote set-url
remote set you are el: remote set-url
remote show
rerere
rerere diff
rerere status
reset
restore
revert
rm, remove
shortlog,short log
remove: rm
short log: shortlog
show
sparse-checkout,sparse checkout
sparse checkout: sparse-checkout
stash
stash apply
stash list
Expand All @@ -54,7 +55,7 @@ stash save
status
submodule
submodule add
submodule init, submodule in it
submodule in it: submodule init
submodule status
submodule update
switch
Expand Down
19 changes: 19 additions & 0 deletions apps/talon/talon_repl/talon_repl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from talon import Context, Module

mod = Module()
mod.apps.talon_repl = r"""
win.title: /Talon - REPL/
win.title: /.talon\/bin\/repl/
"""

ctx = Context()
ctx.matches = r"""
app: talon_repl
not tag: user.code_language_forced
"""


@ctx.action_class("code")
class CodeActions:
def language():
return "python"
4 changes: 2 additions & 2 deletions apps/talon/talon_repl/talon_repl.talon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
win.title: /repl/
win.title: /Talon - REPL/
app: talon_repl
-
tag(): user.talon_python
tag(): user.readline

# 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.
Expand Down
2 changes: 2 additions & 0 deletions apps/vscode/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
and app.name: VSCodium
os: linux
and app.name: Codium
os: linux
and app.name: Cursor
"""
mod.apps.vscode = r"""
os: windows
Expand Down
4 changes: 0 additions & 4 deletions core/edit_settings.talon

This file was deleted.

36 changes: 25 additions & 11 deletions core/edit_text_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,39 @@

mod = Module()
ctx = Context()
mod.list(
"edit_file",
desc="Absolute paths to frequently edited files (Talon list, CSV, etc.)",
)

_edit_files = {
"additional words": os.path.join(
REPO_DIR, "core", "vocabulary", "vocabulary.talon-list"
),
"alphabet": os.path.join(REPO_DIR, "core", "keys", "letter.talon-list"),
"homophones": os.path.join(REPO_DIR, "core", "homophones", "homophones.csv"),
"search engines": os.path.join(
REPO_DIR, "core", "websites_and_search_engines", "search_engine.talon-list"
),
"unix utilities": os.path.join(
REPO_DIR, "tags", "terminal", "unix_utility.talon-list"
),
"websites": os.path.join(
REPO_DIR, "core", "websites_and_search_engines", "website.talon-list"
),
}

mod.list("talon_settings_csv", desc="Absolute paths to talon user settings csv files.")
_csvs = {
_settings_csvs = {
name: os.path.join(SETTINGS_DIR, file_name)
for name, file_name in {
"abbreviations": "abbreviations.csv",
"additional words": "additional_words.csv",
"alphabet": "alphabet.csv",
"directories": "directories.csv",
"file extensions": "file_extensions.csv",
"search engines": "search_engines.csv",
"system paths": "system_paths.csv",
"unix utilities": "unix_utilities.csv",
"websites": "websites.csv",
"words to replace": "words_to_replace.csv",
}.items()
}
_csvs["homophones"] = os.path.join(REPO_DIR, "core", "homophones", "homophones.csv")
ctx.lists["self.talon_settings_csv"] = _csvs

_edit_files.update(_settings_csvs)
ctx.lists["self.edit_file"] = _edit_files


@mod.action_class
Expand Down
4 changes: 4 additions & 0 deletions core/edit_text_file.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
customize {user.edit_file}:
user.edit_text_file(edit_file)
sleep(500ms)
edit.file_end()
20 changes: 1 addition & 19 deletions core/keys/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,11 @@

from ..user_settings import get_list_from_csv


def setup_default_alphabet():
"""set up common default alphabet.
no need to modify this here, change your alphabet using alphabet.csv"""
initial_default_alphabet = "air bat cap drum each fine gust harp sit jury crunch look made near odd pit quench red sun trap urge vest whale plex yank zip".split()
initial_letters_string = "abcdefghijklmnopqrstuvwxyz"
initial_default_alphabet_dict = dict(
zip(initial_default_alphabet, initial_letters_string)
)

return initial_default_alphabet_dict


alphabet_list = get_list_from_csv(
"alphabet.csv", ("Letter", "Spoken Form"), setup_default_alphabet()
)

# used for number keys & function keys respectively
digits = "zero one two three four five six seven eight nine".split()
f_digits = "one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty".split()


mod = Module()
mod.list("letter", desc="The spoken phonetic alphabet")
mod.list("symbol_key", desc="All symbols from the keyboard")
Expand Down Expand Up @@ -132,7 +115,6 @@ def letters(m) -> str:
modifier_keys["command"] = "cmd"
modifier_keys["option"] = "alt"
ctx.lists["self.modifier_key"] = modifier_keys
ctx.lists["self.letter"] = alphabet_list

# `punctuation_words` is for words you want available BOTH in dictation and as key names in command mode.
# `symbol_key_words` is for key names that should be available in command mode, but NOT during dictation.
Expand Down
Loading

0 comments on commit 3e1e786

Please sign in to comment.