summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-06-04 16:23:47 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-06-04 16:23:47 +0900
commitbf0cb4bfe208cecb99ac27e6770c6d034d1bff3c (patch)
treebc9b184bee8eb23771fabc2d2a06d0c84e289b12
parent773133c4ce80b55ebc2bc9a79d3ec1c6b5b03d17 (diff)
Use find as the default command on Cygwin environment
-rw-r--r--src/constants.go13
-rw-r--r--src/constants_unix.go8
-rw-r--r--src/constants_windows.go8
3 files changed, 13 insertions, 16 deletions
diff --git a/src/constants.go b/src/constants.go
index 941fdcc4..06889903 100644
--- a/src/constants.go
+++ b/src/constants.go
@@ -1,6 +1,7 @@
package fzf
import (
+ "os"
"time"
"github.com/junegunn/fzf/src/util"
@@ -47,6 +48,18 @@ const (
defaultJumpLabels string = "asdfghjklqwertyuiopzxcvbnm1234567890ASDFGHJKLQWERTYUIOPZXCVBNM`~;:,<.>/?'\"!@#$%^&*()[{]}-_=+"
)
+var defaultCommand string
+
+func init() {
+ if !util.IsWindows() {
+ defaultCommand = `command find -L . -mindepth 1 \( -path '*/\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-`
+ } else if os.Getenv("TERM") == "cygwin" {
+ defaultCommand = `sh -c "command find -L . -mindepth 1 -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-"`
+ } else {
+ defaultCommand = `dir /s/b`
+ }
+}
+
// fzf events
const (
EvtReadNew util.EventType = iota
diff --git a/src/constants_unix.go b/src/constants_unix.go
deleted file mode 100644
index 94371e62..00000000
--- a/src/constants_unix.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// +build !windows
-
-package fzf
-
-const (
- // Reader
- defaultCommand = `command find -L . -mindepth 1 \( -path '*/\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-`
-)
diff --git a/src/constants_windows.go b/src/constants_windows.go
deleted file mode 100644
index efd3f11c..00000000
--- a/src/constants_windows.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// +build windows
-
-package fzf
-
-const (
- // Reader
- defaultCommand = `dir /s/b`
-)