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
Suggestions about edit:small-word-abbr behavior #1472
Comments
FWIW, The
If I type |
I thought it was what Fish abbr seems to expand only at "start of command" and it is quite nice. (Haven't looked at implementation details yet) 1, 3 expands 2 not. |
+1 Can we at least make it a configuration option? I wouldn't mind trying my hands at a PR if the solution would be accepted. |
From my comment in issue #1540 for anyone who stumbles upon this issue and wants to look at the implementation to understand why small word abbreviations behave like they do:
Close, but not correct. See the implementation, but the short answer is that the trigger char simply has to be in a different category than the last character of the abbreviation; see the definition of |
I'm coming over from #1540, which does not seem like a great idea upon seeing the implementation (thanks @krader1961). I see two potential changes/features in this thread:
As I see it there are really 3 options for a "fix":
Option 3 in interesting as simple abbreviations and small-word abbreviations have a behaviour that is orthogonal to what we are describing here, which are really abbreviations that behave the same way as Fish abbreviations. We likely do not want 3 different kinds of abbreviations, so that may not be the best solution. I also agree with the following, which is a solution more like option 2:
Is the intention of small-word abbreviations not to handle abbreviations in the same way as Fish? What is a use case for how Elvish handles small-word abbreviations where they are expanded like this? |
No, it was meant to be more flexible by allowing expansion anywhere on the command line subject to the "small word" matching restriction. In contrast to the "simple" expansions created by Looking at my abbreviations I have only two "simple" abbreviations:
I have twenty small word abbreviations and every single one is only meant to be expanded in the command position; i.e., the Fish behavior. Which is why I'm sometimes annoyed when the expansion occurs at some other position of the command line. I'm in favor of adding a third type of abbreviation that is only expanded in the command position; ala Fish. Perhaps named |
It turns out that the "small word" abbreviation mechanism I added isn't really what I, or most users, want. What users really want, at least most of the time, is the Fish shell abbreviation behavior of expanding an abbreviation only in the command head position. Resolves elves#1472
It turns out that the "small word" abbreviation mechanism I added isn't really what I, or most users, want. What users really want, at least most of the time, is the Fish shell abbreviation behavior of expanding an abbreviation only in the command head position. Resolves #1472
Hi @krader1961
I'm trying to replace fish
abbr
withedit:small-word-abbr
.Current implementation seems to be
But can we also skip an abbreviation if it begins with symbols like
-
,_
if it doesn't have matching abbr using it ?If i set something like this.
ls -k<space>
expands tols -kubectl
and it is obviously not intended.The text was updated successfully, but these errors were encountered: