jethrokuan / z

Pure-fish z directory jumping
MIT License
1.29k stars 45 forks source link

Computer-independent configuration #78

Closed lucmos closed 5 years ago

lucmos commented 5 years ago

It would be great if the z config files would be computer independent (I'm having problems moving fish from one computer to another automatically due to it)

I think it should be enough to use paths relative to the home directory ~/path instead of absolute paths /home/user/path

jethrokuan commented 5 years ago

I generally don't recommend also using the same z cache file across computers, the cache tends to build up quickly too so in practice it hasn't really affected me. It's also difficult/impossible to support the workaround you suggested, dealing with ~ is tricky: see https://github.com/jethrokuan/z/issues/70

lucmos commented 5 years ago

I understand.

However fish-shell introduced the file fish_variables in order to be computer independent. May it be possible to keep that file computer-independent? (So that it can be synchronised across computers)

jethrokuan commented 5 years ago

May it be possible to keep that file computer-independent? (So that it can be synchronised across computers)

No, fish autoexpands ~, so the variables inside will always be absolute paths.

I too use fish across multiple computers, and I don't synchronize the fish_variables file, and I don't think it's meant to be used that way. If you have custom variables you need to set, consider making a custom plugin for them. This could just be set -U directives in a file in the conf.d folder.

lucmos commented 5 years ago

No, fish autoexpands ~, so the variables inside will always be absolute paths.

I was thinking to put those variables somewhere else

I too use fish across multiple computers, and I don't synchronize the fish_variables file, and I don't think it's meant to be used that way. If you have custom variables you need to set, consider making a custom plugin for them. This could just be set -U directives in a file in the conf.d folder.

I opened an issue about it yesterday (https://github.com/fish-shell/fish-shell/issues/5870) (I didn't know that the "problem" were the configuration variables of z in the fish_variables)

They confirmed that moving the entire .config/fish should word, and the fish_variable has been introduced exactly to be computer-independent:

Since 3.0 it's named fish_variables, so it's machine-independent by default.

However I'll ask in a more direct way there

jethrokuan commented 5 years ago
 I was thinking to put those variables somewhere else

this plugin doesn't set that manually. It does however call a set directive, which in turn gets the variable value stored in the fish_variables file. faho is not wrong in that the behaviour in fish is that fish_variables is machine-independent by default there.

What I'm saying is that because fish expands paths automatically, it's impossible as far as I know to set the variables to relative paths in a manner that is guaranteed to work across all machines. For this particular plugin, that's just the compromise we have to put up with.

The alternative to the variable is hard-coding the locations of each of the files of course, but that's not exactly the fix I had in mind.

lucmos commented 5 years ago

Got it. I didn't know how set works.

The only alternative that I can think of is to do another configuration file .config/fish/.z, but I'm not sure if it's the right way to proceed

jethrokuan commented 5 years ago

If you're using fisherman, the way I do it, and many others, is to only sync the fishfile across the computers. Then, running fisher on both machines should pull down the same plugins and result in the exact same setup.

For example, mine looks like this: https://github.com/jethrokuan/dotfiles/tree/master/fish/.config/fish

lucmos commented 5 years ago

Yeah, I'll manage somehow. Probably I'll move the colors definitions into the conf.d as you suggested

jethrokuan commented 5 years ago

Closing for now, feel free to reopen if you have any more suggestions.