Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbale to search in Preview pane #3477

Open
5 tasks
jobinjosem opened this issue Oct 12, 2023 · 1 comment
Open
5 tasks

Unbale to search in Preview pane #3477

jobinjosem opened this issue Oct 12, 2023 · 1 comment

Comments

@jobinjosem
Copy link

  • [ x] I have read through the manual page (man fzf)
  • [ x] I have the latest version of fzf
  • [ x] I have searched through the existing issues

Info

  • OS
    • [ x] Linux
    • Mac OS X
    • Windows
    • Etc.
  • Shell
    • [ x] bash
    • zsh
    • fish

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
Copy link

nuugen commented Oct 13, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants