mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 07:13:48 -05:00
Added - how to add kubectl completion with fzf
39
Examples.md
39
Examples.md
@@ -42,6 +42,7 @@ Table of Contents
|
|||||||
* [jrnl](#jrnl)
|
* [jrnl](#jrnl)
|
||||||
* [tmux](#tmux)
|
* [tmux](#tmux)
|
||||||
* [dictcc translation](#dictcc-translation)
|
* [dictcc translation](#dictcc-translation)
|
||||||
|
* [kubectl](#kubectl)
|
||||||
* Moving from other tools
|
* Moving from other tools
|
||||||
* [fzf as rofi replacement](#fzf-as-rofi-replacement)
|
* [fzf as rofi replacement](#fzf-as-rofi-replacement)
|
||||||
* [fzf as dmenu replacement](#fzf-as-dmenu-replacement)
|
* [fzf as dmenu replacement](#fzf-as-dmenu-replacement)
|
||||||
@@ -932,6 +933,44 @@ ALT-` key will split the current window and start fzf for the entire list of fil
|
|||||||
bind-key -n 'M-`' run "tmux split-window -p 40 'tmux send-keys -t #{pane_id} \"$(locate / | fzf -m | paste -sd\\ -)\"'"
|
bind-key -n 'M-`' run "tmux split-window -p 40 'tmux send-keys -t #{pane_id} \"$(locate / | fzf -m | paste -sd\\ -)\"'"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### kubectl
|
||||||
|
Add support for kubectl completion with fzf
|
||||||
|
```bash
|
||||||
|
# Tested kubectl version `v1.23.6`
|
||||||
|
# Make all kubectl completion fzf
|
||||||
|
command -v fzf >/dev/null 2>&1 && {
|
||||||
|
source <(kubectl completion bash | sed 's#"${requestComp}" 2>/dev/null#"${requestComp}" 2>/dev/null | head -n -1 | fzf --multi=0 #g') # setup autocomplete for istioctl
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Put this in your `.bashrc` insted of
|
||||||
|
```bash
|
||||||
|
source <(kubectl completion bash)
|
||||||
|
```
|
||||||
|
It will source kubectl completion with fzf support
|
||||||
|
Examples:
|
||||||
|
```bash
|
||||||
|
# Will open fzf windows with k8s objects starting with `p`
|
||||||
|
kubectl get p<tab><tab>
|
||||||
|
|
||||||
|
# Will open fzf list of pods.
|
||||||
|
kubectl get pods <tab><tab>
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
This will make all kubectl commands use fzf for completion.<br>
|
||||||
|
This was tested with:
|
||||||
|
|
||||||
|
- [x] version `v1.23.6`
|
||||||
|
- [x] bash
|
||||||
|
- commands:
|
||||||
|
- [x] get
|
||||||
|
- [x] get pods
|
||||||
|
- [x] describe
|
||||||
|
- [x] describe pods
|
||||||
|
- [x] logs
|
||||||
|
|
||||||
|
|
||||||
### ASDF
|
### ASDF
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Reference in New Issue
Block a user