Skip to content

Instantly share code, notes, and snippets.

@Piqlet
Last active April 27, 2022 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Piqlet/02f8bcdd74e9c5e1f45112704901e975 to your computer and use it in GitHub Desktop.
Save Piqlet/02f8bcdd74e9c5e1f45112704901e975 to your computer and use it in GitHub Desktop.
Simple terminal help for easier use of commands.
04-03-2022 9:05 Linux terminal help
Simple terminal help for easier use of commands.
1. exec
# cmd=$(cat ~/help.txt | fzf) && history -s $cmd && echo $cmd && echo $cmd > ~/help.tmp && . ~/help.tmp
# cmd=$(cat ~/help.txt | fzf) && history -s $cmd && echo $cmd | tee ~/help.tmp && . ~/help.tmp
# cmd=$(cat ~/help.txt | fzf) && history -s $cmd && echo $cmd && eval $cmd
cmd=$(< ~/help.txt fzf) && history -s $cmd && echo $cmd && eval $cmd
source : https://porkmail.org/era/unix/award#uucaletter
2. edit
# cmd=$(cat ~/help.txt | fzf) && read -p "read > " -e -i "$cmd" && history -s $REPLY && echo $REPLY > ~/help.tmp && . ~/help.tmp
# read -p "read > " -e -i "$(cat ~/help.txt | fzf)" && history -s $REPLY && echo $REPLY > ~/help.tmp && . ~/help.tmp
# read -p "read > " -e -i "$(cat ~/help.txt | fzf)" && history -s $REPLY && eval $REPLY
read -p "readline > " -ei "$(< ~/help.txt fzf)" && history -s $REPLY && eval $REPLY
1. exec
# Not working if ignoredups active :
# cmd=$(cat ~/help.txt | fzf) && history -s $cmd && history -s $cmd && fc -s && history -d $(history 1)
history -s $(< ~/help.txt fzf) && history -s x && fc -s
2. edit
# cmd=$(cat ~/help.txt | fzf) && read -p "read > " -e -i "$cmd" && history -s $REPLY && history -s $REPLY && fc -s && history -d $(history 1)
# read -p "read > " -e -i "$(cat ~/help.txt | fzf)" && history -s $REPLY && history -s $REPLY && fc -s && history -d $(history 1)
read -p "readline > " -ei "$(< ~/help.txt fzf)" && history -s $REPLY && history -s x && fc -s
More :
edit:
xdotool type "$(cat ~/help.txt | fzf)"
xdotool type "$(cat ~/help.txt | fzf)" && echo
stty -echo && xdotool type --delay 0 "$(cat ~/help.txt | fzf)" && stty echo
exec:
stty -echo && xdotool type --delay 0 "$(cat ~/help.txt | fzf)$(printf "\n\b")" && stty echo
stty -echo && xdotool type --delay 0 "$(printf "$(cat ~/help.txt | fzf)\r\r")" && stty echo
source:
https://stackoverflow.com/questions/31846572/why-does-xdotool-type-twice-how-can-i-avoid-it
Not perfect:
command $(cat ~/help.txt | fzf)
echo | $(cat ~/help.txt | fzf)
echo -ne "\n" | $(cat ~/help.txt | fzf)
fzf settings : fzf --tac --bind=left-click:accept --no-color --pointer='+' --cycle --exact
interactive filters:
https://lobste.rs/s/squpog/interactive_filter_new_standard_tool
+ skim:
https://github.com/lotabout/skim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment