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

tab special input function #3424

Closed
gertcuykens opened this issue Oct 5, 2016 · 15 comments
Closed

tab special input function #3424

gertcuykens opened this issue Oct 5, 2016 · 15 comments

Comments

@gertcuykens
Copy link

gertcuykens commented Oct 5, 2016

I would like to set a rule that pressing tab will block at the input cmd line if there are multiple suggestions and just wait for me to manually press the down button to go into the select menu or wait for me to simple start typing more characters.

Example fish, version 2.3.1
image

Until now everything fine but here's where I get frustrated a little :)
image

Once you are in the menu you can't go back to the letters you typed. Meaning you have to back space all the way back to the letter h if you wanted to type hi for example instead of he

Al I ask is a config rule that stops tab from entering the menu and simple stop doing anything at all unless there is only one possible completion left or I press the down button manually to select.

The tab should just be ignored until I type more text or press the down arrow to go into the menu.

My proposal is a set fish_tab wait that enables tab to wait for more key characters behavior.

Or to put it in other words tab never goes into menu mode without pressing the down arrow :) , just showing more suggestions is no problem if there are many more but the cursor and cmd input line should not change.

PS A similar style of tab completion can be tested by using vscode for example, where tab always completes the first solution and never goes into menu mode no matter how many solutions there are. It does show the menu but tab never goes in it.
image

EDIT: faho idea for a new special bind function instead of flag is way better
https://fishshell.com/docs/current/commands.html#bind

EDIT2: ridiculousfish idea backspace exit like esc is the best so far I think

@floam
Copy link
Member

floam commented Oct 5, 2016

For me hitting the escape key works to "back out".

@floam
Copy link
Member

floam commented Oct 5, 2016

(Annoyingly though, it used to be instant but the delay added in recent times adds some inertia you must fight to do this.)

@krader1961
Copy link
Contributor

it used to be instant but the delay added in recent times adds some inertia you must fight to do this.

We can undoubtedly do better here but as a quick-fix if you're not using vi-mode does set -u fish_escape_delay_ms 10 improve the experience? If you're using vi-mode you can also try other values less than 300 which is the default but note that depending on numerous factors the smaller the escape delay the more likely it is you'll see weird behavior. We might even want to lower that default timeout value since very few people are likely to be using vi-mode in an environment where obscene delays occur between the escape char and the next character other than when the [escape] key is pressed. And that will almost always be because the user wants to go from insert to normal/command mode.

@gertcuykens
Copy link
Author

gertcuykens commented Oct 5, 2016

Esc works, and I can imagine for users that also use the vim editor current behavior is perfect and natural. The users who use notepad however they go ...%$&^*&*(&!!! :D I am only suggesting a optional set flag unless I am forgetting a scenario where it's going to get very difficult to implement?

@floam
Copy link
Member

floam commented Oct 5, 2016

It may make sense to have vi mode and emacs mode have different behavior here?

@faho
Copy link
Member

faho commented Oct 5, 2016

@floam: They already do. emacs mode timeout is lower than vi.

@gertcuykens: What I would suggest here is, instead of some weird variable (which is something we try to keep to a minimum) a different bind command - "complete-no-page" or something like that. This will need changes to the c++ code, specifically reader.cpp.

@gertcuykens
Copy link
Author

You mean like bind \t complete-no-page right? That would be even better :D I don't know about the fish naming conventions I leave that up to you. But binding tab to an alternative behavior sounds awesome and way better than using a set flag.

@gertcuykens gertcuykens changed the title tab completion behavior config alternative tab bind command for completion Oct 5, 2016
@gertcuykens gertcuykens changed the title alternative tab bind command for completion tab special input function Oct 5, 2016
@ridiculousfish
Copy link
Member

What if delete did the same as escape here: close the menu and restore the command line? That seems natural to me.

@gertcuykens
Copy link
Author

Also very nice idea :D and probably better solution then mine, but is it much work to implement? I would like to try it out :D

@ridiculousfish ridiculousfish self-assigned this Oct 7, 2016
@ridiculousfish
Copy link
Member

You can do it with bindings like so:

bind \x7f 'if commandline --paging-mode ; commandline -f cancel; else; commandline -f backward-delete-char; end'

@ridiculousfish ridiculousfish added this to the fish-future milestone Oct 7, 2016
@gertcuykens
Copy link
Author

gertcuykens commented Oct 7, 2016

This is sooo much better, thanks :D I even think floam will like this beacuse its instand without delay. Please consider this default, I am sure allot of people are going to like this :)

@floam
Copy link
Member

floam commented Oct 7, 2016

I dig it. Delay aside, this makes a lot of sense to me on backspace.

@ridiculousfish
Copy link
Member

We already have some logic in the C++ to end paging on backspace; probably that's where this should be fixed.

@faho
Copy link
Member

faho commented Oct 25, 2018

This seems basically solved with the changes to the pager system - we no longer search immediately, so it's much easier to get out of the pager.

@faho faho closed this as completed Oct 25, 2018
@faho faho modified the milestones: fish-future, fish-3.0 Oct 25, 2018
@ridiculousfish
Copy link
Member

Thanks for this amazing cleanup of old issues 😍

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

No branches or pull requests

5 participants