-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Abbreviations for subcommands #6283
Comments
Makes sense. Future global abbreviations could have a condition flag (like What you can do right now is override some bindings: bind ' ' my-expand
bind \r 'my-expand execute'
bind \n 'my-expand execute' where function my-expand
set -l first_token (commandline -opc)[1]
set -l current_token (commandline -ct)
set -l exp
switch $first_token
case git
switch $current_token
case co; set exp checkout
case r; set exp rebase
case m; set exp master
end
case kubectl
# ...
end
if string length -q -- $exp
commandline --replace --current-token $exp
end
if string match -q execute $argv
commandline -f execute
else
commandline --insert ' '
commandline -f expand-abbr
end
end |
If you are going to add these things, you may as well also add expansion at any location not the beginning of the line (issue #6309 now). |
I also use "git ci" as an abbreviation for "git commit" and am interested in having tab completion with command and sub-command abbreviations. |
Duplicate of #5003 |
I disagree that this is a duplicate of #5003 as I explained in the OP. You might wish for a sub-command to expand to different abbreviations depending on the root command. |
You might want that, though it seems far too complicated for an abbrev system. Use a function instead? |
fish version: 3.0.0
OS: MacOS X 19.0.0
This is a feature proposal for abbreviation support for, for lack of a better term, subcommands. Similar but not the same as #5003. By subcommands I mean
status
ingit status
andget
inkubectl get
I find abbreviations super useful for amongst other things pair programming, saving on typing while keeping what is actually going on clear to the passenger, but I wish the following were possible:
I configure the following abbreviations:
I write
g co m
I get
git checkout master
, with each word expanding at the spaceIf scoping simply meant "the scoped word must be to the left of the currently being written word for abbreviations to be considered" then this would allow for DRYing up shared arguments e.g.
Thoughts?
The text was updated successfully, but these errors were encountered: