Closed jobinjosem closed 1 month ago
For syntax highlighting in the preview pane, you can pass in --color=always
to bat
.
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.
man fzf
)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.
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'