Add abbreviations in fish config The 2019 Stack Overflow Developer Survey Results Are Inre-use...
How come people say “Would of”?
Are there any other methods to apply to solving simultaneous equations?
Why is the maximum length of OpenWrt’s root password 8 characters?
Multiply Two Integer Polynomials
How to save as into a customized destination on macOS?
Loose spokes after only a few rides
Have you ever entered Singapore using a different passport or name?
Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?
Is this app Icon Browser Safe/Legit?
Resizing object distorts it (Illustrator CC 2018)
What is the accessibility of a package's `Private` context variables?
Worn-tile Scrabble
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Is a "Democratic" Oligarchy-Style System Possible?
How to notate time signature switching consistently every measure
Is there any way to tell whether the shot is going to hit you or not?
What do hard-Brexiteers want with respect to the Irish border?
Why do we hear so much about the Trump administration deciding to impose and then remove tariffs?
Are there incongruent pythagorean triangles with the same perimeter and same area?
Does the shape of a die affect the probability of a number being rolled?
How technical should a Scrum Master be to effectively remove impediments?
Can you compress metal and what would be the consequences?
Do these rules for Critical Successes and Critical Failures seem Fair?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
Add abbreviations in fish config
The 2019 Stack Overflow Developer Survey Results Are Inre-use '~/.profile` for Fish?chain Fish commands via `&&` or `||`Can't start new fish session after incorrectly closing fish_configFish Shell STDERR not outputted by defaultEscape-backspace behavior in fish shell like in other shellsCtrl-enter for fish shellUnescaped commandline content in fish shellCombining functions in FishChange color of hostname in Fish shell promptFish shell doesn't return program error
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I would like to use the abbreviations feature of the fish shell, especially for the known bash variable !!
or aliases to common git commands. I know that abbreviations can be added like in the following snippet:
abbr -a gco git checkout
I also know that this setting is persisted in a file located at .config/fish/fishd.host
, but this file is also saying that it should not be edited, since changes might be lost (because the file is auto generated).
So my question is how to add this abbreviations in a config file, because I want to put my dotfiles in a git repository. And if I use these dotfiles on a separate machine I don't want to execute all these abbr
command again.
shell fish
add a comment |
I would like to use the abbreviations feature of the fish shell, especially for the known bash variable !!
or aliases to common git commands. I know that abbreviations can be added like in the following snippet:
abbr -a gco git checkout
I also know that this setting is persisted in a file located at .config/fish/fishd.host
, but this file is also saying that it should not be edited, since changes might be lost (because the file is auto generated).
So my question is how to add this abbreviations in a config file, because I want to put my dotfiles in a git repository. And if I use these dotfiles on a separate machine I don't want to execute all these abbr
command again.
shell fish
Did you ever find a good way to do this? I agree that the answer below isn't so useful.
– ezuk
Apr 3 '16 at 6:02
No, I didn't yet :-/
– Daniel Rotter
Apr 5 '16 at 7:37
add a comment |
I would like to use the abbreviations feature of the fish shell, especially for the known bash variable !!
or aliases to common git commands. I know that abbreviations can be added like in the following snippet:
abbr -a gco git checkout
I also know that this setting is persisted in a file located at .config/fish/fishd.host
, but this file is also saying that it should not be edited, since changes might be lost (because the file is auto generated).
So my question is how to add this abbreviations in a config file, because I want to put my dotfiles in a git repository. And if I use these dotfiles on a separate machine I don't want to execute all these abbr
command again.
shell fish
I would like to use the abbreviations feature of the fish shell, especially for the known bash variable !!
or aliases to common git commands. I know that abbreviations can be added like in the following snippet:
abbr -a gco git checkout
I also know that this setting is persisted in a file located at .config/fish/fishd.host
, but this file is also saying that it should not be edited, since changes might be lost (because the file is auto generated).
So my question is how to add this abbreviations in a config file, because I want to put my dotfiles in a git repository. And if I use these dotfiles on a separate machine I don't want to execute all these abbr
command again.
shell fish
shell fish
edited Mar 7 '16 at 17:52
Daniel Rotter
asked Mar 6 '16 at 13:21
Daniel RotterDaniel Rotter
133311
133311
Did you ever find a good way to do this? I agree that the answer below isn't so useful.
– ezuk
Apr 3 '16 at 6:02
No, I didn't yet :-/
– Daniel Rotter
Apr 5 '16 at 7:37
add a comment |
Did you ever find a good way to do this? I agree that the answer below isn't so useful.
– ezuk
Apr 3 '16 at 6:02
No, I didn't yet :-/
– Daniel Rotter
Apr 5 '16 at 7:37
Did you ever find a good way to do this? I agree that the answer below isn't so useful.
– ezuk
Apr 3 '16 at 6:02
Did you ever find a good way to do this? I agree that the answer below isn't so useful.
– ezuk
Apr 3 '16 at 6:02
No, I didn't yet :-/
– Daniel Rotter
Apr 5 '16 at 7:37
No, I didn't yet :-/
– Daniel Rotter
Apr 5 '16 at 7:37
add a comment |
4 Answers
4
active
oldest
votes
Sorry, I'm not sure if I understand what you're asking. But if your question is how to set your abbr
definitions on startup (and in a file that you can store in a repository and share between machines), you should use the file ~/.config/fish/config.fish
which is Fish's equivalent to .bashrc
in Bash.
Since abbreviations are stored in global/universal variables, they don't need to be reset every time you open a terminal window, so you can place a safeguard in that config file to prevent resetting them every time (speeding things up a bit), as explained here:
https://github.com/fish-shell/fish-shell/issues/1976#issuecomment-168698602
Edit (April 2019):
After Fish changed the way universal variables are stored in version 3.0.0 the safeguard functionality seems to prevent changes made in the abbr list to be included also after opening new terminal windows or rebooting one's machine. So, I've removed those lines from the example.
E.g. my config.fish
looks like this (for Git commands):
echo -n Setting abbreviations...
abbr g 'git'
abbr ga 'git add'
abbr gb 'git branch'
abbr gbl 'git blame'
abbr gc 'git commit -m'
abbr gca 'git commit --amend -m'
abbr gco 'git checkout'
abbr gcp 'git cherry-pick'
abbr gd 'git diff'
abbr gf 'git fetch'
abbr gl 'git log'
abbr gm 'git merge'
abbr gp 'git push'
abbr gpf 'git push --force-with-lease'
abbr gpl 'git pull'
abbr gr 'git remote'
abbr grb 'git rebase'
abbr gs 'git status'
abbr gst 'git stash'
echo 'Done'
1
Thanks for this, reading the docs (fishshell.com/docs/current/commands.html) below the first snippet of code, the paragraph is really vague about it and only says it will "slow down the shell" but does not offer this incredibly simple alternative alongside it, cheers again!
– SidOfc
Feb 7 '18 at 20:34
add a comment |
Fixed this! What I ended up doing is just making the output of abbr -s
into a Fish script. So in brief:
abbr -s > abbr.fish
(edit abbr.fish, add the following line to the top:) #! /usr/bin/fish
chmod +x abbr.fish
And you're done!
All you have to do now is just run abbr.fish
on any Fish machine you want your abbreviations on, and presto.
add a comment |
Abbreviations are stored as universal variables in fish, so, in my opinion, they are more suitable to be used interactively as a quick & dirty™ way to persist your favorite expansions.
If you would like this configuration to be available in other boxes and sync them up with your dotfiles, I recommend creating a function as gco.fish
, etc., for each abbreviation instead.
gco.fish
function gco
command git checkout $argv
end
Functions are lazily loaded in fish and will always perform better than running abbr
(which is also not a fish builtin, but a regular function with a definition type abbr
) for each abbreviation in your config.fish
.
But this way the aliases won't auto expand as if they were abbreviations, or do they? That's like the coolest thing about the abbreviations ;-)
– Daniel Rotter
Mar 8 '16 at 6:56
Yes, you are correct. It's a small tradeoff. I personally don't use abbr as they are implemented using universal variables and those, while super handy, it's something I will avoid if I can.
– Jorge Bucaran
Mar 8 '16 at 10:23
2
Another disadvantage is that auto complete doesn't work for me anymore... Typinggco <tab>
doesn't show the branches anymore...
– Daniel Rotter
Mar 8 '16 at 21:03
@DanielRotter It would be too good if the function could inherit completions automatically. But the good news is, it would not be hard at all to usecomplete
to copy the existing git completions into each of the functions. You will need a directory for your "git aliases", a functions directory for each function and a completions directory to add your completions, ideally one for each function too, but not necessarily so.
– Jorge Bucaran
Mar 9 '16 at 2:15
add a comment |
I have been trying fish again, and found a solution which is working for me now. It is also described that way in the fish documentation.
They simply suggest to reset fish_user_abbreviations
and call every abbr
again and again. (I didn't even use the if
in my case, also works well)
if status --is-interactive
set -g fish_user_abbreviations
abbr --add first 'echo my first abbreviation'
abbr --add second 'echo my second abbreviation'
# etcetera
end
It's actually similar to what MJV suggested, but without the downside that it is cached. The tradeoff is probably that startup is a little bit slower, but I'll keep an eye on that. I am going with that variant, since it is also mentioned in the documentation.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1049368%2fadd-abbreviations-in-fish-config%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sorry, I'm not sure if I understand what you're asking. But if your question is how to set your abbr
definitions on startup (and in a file that you can store in a repository and share between machines), you should use the file ~/.config/fish/config.fish
which is Fish's equivalent to .bashrc
in Bash.
Since abbreviations are stored in global/universal variables, they don't need to be reset every time you open a terminal window, so you can place a safeguard in that config file to prevent resetting them every time (speeding things up a bit), as explained here:
https://github.com/fish-shell/fish-shell/issues/1976#issuecomment-168698602
Edit (April 2019):
After Fish changed the way universal variables are stored in version 3.0.0 the safeguard functionality seems to prevent changes made in the abbr list to be included also after opening new terminal windows or rebooting one's machine. So, I've removed those lines from the example.
E.g. my config.fish
looks like this (for Git commands):
echo -n Setting abbreviations...
abbr g 'git'
abbr ga 'git add'
abbr gb 'git branch'
abbr gbl 'git blame'
abbr gc 'git commit -m'
abbr gca 'git commit --amend -m'
abbr gco 'git checkout'
abbr gcp 'git cherry-pick'
abbr gd 'git diff'
abbr gf 'git fetch'
abbr gl 'git log'
abbr gm 'git merge'
abbr gp 'git push'
abbr gpf 'git push --force-with-lease'
abbr gpl 'git pull'
abbr gr 'git remote'
abbr grb 'git rebase'
abbr gs 'git status'
abbr gst 'git stash'
echo 'Done'
1
Thanks for this, reading the docs (fishshell.com/docs/current/commands.html) below the first snippet of code, the paragraph is really vague about it and only says it will "slow down the shell" but does not offer this incredibly simple alternative alongside it, cheers again!
– SidOfc
Feb 7 '18 at 20:34
add a comment |
Sorry, I'm not sure if I understand what you're asking. But if your question is how to set your abbr
definitions on startup (and in a file that you can store in a repository and share between machines), you should use the file ~/.config/fish/config.fish
which is Fish's equivalent to .bashrc
in Bash.
Since abbreviations are stored in global/universal variables, they don't need to be reset every time you open a terminal window, so you can place a safeguard in that config file to prevent resetting them every time (speeding things up a bit), as explained here:
https://github.com/fish-shell/fish-shell/issues/1976#issuecomment-168698602
Edit (April 2019):
After Fish changed the way universal variables are stored in version 3.0.0 the safeguard functionality seems to prevent changes made in the abbr list to be included also after opening new terminal windows or rebooting one's machine. So, I've removed those lines from the example.
E.g. my config.fish
looks like this (for Git commands):
echo -n Setting abbreviations...
abbr g 'git'
abbr ga 'git add'
abbr gb 'git branch'
abbr gbl 'git blame'
abbr gc 'git commit -m'
abbr gca 'git commit --amend -m'
abbr gco 'git checkout'
abbr gcp 'git cherry-pick'
abbr gd 'git diff'
abbr gf 'git fetch'
abbr gl 'git log'
abbr gm 'git merge'
abbr gp 'git push'
abbr gpf 'git push --force-with-lease'
abbr gpl 'git pull'
abbr gr 'git remote'
abbr grb 'git rebase'
abbr gs 'git status'
abbr gst 'git stash'
echo 'Done'
1
Thanks for this, reading the docs (fishshell.com/docs/current/commands.html) below the first snippet of code, the paragraph is really vague about it and only says it will "slow down the shell" but does not offer this incredibly simple alternative alongside it, cheers again!
– SidOfc
Feb 7 '18 at 20:34
add a comment |
Sorry, I'm not sure if I understand what you're asking. But if your question is how to set your abbr
definitions on startup (and in a file that you can store in a repository and share between machines), you should use the file ~/.config/fish/config.fish
which is Fish's equivalent to .bashrc
in Bash.
Since abbreviations are stored in global/universal variables, they don't need to be reset every time you open a terminal window, so you can place a safeguard in that config file to prevent resetting them every time (speeding things up a bit), as explained here:
https://github.com/fish-shell/fish-shell/issues/1976#issuecomment-168698602
Edit (April 2019):
After Fish changed the way universal variables are stored in version 3.0.0 the safeguard functionality seems to prevent changes made in the abbr list to be included also after opening new terminal windows or rebooting one's machine. So, I've removed those lines from the example.
E.g. my config.fish
looks like this (for Git commands):
echo -n Setting abbreviations...
abbr g 'git'
abbr ga 'git add'
abbr gb 'git branch'
abbr gbl 'git blame'
abbr gc 'git commit -m'
abbr gca 'git commit --amend -m'
abbr gco 'git checkout'
abbr gcp 'git cherry-pick'
abbr gd 'git diff'
abbr gf 'git fetch'
abbr gl 'git log'
abbr gm 'git merge'
abbr gp 'git push'
abbr gpf 'git push --force-with-lease'
abbr gpl 'git pull'
abbr gr 'git remote'
abbr grb 'git rebase'
abbr gs 'git status'
abbr gst 'git stash'
echo 'Done'
Sorry, I'm not sure if I understand what you're asking. But if your question is how to set your abbr
definitions on startup (and in a file that you can store in a repository and share between machines), you should use the file ~/.config/fish/config.fish
which is Fish's equivalent to .bashrc
in Bash.
Since abbreviations are stored in global/universal variables, they don't need to be reset every time you open a terminal window, so you can place a safeguard in that config file to prevent resetting them every time (speeding things up a bit), as explained here:
https://github.com/fish-shell/fish-shell/issues/1976#issuecomment-168698602
Edit (April 2019):
After Fish changed the way universal variables are stored in version 3.0.0 the safeguard functionality seems to prevent changes made in the abbr list to be included also after opening new terminal windows or rebooting one's machine. So, I've removed those lines from the example.
E.g. my config.fish
looks like this (for Git commands):
echo -n Setting abbreviations...
abbr g 'git'
abbr ga 'git add'
abbr gb 'git branch'
abbr gbl 'git blame'
abbr gc 'git commit -m'
abbr gca 'git commit --amend -m'
abbr gco 'git checkout'
abbr gcp 'git cherry-pick'
abbr gd 'git diff'
abbr gf 'git fetch'
abbr gl 'git log'
abbr gm 'git merge'
abbr gp 'git push'
abbr gpf 'git push --force-with-lease'
abbr gpl 'git pull'
abbr gr 'git remote'
abbr grb 'git rebase'
abbr gs 'git status'
abbr gst 'git stash'
echo 'Done'
edited yesterday
answered Dec 14 '16 at 10:20
MJVMJV
21125
21125
1
Thanks for this, reading the docs (fishshell.com/docs/current/commands.html) below the first snippet of code, the paragraph is really vague about it and only says it will "slow down the shell" but does not offer this incredibly simple alternative alongside it, cheers again!
– SidOfc
Feb 7 '18 at 20:34
add a comment |
1
Thanks for this, reading the docs (fishshell.com/docs/current/commands.html) below the first snippet of code, the paragraph is really vague about it and only says it will "slow down the shell" but does not offer this incredibly simple alternative alongside it, cheers again!
– SidOfc
Feb 7 '18 at 20:34
1
1
Thanks for this, reading the docs (fishshell.com/docs/current/commands.html) below the first snippet of code, the paragraph is really vague about it and only says it will "slow down the shell" but does not offer this incredibly simple alternative alongside it, cheers again!
– SidOfc
Feb 7 '18 at 20:34
Thanks for this, reading the docs (fishshell.com/docs/current/commands.html) below the first snippet of code, the paragraph is really vague about it and only says it will "slow down the shell" but does not offer this incredibly simple alternative alongside it, cheers again!
– SidOfc
Feb 7 '18 at 20:34
add a comment |
Fixed this! What I ended up doing is just making the output of abbr -s
into a Fish script. So in brief:
abbr -s > abbr.fish
(edit abbr.fish, add the following line to the top:) #! /usr/bin/fish
chmod +x abbr.fish
And you're done!
All you have to do now is just run abbr.fish
on any Fish machine you want your abbreviations on, and presto.
add a comment |
Fixed this! What I ended up doing is just making the output of abbr -s
into a Fish script. So in brief:
abbr -s > abbr.fish
(edit abbr.fish, add the following line to the top:) #! /usr/bin/fish
chmod +x abbr.fish
And you're done!
All you have to do now is just run abbr.fish
on any Fish machine you want your abbreviations on, and presto.
add a comment |
Fixed this! What I ended up doing is just making the output of abbr -s
into a Fish script. So in brief:
abbr -s > abbr.fish
(edit abbr.fish, add the following line to the top:) #! /usr/bin/fish
chmod +x abbr.fish
And you're done!
All you have to do now is just run abbr.fish
on any Fish machine you want your abbreviations on, and presto.
Fixed this! What I ended up doing is just making the output of abbr -s
into a Fish script. So in brief:
abbr -s > abbr.fish
(edit abbr.fish, add the following line to the top:) #! /usr/bin/fish
chmod +x abbr.fish
And you're done!
All you have to do now is just run abbr.fish
on any Fish machine you want your abbreviations on, and presto.
answered Apr 25 '16 at 11:30
ezukezuk
103212
103212
add a comment |
add a comment |
Abbreviations are stored as universal variables in fish, so, in my opinion, they are more suitable to be used interactively as a quick & dirty™ way to persist your favorite expansions.
If you would like this configuration to be available in other boxes and sync them up with your dotfiles, I recommend creating a function as gco.fish
, etc., for each abbreviation instead.
gco.fish
function gco
command git checkout $argv
end
Functions are lazily loaded in fish and will always perform better than running abbr
(which is also not a fish builtin, but a regular function with a definition type abbr
) for each abbreviation in your config.fish
.
But this way the aliases won't auto expand as if they were abbreviations, or do they? That's like the coolest thing about the abbreviations ;-)
– Daniel Rotter
Mar 8 '16 at 6:56
Yes, you are correct. It's a small tradeoff. I personally don't use abbr as they are implemented using universal variables and those, while super handy, it's something I will avoid if I can.
– Jorge Bucaran
Mar 8 '16 at 10:23
2
Another disadvantage is that auto complete doesn't work for me anymore... Typinggco <tab>
doesn't show the branches anymore...
– Daniel Rotter
Mar 8 '16 at 21:03
@DanielRotter It would be too good if the function could inherit completions automatically. But the good news is, it would not be hard at all to usecomplete
to copy the existing git completions into each of the functions. You will need a directory for your "git aliases", a functions directory for each function and a completions directory to add your completions, ideally one for each function too, but not necessarily so.
– Jorge Bucaran
Mar 9 '16 at 2:15
add a comment |
Abbreviations are stored as universal variables in fish, so, in my opinion, they are more suitable to be used interactively as a quick & dirty™ way to persist your favorite expansions.
If you would like this configuration to be available in other boxes and sync them up with your dotfiles, I recommend creating a function as gco.fish
, etc., for each abbreviation instead.
gco.fish
function gco
command git checkout $argv
end
Functions are lazily loaded in fish and will always perform better than running abbr
(which is also not a fish builtin, but a regular function with a definition type abbr
) for each abbreviation in your config.fish
.
But this way the aliases won't auto expand as if they were abbreviations, or do they? That's like the coolest thing about the abbreviations ;-)
– Daniel Rotter
Mar 8 '16 at 6:56
Yes, you are correct. It's a small tradeoff. I personally don't use abbr as they are implemented using universal variables and those, while super handy, it's something I will avoid if I can.
– Jorge Bucaran
Mar 8 '16 at 10:23
2
Another disadvantage is that auto complete doesn't work for me anymore... Typinggco <tab>
doesn't show the branches anymore...
– Daniel Rotter
Mar 8 '16 at 21:03
@DanielRotter It would be too good if the function could inherit completions automatically. But the good news is, it would not be hard at all to usecomplete
to copy the existing git completions into each of the functions. You will need a directory for your "git aliases", a functions directory for each function and a completions directory to add your completions, ideally one for each function too, but not necessarily so.
– Jorge Bucaran
Mar 9 '16 at 2:15
add a comment |
Abbreviations are stored as universal variables in fish, so, in my opinion, they are more suitable to be used interactively as a quick & dirty™ way to persist your favorite expansions.
If you would like this configuration to be available in other boxes and sync them up with your dotfiles, I recommend creating a function as gco.fish
, etc., for each abbreviation instead.
gco.fish
function gco
command git checkout $argv
end
Functions are lazily loaded in fish and will always perform better than running abbr
(which is also not a fish builtin, but a regular function with a definition type abbr
) for each abbreviation in your config.fish
.
Abbreviations are stored as universal variables in fish, so, in my opinion, they are more suitable to be used interactively as a quick & dirty™ way to persist your favorite expansions.
If you would like this configuration to be available in other boxes and sync them up with your dotfiles, I recommend creating a function as gco.fish
, etc., for each abbreviation instead.
gco.fish
function gco
command git checkout $argv
end
Functions are lazily loaded in fish and will always perform better than running abbr
(which is also not a fish builtin, but a regular function with a definition type abbr
) for each abbreviation in your config.fish
.
edited Mar 8 '16 at 1:57
answered Mar 8 '16 at 1:46
Jorge BucaranJorge Bucaran
376213
376213
But this way the aliases won't auto expand as if they were abbreviations, or do they? That's like the coolest thing about the abbreviations ;-)
– Daniel Rotter
Mar 8 '16 at 6:56
Yes, you are correct. It's a small tradeoff. I personally don't use abbr as they are implemented using universal variables and those, while super handy, it's something I will avoid if I can.
– Jorge Bucaran
Mar 8 '16 at 10:23
2
Another disadvantage is that auto complete doesn't work for me anymore... Typinggco <tab>
doesn't show the branches anymore...
– Daniel Rotter
Mar 8 '16 at 21:03
@DanielRotter It would be too good if the function could inherit completions automatically. But the good news is, it would not be hard at all to usecomplete
to copy the existing git completions into each of the functions. You will need a directory for your "git aliases", a functions directory for each function and a completions directory to add your completions, ideally one for each function too, but not necessarily so.
– Jorge Bucaran
Mar 9 '16 at 2:15
add a comment |
But this way the aliases won't auto expand as if they were abbreviations, or do they? That's like the coolest thing about the abbreviations ;-)
– Daniel Rotter
Mar 8 '16 at 6:56
Yes, you are correct. It's a small tradeoff. I personally don't use abbr as they are implemented using universal variables and those, while super handy, it's something I will avoid if I can.
– Jorge Bucaran
Mar 8 '16 at 10:23
2
Another disadvantage is that auto complete doesn't work for me anymore... Typinggco <tab>
doesn't show the branches anymore...
– Daniel Rotter
Mar 8 '16 at 21:03
@DanielRotter It would be too good if the function could inherit completions automatically. But the good news is, it would not be hard at all to usecomplete
to copy the existing git completions into each of the functions. You will need a directory for your "git aliases", a functions directory for each function and a completions directory to add your completions, ideally one for each function too, but not necessarily so.
– Jorge Bucaran
Mar 9 '16 at 2:15
But this way the aliases won't auto expand as if they were abbreviations, or do they? That's like the coolest thing about the abbreviations ;-)
– Daniel Rotter
Mar 8 '16 at 6:56
But this way the aliases won't auto expand as if they were abbreviations, or do they? That's like the coolest thing about the abbreviations ;-)
– Daniel Rotter
Mar 8 '16 at 6:56
Yes, you are correct. It's a small tradeoff. I personally don't use abbr as they are implemented using universal variables and those, while super handy, it's something I will avoid if I can.
– Jorge Bucaran
Mar 8 '16 at 10:23
Yes, you are correct. It's a small tradeoff. I personally don't use abbr as they are implemented using universal variables and those, while super handy, it's something I will avoid if I can.
– Jorge Bucaran
Mar 8 '16 at 10:23
2
2
Another disadvantage is that auto complete doesn't work for me anymore... Typing
gco <tab>
doesn't show the branches anymore...– Daniel Rotter
Mar 8 '16 at 21:03
Another disadvantage is that auto complete doesn't work for me anymore... Typing
gco <tab>
doesn't show the branches anymore...– Daniel Rotter
Mar 8 '16 at 21:03
@DanielRotter It would be too good if the function could inherit completions automatically. But the good news is, it would not be hard at all to use
complete
to copy the existing git completions into each of the functions. You will need a directory for your "git aliases", a functions directory for each function and a completions directory to add your completions, ideally one for each function too, but not necessarily so.– Jorge Bucaran
Mar 9 '16 at 2:15
@DanielRotter It would be too good if the function could inherit completions automatically. But the good news is, it would not be hard at all to use
complete
to copy the existing git completions into each of the functions. You will need a directory for your "git aliases", a functions directory for each function and a completions directory to add your completions, ideally one for each function too, but not necessarily so.– Jorge Bucaran
Mar 9 '16 at 2:15
add a comment |
I have been trying fish again, and found a solution which is working for me now. It is also described that way in the fish documentation.
They simply suggest to reset fish_user_abbreviations
and call every abbr
again and again. (I didn't even use the if
in my case, also works well)
if status --is-interactive
set -g fish_user_abbreviations
abbr --add first 'echo my first abbreviation'
abbr --add second 'echo my second abbreviation'
# etcetera
end
It's actually similar to what MJV suggested, but without the downside that it is cached. The tradeoff is probably that startup is a little bit slower, but I'll keep an eye on that. I am going with that variant, since it is also mentioned in the documentation.
add a comment |
I have been trying fish again, and found a solution which is working for me now. It is also described that way in the fish documentation.
They simply suggest to reset fish_user_abbreviations
and call every abbr
again and again. (I didn't even use the if
in my case, also works well)
if status --is-interactive
set -g fish_user_abbreviations
abbr --add first 'echo my first abbreviation'
abbr --add second 'echo my second abbreviation'
# etcetera
end
It's actually similar to what MJV suggested, but without the downside that it is cached. The tradeoff is probably that startup is a little bit slower, but I'll keep an eye on that. I am going with that variant, since it is also mentioned in the documentation.
add a comment |
I have been trying fish again, and found a solution which is working for me now. It is also described that way in the fish documentation.
They simply suggest to reset fish_user_abbreviations
and call every abbr
again and again. (I didn't even use the if
in my case, also works well)
if status --is-interactive
set -g fish_user_abbreviations
abbr --add first 'echo my first abbreviation'
abbr --add second 'echo my second abbreviation'
# etcetera
end
It's actually similar to what MJV suggested, but without the downside that it is cached. The tradeoff is probably that startup is a little bit slower, but I'll keep an eye on that. I am going with that variant, since it is also mentioned in the documentation.
I have been trying fish again, and found a solution which is working for me now. It is also described that way in the fish documentation.
They simply suggest to reset fish_user_abbreviations
and call every abbr
again and again. (I didn't even use the if
in my case, also works well)
if status --is-interactive
set -g fish_user_abbreviations
abbr --add first 'echo my first abbreviation'
abbr --add second 'echo my second abbreviation'
# etcetera
end
It's actually similar to what MJV suggested, but without the downside that it is cached. The tradeoff is probably that startup is a little bit slower, but I'll keep an eye on that. I am going with that variant, since it is also mentioned in the documentation.
answered Dec 30 '17 at 12:29
Daniel RotterDaniel Rotter
133311
133311
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1049368%2fadd-abbreviations-in-fish-config%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you ever find a good way to do this? I agree that the answer below isn't so useful.
– ezuk
Apr 3 '16 at 6:02
No, I didn't yet :-/
– Daniel Rotter
Apr 5 '16 at 7:37