-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
- I have read through the manual page (
man fzf) - I have the latest version of fzf
- I have searched through the existing issues
Info
- OS
- Linux
- Mac OS X
- Windows
- Etc.
- Shell
- bash
- zsh
- fish
Problem / Steps to reproduce
I am working on a project in which I need to print several json files through jq after selecting them with fzf. For that, I'm creating an array with the fzf selection and then loop on it. My problem is whenever I enclose the command in ( $( ) ) (for an array) or even just $( ), the fzf custom commands associated with keybindings cease working. fzf just flashes but then comes back to the preview. Contrariwise, if I just run the code without enclosing it in an array or variable, then custom fzf commands work, but then of course I cannot loop through the files fzf returns when I press Return.
See below my code (several options are irrelevant to the issue but I left them in case there is actually something wrong with one of them):
cod=( $(find . -type f -printf '%f\n' | sort | \
fzf --ansi \
--header=$'C-p print & exit
C-e edit
C-x edit beautified
dep: kakoune
C-v view table/json
C-r ripgrep
dep: rga-fzf
? toggle preview\n\n' \
--preview="cat {} | jq" \
--preview-window="right:80%:wrap:cycle" --delimiter / --with-nth -1 \
--bind="?:toggle-preview" \
--bind="ctrl-r:execute(rga-fzf {} '')" \
--bind="ctrl-e:execute(${EDITOR:-vim --not-a-term} {} </dev/tty)" \
--bind="ctrl-x:execute(kak -e 'execute-keys <%><|>jq<ret><g><e>' {} </dev/tty)" \
--bind="ctrl-p:execute(cat {} | jq)+abort" \
--bind="ctrl-v:execute(cat {} | jq | jtbl -t | less -SN)" \
--height=100% \
--layout=reverse \
--cycle \
--border \
--marker='*' \
--multi) )
for i in "${cod[@]}"
do printf "\n$i\n--------\n"
jq < "$i"
doneI have read the manual and did some research before opening this issue, I hope I did not miss something.
Is there something I am doing wrong or is there actually a conflict between custom commands and having fzf enclosed into a variable or array for later steps?