Hi! Anyone here could tell me how to include a line in keybindings.conf so as to run a bash script when a key is pressed? Say that `/.local/bin/toggle` must be launched when `Tab` is pressed. Not really an issue, the issue is in fact that there's little information on how to do this.
Well you could try defining one of the custom commands to run your script, and defining Tab as the shortcut, but I suspect Tab is a little too overloaded, its used of a number of things and is context sensitive.
Could you provide a link to how these commands are defined? Haven't deal with that before and the handbook doesn't seem to make it clear.
["custom commands"](http://www.geany.org/manual/1.31/index.html#sending-text-through-custom-comm...) and the next section "context actions" depending if you want to replace the input with the output or not.
@elextr done, but there's a problem with this solution: these custom commands are intended to replace selected text or the current line with the output of the command, so a part of the actual document vanishes after executing it with the assigned shortcut. I tried to add an 'echo $1' to the bash script that is executed, but it doesn't work. Any suggestion to allow a normal execution of the external command without altering the original text document?
The context action does not modify the selection AFAIK.
@elextr That should work. Any idea about how to keybind to a context command? An entry like: custom_commands=/mypath/mycommand; will do it for a custom command, but what is the prefix for context commands?
The section of the manual I linked above refers.
Problem is, as I can see while it runs, that you need to select or the cursor sit on a word to make it work, it won't work on empty lines.
@elextr Adding a 'cat "$1"' to the script and calling the custom command seems to do the job. Only thing is that it selects the current line, what is not a desired effect.
Yes, the command works on the selection, it just helpfully selects the current line if nothing is selected.
Closed #1541.
This seems basically solved, feel free to re-open.
github-comments@lists.geany.org