dylanjcastillo / shell-genie

Your wishes are my commands
MIT License
478 stars 36 forks source link

[Feature Wish] Faster prompting #18

Open Vincenzo-Petrolo opened 8 months ago

Vincenzo-Petrolo commented 8 months ago

As done in other tools, it could be possible to make this faster adding few lines to the .rc file of the shell.

In my case (zsh) I added an alias:

alias please="shell-genie ask"

and then by adding this piece of code in the rc file:

format-and-accept() {
  BUFFER="please \"$BUFFER\""
  zle accept-line
} 

# Bind the function to Ctrl+F
zle -N format-and-accept
bindkey '^F' format-and-accept

it is possible to just write the bare prompt in the shell and then by pressing Ctrl+F it will call the shell-genie.

You could make this possible to enable this feature by adding an option that appends the above lines in the rc file.