m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-14 22:33:47 -05:00

Add --tty-default=/dev/tty and --no-tty-default option (#4352)

Fix #4242.

Use --no-tty-default, if you want fzf to perform a TTY look-up instead of defaulting to /dev/tty.
This commit is contained in:
Junegunn Choi
2025-04-20 11:24:50 +09:00
committed by GitHub
parent e491770f1c
commit 1d761684c5
9 changed files with 53 additions and 27 deletions

View File

@@ -631,6 +631,7 @@ type Options struct {
MEMProfile string
BlockProfile string
MutexProfile string
TtyDefault string
}
func filterNonEmpty(input []string) []string {
@@ -730,6 +731,7 @@ func defaultOptions() *Options {
WalkerOpts: walkerOpts{file: true, hidden: true, follow: true},
WalkerRoot: []string{"."},
WalkerSkip: []string{".git", "node_modules"},
TtyDefault: tui.DefaultTtyDevice,
Help: false,
Version: false}
}
@@ -2336,6 +2338,12 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
}
case "--no-tmux":
opts.Tmux = nil
case "--tty-default":
if opts.TtyDefault, err = nextString("tty device name required"); err != nil {
return err
}
case "--no-tty-default":
opts.TtyDefault = ""
case "--force-tty-in":
// NOTE: We need this because `system('fzf --tmux < /dev/tty')` doesn't
// work on Neovim. Same as '-' option of fzf-tmux.