View previous topic :: View next topic |
Author |
Message |
SpiderPigLoki Tux's lil' helper
Joined: 22 Aug 2008 Posts: 90
|
Posted: Thu Apr 23, 2020 7:47 am Post subject: [SOLVED] app-shells/fish ignores own config-file? |
|
|
Hello everybody,
it seems that fish does not source it's own config file.
Code: |
ser@Gentoo ~> cat .config/fish/config.fish
source ~/.bash_aliases
alias ls='ls --color=auto'
alias ll='ls -lah --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
[rest omitted for brevity - lots of other aliases following] |
Fish ist started only in interative shells with the following code:
Code: |
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Put your fun stuff here.
export LIBVIRT_DEFAULT_URI="qemu:///session"
export XDG_CONFIG_HOME="~/.config/"
source ~/.bash_aliases
# Makes fish inherit the ENV from bash, hence we don't have to source our alias-file again
# keep this line at the bottom of ~/.bashrc
#[ -x /bin/fish ] && SHELL=/bin/fish exec /bin/fish
SHELL=/bin/fish exec /bin/fish
user@Gentoo ~> |
If I manually run source .config/fish/config.fish, everythings works as would be expected.
Maybe another thing to note is the fact, that if I run fish_config I get the webpage to configure fish, but those changes never seem to take effect. Config-file under .config/fish/ also never changes.
If there is anything else missing, please let me know.
Cheers!
SPL
UPDATE 2020-06-02 - Topic solved
Problem was this line in .bashrc: export XDG_CONFIG_HOME="~/.config/".
Comment it out and you're (probably!) good to go.
Last edited by SpiderPigLoki on Tue Jun 02, 2020 6:16 pm; edited 1 time in total |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21607
|
Posted: Fri Apr 24, 2020 1:51 am Post subject: |
|
|
What does the fish documentation say about when that configuration file will be read? Your invocation of fish seems not to make it a login shell, which may cause it to skip some forms of initialization. May I ask why you chose to have bash exec fish instead of just setting fish as your system shell? |
|
Back to top |
|
|
Dr.Willy Guru
Joined: 15 Jul 2007 Posts: 547 Location: NRW, Germany
|
Posted: Fri Apr 24, 2020 7:31 am Post subject: |
|
|
Hu wrote: | May I ask why you chose to have bash exec fish instead of just setting fish as your system shell? |
Mostly due to the initialization of environment stuff such as /etc/env.d and /etc/profile.d which are sh-specific. _________________ gentoo repos: kakoune | oil | hyper-v |
|
Back to top |
|
|
SpiderPigLoki Tux's lil' helper
Joined: 22 Aug 2008 Posts: 90
|
Posted: Fri Apr 24, 2020 9:04 pm Post subject: |
|
|
@hu:
fish is not the native shell, since most programs require bash or some other shell that sources the dirs that Dr.Willy mentioned.
Also see here: https://bugs.gentoo.org/545830
fish is invoked the way it is, because that's what official wiki says.
https://wiki.gentoo.org/wiki/Fish#.bashrc_safety_net
Also emerge explicitly mentioned the bug and wiki entry, when fish is installed.
So I guess it's RTFM-time for me now
EDIT:
From https://fishshell.com/docs/current/index.html#initialization
Order of configs is as follows:
1. /usr/share/fish/config.fish
2. /etc/fish/config.fish
3. .config/fish/conf.d/
EDIT2:
Quote from doc:
Quote: | Note that ~/.config/fish/config.fish is sourced after the snippets. |
Turns out that config.fish outside of conf.d should be valid... maybe old doc or typo in the doc?
(TBH: It works for me now - just FYI)
After creating conf.d under .config/fish/ and putting my files there as they are, everything works.... or at least as far as I can tell now. At least my aliases are present.
Will test this tomorrow and report back, but for now I would consider this problem solved.
Cheers!
SPL |
|
Back to top |
|
|
SpiderPigLoki Tux's lil' helper
Joined: 22 Aug 2008 Posts: 90
|
Posted: Sun May 10, 2020 6:57 pm Post subject: |
|
|
Hello everybody.
Sorry for the late reply.
I would not consider this solved. At least not completely.
The problem with the aliases not being present, I could workaround.
First source the aliases / the file where they are defined, and then convert them to a fish-function
Code: |
source ~/.alias
funcsave $alias_name
|
However the command "fish_config" still seems to be unable to set (and save) the prompt or the coloursheme.
I tested this under Ubuntu (via KVM / Qemu) and there the command works. A file called fish.ubuntuQemu is being created. (ubuntu.Qemu is the hostname of the VM)
Any idea what that might be about?
Cheers
SPL |
|
Back to top |
|
|
SpiderPigLoki Tux's lil' helper
Joined: 22 Aug 2008 Posts: 90
|
Posted: Tue Jun 02, 2020 6:14 pm Post subject: Problem solved |
|
|
Hello everybody,
problem is solved. The problem was that I had added the following line to .bashrc
Code: |
export XDG_CONFIG_HOME="~/.config/"
|
This should have been "/home/username/.config" or whatever. Honestly I just got rid of the line and now everything works as expected.
I can create a config.fish, which is sourced at startup, just like .bashrc is for BASH or .zshrc for ZSH.
Cheers and cheerio
SPL |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21607
|
Posted: Wed Jun 03, 2020 12:46 am Post subject: |
|
|
Code: | /# a0=~/a
/# a1="~/a"
/# a2=$HOME/a
/# a3="$HOME/a"
/# echo $a{0..3}
/root/a ~/a /root/a /root/a | Quoting with double-quotes inhibits ~ expansion, but not variable expansion.
When fish_config failed to save the changes, it should have displayed an error message about being unable to write the file due to "No such file or directory." Did it? If not, that seems like a bug. |
|
Back to top |
|
|
|