Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to terminate on specific character in search #1489

Open
lewisthompson opened this issue Jan 31, 2019 · 1 comment
Open

Add option to terminate on specific character in search #1489

lewisthompson opened this issue Jan 31, 2019 · 1 comment

Comments

@lewisthompson
Copy link

lewisthompson commented Jan 31, 2019

Assuming the following directory structure:

% tree .
.
├── b
│   ├── c
│   │   └── g
│   │       └── h
│   │           ├── j
│   │           └── k
│   └── d
└── e
    └── f

9 directories, 0 files

When in dir b/c/g/h/j with FZF_COMPLETION_TRIGGER='':

/tmp/b/c/g/h/j % cd ../<PRESSED_TAB>
> 
  2/2
> ../j
  ../k

Above I am using tab completion to get a listing of available directories to cd into. I quickly realise that I wanted to go a directory (or maybe more) further up the stack. My instinct is to type ../<TAB> as I would with standard bash/zsh tab completion. However, with FZF these keystrokes get passed into the search filter and I must instead press ^C and the ../<TAB>. Having to press ^C repeatedly gets old quickly.

My feature request is the ability to specify a character via the commandline that would immediately terminate fzf with a zero exit code. For this example let's name the argument --exit0-char.

In my .zshrc I would set export FZF_COMPLETION_OPTS='--select-1 --exit-0 --exit0-char=." which would be automatically picked up by __fzf_generic_path_completion in completion.zsh and offer (IMO) greatly enhanced path completion.

@lewisthompson
Copy link
Author

--bind='.:abort'" is extremely close to what I want here. The major downside is that the . entered to abort fzf does not get appended to the path. I tried mucking around in __fzf_generic_path_completion but couldn't come up with anything entirely satisfactory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant