forked from fish-shell/fish-shell
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hacky but functional tab completion that works with mixed cases
Fixes fish-shell#7944
- Loading branch information
Showing
1 changed file
with
5 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ae27633
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@razzius You can try my fork https://github.com/krackers/fish-shell/tree/3.3.1, see the last 3 commits; it solves this in a way that still preserves prefix insertion by borrowing ridiculousfish's idea of uniformly treating everything as
COMPLETE_REPLACES_TOKEN
by concat'ing the current token the non-replace ones.Tbh I feel things could be even simpler, if we are just willing to force all completions to use
COMPLETE_REPLACES_TOKEN
. From what I can see, the only thing that will be affected is completion for shell variables and globs. E.g. instead ofcd $HOME/[^]
returning completions as$HOME/foo, $HOME/bar
if you force theCOMPLETE_REPLACES_TOKEN
codepath then all completions will have$HOME
expanded. I.e. it will behave more like an abbreviation. Personally I don't think this behavior is bad, but some people may not like it.ae27633
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @krackers, thanks for commenting and thanks for your in the comment on the issue which I based this off of :)
I'd like to avoid expanding tokens in the completion; sometimes I want to have specific unexpanded variables in my history.
The issue with my approach and the reason I haven't tried to upstream this yet is the loss of the underlined prefix as I comment on here: fish-shell#7944 (comment)
Regardless the code can definitely be simplified, it's a hack to set the
COMPLETE_REPLACES_TOKEN
flag even for completions that don't replace the token. But I'm a bit over my head here in c++... and it doesn't help that the only test for this,tests/checks/tmux-complete.fish
is said to be flaky and is disabled in CI, and I get this error I don't understand when I run it: