Setup some fzf completions for cURL

This commit is contained in:
Jonny Barnes 2024-02-10 22:34:30 +00:00
parent d948597d4e
commit 8b5250bf97
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
2 changed files with 19 additions and 0 deletions

15
zsh/fzf-completions.zsh Normal file
View file

@ -0,0 +1,15 @@
# fzf completions
test -e /opt/homebrew/opt/fzf/shell/completion.zsh && source /opt/homebrew/opt/fzf/shell/completion.zsh
test -e /usr/share/fzf/completion.zsh && source /usr/share/fzf/completion.zsh
# cURL completions copied from https://blog.revathskumar.com/2024/02/curl-fuzzy-search-options-using-fzf.html
_fzf_complete_curl() {
_fzf_complete --header-lines=1 --prompt="curl> " -- "$@" < <(
curl -h all
)
}
_fzf_complete_curl_post() {
awk '{print $1}' | cut -d ',' -f -1
}

View file

@ -134,6 +134,10 @@ export BAT_THEME='OneHalfDark'
# Source my own functions # Source my own functions
test -e $HOME/.zsh/functions.zsh && source $HOME/.zsh/functions.zsh test -e $HOME/.zsh/functions.zsh && source $HOME/.zsh/functions.zsh
# Setup fzf completions
export FZF_COMPLETION_TRIGGER='~~'
test -e $HOME/.zsh/fzf-completions.zsh && source $HOME/.zsh/fzf-completions.zsh
# Source the iTerm2 shell integration # Source the iTerm2 shell integration
test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh