junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
65.15k stars 2.4k forks source link

Unbale to search in Preview pane #3477

Closed jobinjosem closed 1 month ago

jobinjosem commented 1 year ago

Info

Problem / Steps to reproduce

I have a Kubernetes YAML configuration as shown below which is added as an alias in WSL bash. The OS is Ubuntu 22.04.

alias getyaml='function get_k8s_yaml() {
    kubectl get $1 -o=json | jq -r ".items[].metadata.name" | fzf --preview "kubectl get $1 {} -o=yaml" --preview-window=up:60% | xargs -I {} sh -c "kubectl get $1 {} -o=yaml | yq .";
}; get_k8s_yaml'

This function accepts a resource type as an argument and displays the YAML-formatted value in a preview pane. I want to know if it's possible to search for specific text in the preview pane once the YAML-formatted text is displayed. Additionally, I've been unable to apply syntax highlighting to the preview pane using bat. Can someone help with these issues? I also tried to pipe the output to bat but that didn't work.

alias getyaml='function get_k8s_yaml() { kubectl get $1 -o=json | jq -r ".items[].metadata.name" | fzf --preview "kubectl get $1 {} -o=yaml | bat -l yaml" --preview-window=up:60% | xargs -I {} sh -c "kubectl get $1 {} -o=yaml | yq . | bat -l yaml"; }; get_k8s_yaml'

nuugen commented 1 year ago

For syntax highlighting in the preview pane, you can pass in --color=always to bat.

junegunn commented 1 month ago

I want to know if it's possible to search for specific text in the preview pane once the YAML-formatted text is displayed.

No, search inside preview window is not supported.