diff --git a/zsh/fzf-completions.zsh b/zsh/fzf-completions.zsh new file mode 100644 index 0000000..d576f24 --- /dev/null +++ b/zsh/fzf-completions.zsh @@ -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 +} diff --git a/zshrc.zsh b/zshrc.zsh index f129f04..283b697 100644 --- a/zshrc.zsh +++ b/zshrc.zsh @@ -134,6 +134,10 @@ export BAT_THEME='OneHalfDark' # Source my own functions 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 test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh