Skip to content
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

Share computer-independent configurations #5870

Closed
lucmos opened this issue May 10, 2019 · 7 comments
Closed

Share computer-independent configurations #5870

lucmos opened this issue May 10, 2019 · 7 comments
Labels

Comments

@lucmos
Copy link

lucmos commented May 10, 2019

Hello,

I'd like to share my fish configuration (mainly, the colors) across computers.

The problem that I'm facing right now is the following.
I have an instance on EC2 and I'd like to (easily, I usually use yadm to sync dotfiles) configure fish.
I thought that something like

sudo apt install fish
yadm clone my-repo

would give to the remote fish the same look and behaviour of the local fish, but it isn't working.
I tried to sync the entire .config/fish folder but it isn't working, the colors stay the same.

This is quite annoying since with my shell theme the default colors of fish aren't adeguate.
Using fish-config isn't straightforward since I can't open the link direcly in the browser (I should open some ports/do some tunneling).

It would be great to have a file, or a folder, with all the computer-independent configurations that can be synced across computers.

Is it already possible?

@faho
Copy link
Member

faho commented May 11, 2019

Is it already possible?

@lucamoschella: It is, if you're using fish >= 3.0.

The reason why colors and such don't show up is because they're saved as universal variables, which are stored in a file inside ~/.config/fish, but before 3.0 it included a host identifier (mac address or hostname). Since 3.0 it's named fish_variables, so it's machine-independent by default.

If you can't upgrade to 3.0 (you really should), you'll have to set your colors in config.fish, e.g. via something like

if not set -q luca_settings
    # you can get these via `set -U | grep color`
    set -U fish_color_autosuggestion '555'  'brblack'
    set -U fish_color_cancel -r
    set -U fish_color_command 005fd7
    set -U fish_color_comment 990000
    # and so on
    set -U luca_settings # this makes sure we don't reexecute this block
end

@faho faho added RFC question and removed RFC labels May 11, 2019
@lucmos
Copy link
Author

lucmos commented May 11, 2019

Oh okay, that's great!
So the main problem is that locally I'm using fish 3 instead remotely (in the ubuntu repos) it's still fish 2.2.0

Just to be sure, in order to move the fish configuration to another computer (that uses fish 3), do I have just to copy the .config/fish folder?

Because in my local fish I'm getting:

$ cat fish_variables
# This file is automatically generated by the fish.
# Do NOT edit it directly, your changes will be overwritten.
SET ZO_CMD:zo
SET Z_CMD:z
SET Z_DATA:/home/luca/\x2elocal/share/z/data
SET Z_DATA_DIR:/home/luca/\x2elocal/share/z
SET Z_EXCLUDE:/home/luca
SET __fish_classic_git_prompt_initialized:\x1d
SET __fish_init_2_39_8:\x1d
SET __fish_init_2_3_0:\x1d
SET fish_color_autosuggestion:969896
SET fish_color_cancel:\x2dr
SET fish_color_command:c397d8
SET fish_color_comment:e7c547
SET fish_color_cwd:green
SET fish_color_cwd_root:red
SET fish_color_end:c397d8
SET fish_color_error:d54e53
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
SET fish_color_history_current:\x2d\x2dbold
SET fish_color_host:normal
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
SET fish_color_normal:normal
SET fish_color_operator:bryellow
SET fish_color_param:7aa6da
SET fish_color_quote:b9ca4a
SET fish_color_redirection:70c0b1
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SET fish_color_status:red
SET fish_color_user:brgreen
SET fish_color_valid_path:\x2d\x2dunderline
SET fish_greeting:\x1d
SET fish_key_bindings:fish_default_key_bindings
SET fish_pager_color_completion:\x1d
SET fish_pager_color_description:B3A06D\x1eyellow
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan

As you can see it's not completely portable since there are absolute paths (I think, added by z)

@faho
Copy link
Member

faho commented May 11, 2019

remotely (in the ubuntu repos) it's still fish 2.2.0

We offer a PPA: https://launchpad.net/~fish-shell/+archive/ubuntu/release-3.

Just to be sure, in order to move the fish configuration to another computer (that uses fish 3), do I have just to copy the .config/fish folder?

Yes.

@lucmos
Copy link
Author

lucmos commented May 11, 2019

Great, thanks!

@lucmos
Copy link
Author

lucmos commented May 11, 2019

@faho

What do you think about adding a guideline for plugin developers stating that the fish_varibles is meant to be machine-independent and it should be kept so?

@lucmos lucmos reopened this May 11, 2019
@faho
Copy link
Member

faho commented May 11, 2019

a guideline for plugin developers stating that the fish_varibles is meant to be machine-independent and it should be kept so?

Plugin developers have no influence on where that file is kept, and we don't have any guidelines for them. If you have any issue with a plugin about keeping machine-dependent settings in universal variables, take it up with them.

@guillaumecherel
Copy link

Can we still share the file fish_variables accross machines when the usernames on the different machines are different?

My home directory on my local laptop is /home/guillaume. On a remote server where I work remotely, it is /home/guillaume-c.
After doing fish_add_path $HOME/.pyenv locally, the file fish_variables defines the fish_user_paths whith an entry /home/guillaume/.pyenv.

SETUVAR fish_user_paths:/home/guillaume/\x2epyenv\x1e/usr/local/cuda\x2d12\x2e4/bin\x1e/home/guillaume/\x2epyenv/bin\x1e/home/guillaume/\x2elocal/bin

If I share it with my server, the path will be wrong because it should point to /home/guillaume-c/.pyenv. How should I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants