Help with {{selection}} #333
-
I’m trying to make a keyboard shortcut to auto launch specific commands that I store in my notes, so i've been playing with {{selection}} with the idea of selecting my saved command and hitting the keyboard shortcut I created for instance one that works:
However, I want to make it more general, so I tried with simple making the command:
with the idea of having it execute whatever the selected command is, but fails when i try it with the command above, I suspect it inserts weird spacing into the command but not sure Am I missing something? Is there a better way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi, thank you for your question! 🙂 Yea, I guess I know the reason why it's not working, even without seeing the actual error message you are getting. I'll help you achieve what you are trying to do, but I'll first tell a bit of background for your problem. As your aim is not to use Please let me know if you still encounter problems with this. 🙂 An alternative for
|
Beta Was this translation helpful? Give feedback.
-
thanks! that totally worked! One trick is to use the Keyshots extension with the command "Encode selection" to quickly turn the command into url encoding I’m sure there has to be a way to use your extension with selection to:
but i haven't figured it out yet. I will give it a thought. but if you have a proposal i'd love to hear it! |
Beta Was this translation helpful? Give feedback.
-
Nice to know that it works 🙂 Yea, it's probably possible to come up with a shell command that takes However, yesterday I came to think about creating an Obsidian command (i.e. not shell command) for creating execution links. It would open up a modal where users could enter values for customs variable(s). Those values would be automatically url encoded. But I don't have a schedule for it. |
Beta Was this translation helpful? Give feedback.
Hi, thank you for your question! 🙂
Yea, I guess I know the reason why it's not working, even without seeing the actual error message you are getting. I'll help you achieve what you are trying to do, but I'll first tell a bit of background for your problem.
{{Variables}}
are typically used as arguments for shell commands, not (usually) as actual commands. Special characters (including whitespace) in values coming from{{variables}}
are escaped in order to prevent the values from accidentally breaking out of argument context, which could cause problems.As your aim is not to use
{{selection}}
as an argument, you can disable escaping by preceding the variable's name with an exclamation mark!
.…