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

zsh-like menu for completions #291

Closed
ridiculousfish opened this issue Aug 22, 2012 · 38 comments
Closed

zsh-like menu for completions #291

ridiculousfish opened this issue Aug 22, 2012 · 38 comments
Milestone

Comments

@ridiculousfish
Copy link
Member

@ridiculousfish ridiculousfish commented Aug 22, 2012

This issue tracks a zsh-like menu for completions, as discussed in #84

Note that in typical zsh fashion, the menu system requires some magic to enable, listed at http://www.refining-linux.org/archives/40/ZSH-Gem-5-Menu-selection/

@lledey
Copy link
Contributor

@lledey lledey commented Aug 22, 2012

Great feature !

Maybe it could support backtab key (shift+tab) to return back in the list.
It would be useful if you have a very long list of matching completions and you just passed the command you wanted.

@KevinCorcoran
Copy link

@KevinCorcoran KevinCorcoran commented Jun 5, 2013

+1

1 similar comment
@ikashkuta
Copy link

@ikashkuta ikashkuta commented Nov 19, 2013

+1

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Jan 25, 2014

This issue tracks proposed improvements to the pager UI. The pager is what prints the list of options when you hit tab.

Here's my thinking on what the goals ought to be:

  • Inline and interactive. It should not stay onscreen after you're done interacting with it, but it should also not have an entirely separate UI. zsh's listing of the completions below the prompt is very slick, and a good model.
  • No jarring transitions. The worst experience in the existing pager is when you tab complete and fish_pager takes over your screen with a huge list. Tab completion should never fill your screen without warning.
  • Non-modal, as far as possible. Much like history search, we should try to avoid sticking the user in a weird mode that requires special input to escape. Cautionary examples include 'reverse-history-search' and "Display all 200 possibilities? (y/n)"
  • Progressively filterable. If you have a big list of completions, it would be nice if you could filter / search it effectively, to winnow down the options you want.

My thinking on the UI is "progressive disclosure." Tab shows you a short list of completions, with an affordance for listing the rest. Because the initial list is short, it initially requires only a handful of lines.

I've committed work towards a new pager in df60c00 . It can be enabled by setting the 'fish_new_pager' variable to 1. Feedback very much welcome.

@terlar
Copy link
Contributor

@terlar terlar commented Jan 25, 2014

Awesome work, looks exciting. The first spontaneous feeling is that it is kind of weird that you can use all arrow keys except one (down). Which kind of makes sense, maybe. But it feels like you move down with tab and arround with all the other keys so you have to user fingers in different places. On the other hand you cannot only use the tab since shift-tab does nothing.

I suggest that shift-tab should move in the oposite direction just like up arrow key does. That would feel more natural for me. Then you can use tab/shift-tab to navigate vertically and the arrow keys (left/right) to navigate horizontally.

Another option would be to allow the down arrow key, but maybe that will hinder some other feature.

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Jan 25, 2014

Hmm, the down arrow key is supposed to work! Looks like it's a bug that it doesn't.

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Jan 25, 2014

Heh, this appears to be due to a difference in wc between OS X and Linux.

down-or-search has this code:

set lineno (commandline -L)
set line_count (commandline|wc -l)
switch $lineno
    case $line_count
    commandline -f history-search-forward

    case '*'
    commandline -f down-line
end

On OS X, the wc -l invocation produces a leading tab. This causes it to fail to match the case $line_count line. How funny.

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Jan 25, 2014

Ok, the wc issue should be fixed as 2139334 , and down arrow should be made to work via 6d13b8b . Thanks for reporting that bug.

@terlar
Copy link
Contributor

@terlar terlar commented Jan 26, 2014

Ah, didn't realize it was a bug, but makes sense. Thank you, works very well now. Will keep testing.

It would still be nice to have shift-tab to go backwards though, is that possible or does it have some technical limitation?

Also is there some way to set the color?

It seems it is using the variable fish_color_search_match, but when I do set fish_color_search_match white --bold --background=purple it ignores the text color. I guess it is related to the color being set for the highlighted part of the completion and then reset back explicitly to normal.

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Jan 28, 2014

We can definitely support shift-tab going backwards.

It should use the existing "fish_pager_color" colors, which are:

  • fish_pager_color_prefix
  • fish_pager_color_completion
  • fish_pager_color_description
  • fish_pager_color_progress
  • fish_pager_color_secondary

However the existing pager misinterprets at least fish_pager_color_progress (it sets the foreground color as the background), so things might look different.

@terlar
Copy link
Contributor

@terlar terlar commented Jan 28, 2014

Just want to say I really enjoy the latest changes, the search felt very natural, very discoverable. Great work!

The only issue I have experienced but haven't really pinpointed is that sometimes when I start a new terminal it displays the search: ___________. Although I can still enter into the prompt as usual, and as soon as I enter a character it will disappear.

