Comments (4)
One conceptual question that comes up is: It hardly seems unlikely that I should want to complete successive parts of the full argument (eg sec
-> second-host
-> second-host,third-host
).
Could such completion be a part of this proposition? If not, how should the gap of being able to complete one word, or one bigword ('history token'), but not N successive parts of the same bigword be explained to the user?
from fish-shell.
Interesting. Useful, but kind of hard to implement and navigate. Consider this: On keypress, how to know whether to search for a longer or different word in history, opposed to appending the next part of the matching token? Also, which token? It's likely for a word to appear in many tokens.
I would rather limit this feature to completing and reverse searching for the typed word prefix:
sec
-> second-host
-> seconds
I would also leave it up to the user to append the separator, which can be space, comma, slash, period (... more?)
and will vary in different situations for the same word. Basically, typing a separator would end the reserve search.
So for your example it would be:
sec
-> second-host
Type ,th
, hit shortcut to new function
-> second-host,third-host
from fish-shell.
Also, which token?
The token you already selected (if it is not clear which this is: AFAICS it must be the token in the most recent item within the history that matched the word). I'm trying to point out that you are selecting a subset of a token already, so the user can logically ask 'why can't I just complete even more (incrementally) of this token which is already selected?' (analogous to how you can use Tab-completion to complete part of a filename, type a bit to cut down options, and then Tab again to select the final completion)
I'd also add that your original proposal already implicitly incorporates assumptions about separator (word
can be roughly defined as '1+ non-punctuation characters', in terms of what fish's *-word functions do); there are certainly different separators that may be relevant, but I think fish makes the assumption that the above definition of 'word' is good-enough for a majority of use cases.
Again, I'm not saying 'I totally want this thing that is a logical extension of your proposal'; I'm agnostic on whether that would be good. I'm just saying 'If your proposal was implemented, why would the user not expect the functionality to generalize to further words within the token?'
from fish-shell.
it must be the token in the most recent item within the history that matched the word
Just typing sec
does not select a token reliably. The most recent history item is not necessarily what I want. So a selection process must exist, and I'd go for history-word-search-backward
and history-word-search-forward
, replacing the word until the user is satisfied. Escape key (history-word-search-cancel
?) might cancel the selection and revert to sec
.
Actually, I can refine my previous post: The moment the user confirms the selection with a separator, the same function could progress the completion with matching tokens:
sec
-> hotkey -> second-host
second-host,
-> hotkey -> second-host,third-host
assuming first-host,second-host,fourth-host
exists in history
Hit hotkey again
second-host,third-host
-> second-host,fourth-host
So, grab all tokens matching the previous word (infix search), suggest the next word of the most recent token, scroll back in history when repeating hotkey.
To incorporate your suggestion, the remainder of the matched token could be printed in gray (just like current history autosuggestion), and partially be accepted in the same way (ctrl-right-arrow
, is that forward-bigword
?). I think that would be intuitive?
If computationally viable, the autosuggestion for token completion could always be shown.
So:
sec
ond-host,third-host -> ctrl-right key -> second-host
,third-host -> ctrl-right -> second-host,third-host
or:
sec
ond-host,third-host -> end key -> second-host,third-host
But also, assuming fourth-host,third-host
does not exist in history:
four
th-host -> ctrl-right key -> fourth-host
fourth-host,
(no suggestion) -> fourth-host,thi
rd-host -> ctrl-right-arrow -> fourth-host,third-host
The keybinds history-word-search-backward
and history-word-search-forward
would then only be used to select different tokens based on the current word search.
Edit: when full line autosuggestion is found, it would have precedence.
from fish-shell.
Related Issues (20)
- Autosuggestions sometimes get accepted without input HOT 11
- Fish doesn't use character classes with Globbing?fish HOT 1
- Cannot set universal variables in `fish --no-config` HOT 1
- Documentation: document method for not splitting shell outputs by newline HOT 2
- Can't set nim prompt for root user in Termux.
- Feature: Tab completion and showing description HOT 8
- fish_add_path does nothing on msys2, and set $PATH misbehaves HOT 5
- Key input after piping to `fzf` does not work with new extended keyboard input functionality HOT 3
- Focus reporting stays on in long-running loop
- Commandline is needlessly repainted with new extended keyboard input functionality HOT 4
- Multiple successive up-or-search broken in gnome terminal HOT 3
- Autosuggestions suggest non-existing files HOT 10
- mipsel arch lacks AtomicU64 support HOT 5
- Suppress wildcards-globbing for http(s) parameters HOT 1
- Can't use Windows Terminal's Starting Directory HOT 4
- document limitations of --condition HOT 4
- Request to add support for piping into `fish -c 'builtin'` for built-ins HOT 3
- Inconsistanc behavior when changing a symlinked folder in the current working directory HOT 1
- [Suggestion] Do not include final slash on path completion for symlinks to directories HOT 2
- `commandline` seems to lose line break characters HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fish-shell.