Skip to content

Commit 70f898a

Browse files
committed
feat: initial move from fidgetingbits-talon to talon-vim
1 parent 9fc161b commit 70f898a

File tree

116 files changed

+6578
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+6578
-0
lines changed

README.md

Lines changed: 606 additions & 0 deletions
Large diffs are not rendered by default.

TROUBLESHOOTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
```
2+
2020-06-05 18:23:04 DEBUG Using selector: EpollSelector
3+
2020-06-05 18:23:04 ERROR 22: talon/scripting/talon_script.py:431 |
4+
21: talon/scripting/talon_script.py:210 |
5+
20: talon/scripting/talon_script.py:398 |
6+
19: talon/scripting/actions.py:56 |
7+
18: -------------------------------------------------------------------------# cron thread
8+
17: talon/scripting/types.py:249 |
9+
16: user/fidget/code/vim.py:810 | v = VimMode()
10+
15: -------------------------------------------------------------------------# 'cron' main:<lambda>()
11+
14: user/fidget/code/vim.py:1011| self.current_mode = self.get_active_mo..
12+
13: user/fidget/code/vim.py:1036| nvrpc = NeoVimRPC()
13+
12: user/fidget/code/vim.py:952 | self.nvim = neovim.attach("socket", pa..
14+
11: lib/python3.7/site-packages/pynvim/__init__.py:122 | return Nvim.from_session(session).with..
15+
10: lib/python3.7/site-packages/pynvim/api/nvim.py:80 | channel_id, metadata = session.request..
16+
9: lib/python3.7/site-packages/pynvim/msgpack_rpc/session.py:96 | v = self._blocking_request(method, args)
17+
8: -------------------------------------------------------------------------# 'phrase' user.w2l:_redispatch()
18+
7: lib/python3.7/site-packages/pynvim/msgpack_rpc/session.py:180 | self._enqueue_notification)
19+
6: lib/python3.7/site-packages/pynvim/msgpack_rpc/async_session.py:66 | self._msgpack_stream.run(self._on_mess..
20+
5: lib/python3.7/site-packages/pynvim/msgpack_rpc/msgpack_stream.py:44 | self.loop.run(self._on_data)
21+
4: lib/python3.7/site-packages/pynvim/msgpack_rpc/event_loop/base.py:147 | self._setup_signals([signal.SIGINT, si..
22+
3: lib/python3.7/site-packages/pynvim/msgpack_rpc/event_loop/asyncio.py:159 | self._loop.add_signal_handler(signum, ..
23+
2: -------------------------------------------------------------------------# 'phrase' user.w2l:engine_event()
24+
1: lib/python3.7/asyncio/unix_events.py:94 |
25+
RuntimeError: set_wakeup_fd only works in main thread
26+
27+
1: lib/python3.7/asyncio/unix_events.py:92|
28+
ValueError: set_wakeup_fd only works in main thread
29+
30+
[The below error was raised while handling the above exception(s)]
31+
```
32+
33+
https://github.com/aio-libs/aiohttp/issues/2265

vim/filetypes/markdown.talon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
app: vim
2+
and code.language: markdown
3+
-
4+
5+
# XXX - These needs to detect the current working directory in vim, so should
6+
# just call of macro instead
7+
# It would be nice if this was even more specific, but probably need to move it
8+
# to vim to detect if I have build_sides.sh in the current folder
9+
build slides: user.system_command_nb("./build_slides.sh\n")
10+
build slides preview: user.system_command_nb("./build_slides.sh preview\n")
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
tag: user.vim_codeql
2+
win.title: /__CodeQLPanel/
3+
-
4+
# General
5+
preview: "p"
6+
next result: "N"
7+
prev result: "P"
8+
9+
# Filter
10+
set filter: "f"
11+
generic filter: "F"
12+
clear filter: "x"
13+
14+
# Folds
15+
toggle fold: "o"
16+
expand all: "O"
17+
collapse all: "C"
18+
19+
# Misc
20+
toggle mode: "m"
21+
close window: "q"
22+
toggle help: "H"

