Need documentation for using CHEAT_USE_FZF=true
Is your feature request related to a problem? Please describe. I am trying using fzf with cheat for autocompletion. Currently bash autocompletion is working (after setting cheat.bash script in the correct path). But I have no clue how to trigger the fzf for completion. ( I looked at the code, but somehow fzf isn't triggered)
Describe the solution you'd like it would be nice to have clear note in documentation how fzf will be triggered (such as pressing a tab, or expand using ctrl-t (?), or such as using ** to expand when tab is pressed? )
Describe alternatives you've considered
This might not be needed -as usually the cheatsheets for selection isn't a lot; I currently often use cheat -l | grep to get the sheets I need, but it would be nice to have the function built in. More ideally, would allow a tmux pane to show/preview the cheatsheet as fzf is being used to select the cheatsheet.
Additional context Thanks!
I'm usng this atm, it works pretty well for me.
function fzcheat() {
local fzf_args=( -d ':' --ansi --with-nth '2..'
--bind 'ctrl-y:execute-silent(echo {1} | clip)'
--bind 'alt-e:execute(cheat -e {1})'
--bind 'ctrl-m:execute:cheat -c {1} | $PAGER'
--history "${XDG_DATA_HOME:-$HOME/.locale/share}"/fzf/history/fzf_cheat )
[ -z "$*" ] || fzf_args+=( -q "$*" )
cheat -l |
awk -v c_tag_l=$'\e[1m' \
-v c_tag_r=$'\e[0m' \
-e 'NR == 1 { next }' \
-e '{
tags=""
for (i=3; i <= NF; i++) {
tags = $i FS
}
sub(FS "$", "", tags)
printf("%s:%s%s\n", $1, $1, tags ? (c_tag_l " [" tags "] " c_tag_r) : "")
}' |
fzf "${fzf_args[@]}"
}
@ipstone have you found out how it works already ? if so, can you please share the steps with me as well pls sir. I am a complete newb at this and don't even know what is meant by “right directory” ..
This is the best I could do for now on my side : cheat -l | awk '{print $1}' | fzf | xargs -I{} cheat {}
so did an alias in bashrc alias fch='cheat -l | awk \047{print$1}\047 | fzf | xargs -I{} cheat {}'
pls let me know if there's a beter way instead