@terlar
Copy link
Contributor

@terlar terlar commented Jan 28, 2014

Actually I can manage to freeze the search input by entering stuff, erasing it and using arrows up and down frenetically. First it seemed random, but found a way to achive this every time...

Create following directory structure:

mkdir basedir
cd basedir
mkdir Code
mkdir Documents
mkdir Downloads
mkdir Dropbox
mkdir Music
touch Notes
mkdir Pictures
touch terminfo
mkdir Videos
mkdir Volumes

Then stand inside this dir, and do following actions:

ls <tab>
<down><down>
fs
<backspace>

This operation causes freezing for me every time.

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Jan 29, 2014

Nice finds! The mysterious search field is probably due to a bool that I failed to initialize.

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Jan 30, 2014

Mystery search field should be fixed as bfc7818

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Feb 17, 2014

Freezing should be fixed as 2253c57

@maxfl
Copy link
Contributor

@maxfl maxfl commented Feb 20, 2014

Maybe I'm missing it, but is there a way to open all the completions without searching and moving cursor to the bottom? I often need it when I want to use the competions list instead of manual pages to read the option descriptions.

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Feb 20, 2014

How about double-tapping tab to reveal everything?

ridiculousfish added a commit that referenced this issue Feb 20, 2014
@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Feb 20, 2014

Double tapping idea is implemented as 8eaabac to see how it feels

@maxfl
Copy link
Contributor

@maxfl maxfl commented Feb 21, 2014

I like the double-tapping idea. It's intuitive and doesn't require additional keys. Works nice.

ridiculousfish added a commit that referenced this issue Feb 23, 2014
@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Feb 23, 2014

de2eea0 turns this on by default.

@bentolor
Copy link

@bentolor bentolor commented Mar 3, 2014

Kudos for this great feature. I discovered it by accident on checking the logs. And i love it!

I have one small issue: The feature seems to behave different on my various systems. While it works as expected on most systems (precise, old-stable):
fish-working

On on specific system (saucy) i cannot select / navigate entries with my arrow keys nor is the current selected proposal higlighted:
fish2

Same system. The red one is just a telnet session to home.

Any idea what causes this different behaviour?

@bentolor
Copy link

@bentolor bentolor commented Mar 3, 2014

I reapplied a different color theme in fish_config. It seems my issue is the missing background colouring there?

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented Mar 3, 2014

@bschmid What value do you have set for $fish_color_search_match ?

@bentolor
Copy link

@bentolor bentolor commented Mar 4, 2014

@ridiculousfish In the working case --background=purple in the non-working case just purple. I never toyed with those vars directly. (Re-)applying themes via fish_config did not help/change them either.

Finally I stumbled upon vared which allowed to me change the value interactively. Thanks for the pointer!

@nasedo
Copy link

@nasedo nasedo commented Aug 5, 2014

How about making typing '/' synonymous with pressing enter to select a directory candidate? I miss that from zsh. It's easy to type and feels natural.

@zanchey
Copy link
Member

@zanchey zanchey commented Sep 29, 2014

This is on by default now - ok to close?

@xfix
Copy link
Member

@xfix xfix commented Sep 29, 2014

I guess.

@gilvaju
Copy link

@gilvaju gilvaju commented May 22, 2015

How to use tab list completions with arrows keys?

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented May 22, 2015

When the pager list is shown, you can either press the Down arrow to start navigating it, or press tab again. When an item is highlighted the arrow keys let you navigate. Does that answer your question?

@gilvaju
Copy link

@gilvaju gilvaju commented May 23, 2015

In my terminal that does not happen. When I press tab, the list of suggestions appears but prompt ever appears again.
screen shot 2015-05-22 at 21 19 40

@ridiculousfish
Copy link
Member Author

@ridiculousfish ridiculousfish commented May 23, 2015

This feature is in 2.2, which isn't released yet. You can install the beta from http://fishshell.com/beta/.

@gilvaju
Copy link

@gilvaju gilvaju commented May 23, 2015

Ah understood. How I would install the beta version via homebrew on osx? I thank the attention.

@oschrenk
Copy link

@oschrenk oschrenk commented May 23, 2015

Not sure how to install a specific version but you can install directly from latest source if you like to live on the edge

brew install fish --HEAD
@gilvaju
Copy link

@gilvaju gilvaju commented May 23, 2015

Perfect, worked !!!!!! Thank you !!!

@jordelver
Copy link

@jordelver jordelver commented Aug 13, 2015

This feature is really awesome. Thank you 👍

@pickfire
Copy link
Contributor

@pickfire pickfire commented Aug 17, 2015

The feature is here now. Should this issue be closed?

@faho
Copy link
Member

@faho faho commented Aug 17, 2015

The issue has been closed for almost a year now.

@pickfire
Copy link
Contributor

@pickfire pickfire commented Aug 17, 2015

Sorry about that.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet