You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, the shell history will only show ckit. It might be desirable that the actual commands that are run are added to the command history.
The idea would be to also create a ~/$CKIT_HOME/config file when ckit init is run, where a variable is specified e.g. add_to_history=true. If this is set to True, ckit should aim to add the command to the shell history.
Potential issue here is that this might be shell specific, i.e. the requirements to make this happen differ between e.g. zsh and bash.
The text was updated successfully, but these errors were encountered:
Suggestion is to look on how fzf does this. From this tool I compiled the following (which is only an idea, and far from complete/correct):
bind '"\C-r": " \C-e\C-u\C-y\ey\C-u`__ckit__`\e\C-e\er\e^"'
__echoerr() { echo "$@" 1>&2; }
__ckit__ () {
( local line;
shopt -u nocaseglob nocasematch;
line=$(__ckit_choice__)
echo $line
)
}
__ckit_choice__() {
__echoerr
__echoerr 1: ls
__echoerr 2: cd /tmp
__echoerr 3: cd /var/tmp
read -p "What command do you want to issue? " -n 1 -r
__echoerr # (optional) move to a new line
if [[ $REPLY =~ ^[1]$ ]]; then
echo ls
elif [[ $REPLY =~ ^[2]$ ]]; then
echo cd /tmp
elif [[ $REPLY =~ ^[3]$ ]]; then
echo cd /var/tmp
fi
}
This approach, binding C-r (of maybe some other key) to your python script which will do it's magic and output the correct command to STDOUT, which can be executed by the shell.
Note: I donot fully understand the bind command, unfortunately this shows "__ckit__" on the command line, and I donot understand why this is.
Right now, the shell history will only show
ckit
. It might be desirable that the actual commands that are run are added to the command history.The idea would be to also create a
~/$CKIT_HOME/config
file whenckit init
is run, where a variable is specified e.g.add_to_history=true
. If this is set toTrue
,ckit
should aim to add the command to the shell history.Potential issue here is that this might be shell specific, i.e. the requirements to make this happen differ between e.g.
zsh
andbash
.The text was updated successfully, but these errors were encountered: