summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSean Flanigan <sean@flanigan.org>2020-11-21 20:52:11 +1000
committerMarc Cornellà <hello@mcornella.com>2021-12-17 13:22:58 +0100
commit52a46ec362389429049cc36b0806627db02f099e (patch)
tree36577f37701f06fc9685eabcb4ab420de81a3f48 /plugins
parent010c36d4ab0b6f9037a278c39ed6d41586f25843 (diff)
downloadzsh-52a46ec362389429049cc36b0806627db02f099e.tar.gz
zsh-52a46ec362389429049cc36b0806627db02f099e.tar.bz2
zsh-52a46ec362389429049cc36b0806627db02f099e.zip
feat(fzf): support fzf in Cygwin (#9463)
Closes #9463
Diffstat (limited to 'plugins')
-rw-r--r--plugins/fzf/fzf.plugin.zsh25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
index 50712cbee..102605958 100644
--- a/plugins/fzf/fzf.plugin.zsh
+++ b/plugins/fzf/fzf.plugin.zsh
@@ -149,6 +149,30 @@ function fzf_setup_using_openbsd() {
return 0
}
+function fzf_setup_using_cygwin() {
+ # Cygwin installs fzf in /usr/local/bin/fzf
+ if [[ "$OSTYPE" != cygwin* ]] || (( ! $+commands[fzf] )); then
+ return 1
+ fi
+
+ # The fzf-zsh-completion package installs the auto-completion in
+ local completions="/etc/profile.d/fzf-completion.zsh"
+ # The fzf-zsh package installs the key-bindings file in
+ local key_bindings="/etc/profile.d/fzf.zsh"
+
+ # Auto-completion
+ if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
+ source "$completions" 2>/dev/null
+ fi
+
+ # Key bindings
+ if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
+ source "$key_bindings" 2>/dev/null
+ fi
+
+ return 0
+}
+
# Indicate to user that fzf installation not found if nothing worked
function fzf_setup_error() {
cat >&2 <<'EOF'
@@ -160,6 +184,7 @@ EOF
fzf_setup_using_openbsd \
|| fzf_setup_using_debian \
|| fzf_setup_using_opensuse \
+ || fzf_setup_using_cygwin \
|| fzf_setup_using_base_dir \
|| fzf_setup_error