Assign keybinding to snippet #338
Replies: 1 comment 1 reply
-
Try this:
keys['ctrl+`'] = function()
textadept.snippets.insert('<%1%2>%<selected_text></%1>') end
You want to assign to the key a function to call, rather than calling a
function (on init) and assigning its result to the key.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. Recently discovered Textadept. Thanks much.
New to Textadept and Lua. Two new great adventures, Yay.
I have a snippet that I use quite frequently in html and plain text languages.
Choosing Tools > Snippets > Insert Snippet and then choosing from a list is
cumbersome.
snip['tag'] = '<%1%2>%<selected_text></%1>'
I would like to use
ctrl+`
to insert this snippet.I try
keys['ctrl+`'] = textadept.snippets.insert('<%1%2>%<selected_text></%1>')
in my init.lua file, but that brings an error buffer when I start Text adept.
The snippet works fine when I put it in html and text language modules.
Any help will be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions