Getting Started - Setting Keymaps for Builtin Actions
CharlesARoy opened this issue · comments
Apologies for asking such a basic question, but I'm having a hard time getting keymaps to work for the builtin functions.
I can successfully create and use the keymap for node_action, as described under Usage, e.g.:
vim.keymap.set(
{ "n" },
"K",
require("ts-node-action").node_action,
{ desc = "Trigger Node Action" },
)
But when I try something similar for the builtin actions, they aren't working. For example, I tried a few variations of:
vim.keymap.set(
{ "n" },
"C",
require('ts-node-action.actions').cycle_quotes(),
{ desc = "Cycle Quotes" },
)
My setup function is currently empty, e.g. ts_node_action.setup({})
. I assumed that for the builtins, I wouldn't need to specify the languages and node types, but maybe that's my issue?
Any help is appreciated!
You only need the one keymap for require("ts-node-action").node_action
set - the built-in actions trigger based on the type of node your cursor is over. So, if you're on a string node, triggering that keymap should change the quotes.
If that doesn't work, lemme know what language you're using and we can try to sort it out.
Gotcha, that clears that up. Thanks!