vim/plugins/copilot/vim_copilot.talon

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
tag: user.vim_copilot
2+
-
3+
4+
copilot disable: user.vim_command_mode(":Copilot disable\n")
5+
copilot enable: user.vim_command_mode(":Copilot enable\n")
6+
copilot status: user.vim_command_mode(":Copilot status\n")
7+
copilot panel: user.vim_command_mode(":Copilot panel\n")
8+
copilot version: user.vim_command_mode(":Copilot version\n")
9+
copilot suggest: user.vim_command_mode(':execute "normal \\<Plug>(copilot-suggest)"\n')
10+
copilot dismiss: user.vim_command_mode(':execute "normal \\<Plug>(copilot-dismiss)"\n')
11+
copilot next: user.vim_command_mode(':execute "normal \\<Plug>(copilot-next)"\n')
12+
copilot (last | previous | prev):
13+
user.vim_command_mode(':execute "normal \\<Plug>(copilot-previous)"\n')
14+
# purposefully don't have new lines at the end of these commands
15+
copilot setup: user.vim_command_mode(":Copilot setup")
16+
copilot sign out: user.vim_command_mode(":Copilot signout")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tag: user.vim_copilot
2+
and tag: user.vim_insert_mode
3+
-
4+
5+
([co] pilot | keep): key("ctrl-j")
6+
parrot (tut): key("ctrl-j")

vim/plugins/fzf/vim_fzf.talon

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
tag: user.vim_fzf
2+
-
3+
4+
# ripgrep through files under current directory
5+
hunt code: user.vim_command_mode_exterm(':exe ":Rg"\n')
6+
hunt code clip:
7+
user.vim_command_mode_exterm(':exe ":Rg"\n')
8+
edit.paste()
9+
# XXX - this should behave differently depending on if it's a selection in
10+
# visual mode, etc
11+
hunt code this:
12+
user.vim_normal_mode("yiw")
13+
user.vim_command_mode_exterm(':exe ":Rg"\n')
14+
edit.paste()
15+
16+
fuzz buffer commits: user.vim_command_mode_exterm(':exe ":BCommit"\n')
17+
18+
# Lines across current buffer
19+
hunt lines: user.vim_command_mode_exterm(':exe ":BLines"\n')
20+
21+
hunt tags: user.vim_command_mode_exterm(':exe ":BTags"\n')
22+
23+
# Open buffers
24+
hunt buffers: user.vim_command_mode_exterm(':exe ":Buffers"\n')
25+
26+
fuzz code search: user.vim_command_mode_exterm(':exe ":Ag"\n')
27+
fuzz colors: user.vim_command_mode_exterm(':exe ":Colors"\n')
28+
hunt command history: user.vim_command_mode_exterm(':exe ":History:"\n')
29+
hunt commands: user.vim_command_mode_exterm(':exe ":Commands"\n')
30+
hunt commits: user.vim_command_mode_exterm(':exe ":Commit"\n')
31+
fuzz file types: user.vim_command_mode_exterm(':exe ":Filetypes"\n')
32+
33+
# Files under current directory
34+
35+
hunt (file | files): user.vim_command_mode_exterm(':exe ":Files"\n')
36+
hunt (file | files) <user.text>:
37+
user.vim_command_mode_exterm(':exe ":Files"\n')
38+
insert(text)
39+
40+
fuzz git files: user.vim_command_mode_exterm(':exe ":GFiles"\n')
41+
fuzz git status: user.vim_command_mode_exterm(':exe ":GFiles?"\n')
42+
fuzz help tags: user.vim_command_mode_exterm(':exe ":Helptags"\n')
43+
fuzz history: user.vim_command_mode_exterm(':exe ":History"\n')
44+
45+
# Lines across all open buffers
46+
hunt all lines: user.vim_command_mode_exterm(':exe ":Lines"\n')
47+
fuzz locate: user.vim_command_mode_exterm(":Locate ")
48+
fuzz maps: user.vim_command_mode_exterm(':exe ":Maps"\n')
49+
hunt marks: user.vim_command_mode_exterm(':exe ":Marks"\n')
50+
fuzz search history: user.vim_command_mode_exterm(':exe ":History/"\n')
51+
hunt snippets: user.vim_command_mode_exterm(':exe ":Snippets"\n')
52+
fuzz tags: user.vim_command_mode_exterm(':exe ":Tags"\n')
53+
hunt windows: user.vim_command_mode_exterm(':exe ":Windows"\n')

vim/plugins/fzf/vim_fzf_open.talon

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# see vim_fzf.talon for the main commands.
2+
#
3+
# The commands in this file are only relevant for when an actual fzf.vim
4+
# floating window is open
5+
# See https://github.com/junegunn/fzf.vim#global-options for bindings
6+
#
7+
# NOTE: by default certain commands will not advertise that they're running
8+
# inside of fzf, so the title matching below doesn't necessarily work without
9+
# manual modification. Ex: anything other than :Files?
10+
tag: user.vim_fzf
11+
win.title: /#FZF/
12+
-
13+
14+
open in vertical split: key(ctrl-v)
15+
open in split: key(ctrl-v)
16+
open in tab: key(ctrl-t)

vim/plugins/leap/vim_leap.talon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tag: user.vim_leap
2+
and not tag: user.vim_visual_mode
3+
-
4+
5+
hop to: user.vim_normal_mode_keys("s")
6+
hop back to: user.vim_normal_mode_keys("S")
7+
hop global to: user.vim_normal_mode_keys("g s")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tag: user.vim_leap
2+
and tag: user.vim_visual_mode
3+
-
4+
5+
hop to: key("x")
6+
hop back to: key("X")

vim/plugins/lsp/vim_lsp.talon

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# XXX - this should eventually be generic for handling multiple different lsp
2+
# implementations
3+
tag: user.vim_lsp
4+
-
5+
6+
(code server | lisp) (info | show): user.vim_command_mode(':exe ":LspInfo"\n')
7+
(code server | lisp) start: user.vim_command_mode(':exe ":LspStart"\n')
8+
(code server | lisp) stop: user.vim_command_mode(":LspStop ")
9+
lisp dock sym: user.vim_command_mode(':exe ":lua vim.lsp.buf.document_symbol()"\n')
10+
11+
# logging
12+
lisp log level trace:
13+
user.vim_command_mode(":exe \":lua vim.lsp.set_log_level('trace')\"\n")
14+
lisp log level debug:
15+
user.vim_command_mode(":exe \":lua vim.lsp.set_log_level('debug')\"\n")
16+
lisp log level info:
17+
user.vim_command_mode(":exe \":lua vim.lsp.set_log_level('info')\"\n")
18+
lisp log level warn:
19+
user.vim_command_mode(":exe \":lua vim.lsp.set_log_level('warn')\"\n")
20+
lisp log level error:
21+
user.vim_command_mode(":exe \":lua vim.lsp.set_log_level('error')\"\n")
22+
lisp log file show:
23+
user.vim_command_mode_exterm(":exe 'tabnew ' .. luaeval(\"vim.lsp.get_log_path()\")\n")
24+
25+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.clear_references()"\n')
26+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.code_action()"\n')
27+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.completion()"\n')
28+
29+
# navigation
30+
#(jump|lisp) (declaration|deck): user.vim_command_mode(':exe ":lua vim.lsp.buf.declaration()"\n')
31+
(jump | lisp) implementation:
32+
user.vim_command_mode(':exe ":lua vim.lsp.buf.implementation()"\n')
33+
(jump | lisp) (definition | deaf):
34+
user.vim_command_mode(':exe ":lua vim.lsp.buf.definition()"\n')
35+
(jump | lisp) (highlight | light):
36+
user.vim_command_mode(':exe ":lua vim.lsp.buf.document_highlight()"\n')
37+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.formatting()"\n')
38+
# TODO: Closing these is a little bit annoying because we don't have any context, we
39+
# need need to make a hook that somehow indicates the pop up is open
40+
(peek | hover) (this | deaf):
41+
user.vim_command_mode(':exe ":lua vim.lsp.buf.hover()"\n')
42+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.implementation()"\n')
43+
(jump | lisp) in coming:
44+
user.vim_command_mode(':exe ":lua vim.lsp.buf.incoming_calls()"\n')
45+
(jump | lisp) out going:
46+
user.vim_command_mode(':exe ":lua vim.lsp.buf.outgoing_calls()"\n')
47+
(jump | peak) (references | ref | callers):
48+
user.vim_command_mode(':exe ":lua vim.lsp.buf.references()"\n')
49+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.signature_help()"\n')
50+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.type_definition()"\n')
51+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.workspace_symbol()"\n')
52+
53+
# Code refactoring
54+
(code rename | rename this):
55+
#user.vim_command_mode(':exe ":lua vim.lsp.buf.rename()"\n')
56+
user.vim_command_mode(":IncRename ")
57+
# Code linting and formatting
58+
file fix: user.vim_command_mode(':exe ":lua vim.lsp.buf.format()"\n')
59+
60+
# diagnostics
61+
# also see plugins/trouble/ for a better interface
62+
toggle errors:
63+
user.vim_command_mode(':exe ":lua vim.diagnostic.show_line_diagnostics()"\n')
64+
65+
# TODO: It would be nice for this to toggle if it's already open
66+
trouble show: user.vim_command_mode(':exe ":lua vim.diagnostic.open_float()"\n')
67+
trouble next: user.vim_command_mode(':exe ":lua vim.diagnostic.goto_next()"\n')
68+
trouble (prev | last):
69+
user.vim_command_mode(':exe ":lua vim.diagnostic.goto_prev()"\n')

vim/plugins/lsp/vim_lsp_open.talon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tag: user.vim_lsp
2+
win.title: /FILETYPE:\[lspinfo\]/
3+
-
4+
5+
close: user.vim_normal_mode("q")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from talon import Context
2+
3+
ctx = Context()
4+
ctx.matches = r"""
5+
tag: user.vim_luasnip
6+
and tag: user.python
7+
"""
8+
# spoken name -> snippet name
9+
luasnip_snippets = {}
10+
11+
private_snippets = {
12+
# "print success": "psuccess",
13+
# "print fail": "pfail",
14+
"dick string": "dstr",
15+
"dick format string": "dfstr",
16+
# "new arg parser": "argparse"
17+
# "add argument": "narg",
18+
# "dock param": "dockparam",
19+
# "import cap stone": "capstone_import",
20+
}
21+
22+
ctx.lists["user.snippets"] = {**luasnip_snippets, **private_snippets}
23+
# print(ctx.lists["user.snippets"])

vim/plugins/luasnip/rust_snippets.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from talon import Context
2+
3+
ctx = Context()
4+
ctx.matches = r"""
5+
tag: user.vim_luasnip
6+
and tag: user.rust
7+
"""
8+
# spoken name -> snippet name
9+
luasnip_snippets = {}
10+
11+
private_snippets = {
12+
# "print success": "psuccess",
13+
# "print fail": "pfail",
14+
}
15+
16+
ctx.lists["user.snippets"] = {**luasnip_snippets, **private_snippets}
17+
# print(ctx.lists["user.snippets"])

vim/plugins/luasnip/vim_luasnip.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from talon import Context, Module, actions
2+
3+
mod = Module()
4+
ctx = Context()
5+
6+
ctx.matches = r"""
7+
tag: user.vim_luasnip
8+
"""
9+
10+
mod.tag("luasnip", desc="a tag to load luasnip")
11+
12+
13+
@ctx.action_class("user")
14+
class user_actions:
15+
def snippet_search(text: str):
16+
actions.user.vim_command_mode_exterm(':exe ":Telescope snippets snippets"\n')
17+
actions.insert(text)
18+
19+
def snippet_insert(text: str):
20+
"""Inserts a snippet"""
21+
actions.user.vim_insert_mode(text)
22+
actions.key("ctrl-k")
23+
24+
def snippet_reload():
25+
"""Reloads the snippets list"""
26+
actions.user.vim_command_mode_exterm(
27+
':lua require("luasnip/loaders/from_lua").load({paths="/home/aa/.config/nvim/snippets/"})\n'
28+
)

vim/plugins/luasnip/vim_luasnip.talon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tag: user.vim_luasnip
2+
-
3+
tag(): user.snippets
4+
5+
snip that: key("ctrl-k")
6+
#choice:
7+
# key("ctrl-l")

vim/plugins/null-ls/vim_null_ls.talon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tag: user.vim_null_ls
2+
-
3+
L S (show | info): user.vim_command_mode(":exe ':NullLsInfo'\n")
4+
5+
L S log: user.vim_command_mode(":exe ':NullLsLog'\n")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tag: user.vim_null_ls
2+
win.title: /FILETYPE:\[null-ls-info\]/
3+
-
4+
5+
close: user.vim_normal_mode("q")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tag: user.vim_nvim_cmp
2+
and tag: user.vim_insert_mode
3+
-
4+
# This is technically a nvim-cmp specific command
5+
# they should probably also tie into something that uses pumvisible()
6+
close: key('ctrl-e')
7+
keep:
8+
# NOTE: This purposefully overlaps with copilot keep, so you would need to configure
9+
# it with a fall back function in nvim-cmp
10+
key('ctrl-j')
11+
next: key('ctrl-n')
12+
prev: key('ctrl-p')
13+
(suggest | complete | pleat): key('ctrl-space')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tag: user.vim_nvim_cmp
2+
and tag: user.vim_select_mode
3+
-
4+
5+
next: key('ctrl-n')
6+
prev: key('ctrl-p')

0 commit comments

Comments
 (0)