-
Notifications
You must be signed in to change notification settings - Fork 265
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
Fisher should stop using universal variables for plugin state #611
Comments
No, it will not, unless you modify Fisher's state in
As long as you don't modify Fisher's state as described above, Fisher won't orphan files. The only caveat I can think of is if you were syncing UVARS. But if you omit string match --entire --all --invert --regex _fisher_
|
Should one even attempt to sync universal variables? 🤔
We could interpret that as "don't sync uvars", as it would require replacing |
I also now noticed that fisher 4.1 sets universal variables such as This suddenly broke my machine syncs, and most likely many others. Notice how it contains the full path to my home directory which varies through machines. Anyone using dotfiles and syncs the fish config ought to have this problem now. Syncing universial variables is not uncommon since a lot of config in there is for various, installed fisher plugins. Examples: SETUVAR FZF_CD_COMMAND:fd\x20\x2d\x2dtype\x20d\x20\x2d\x2dno\x2dignore\x2dvcs\x20\x2d\x2dexclude\x20\x2egit
SETUVAR FZF_CD_WITH_HIDDEN_COMMAND:fd\x20\x2d\x2dtype\x20d\x20\x2d\x2dno\x2dignore\x2dvcs\x20\x2d\x2dexclude\x20\x2egit\x20\x2d\x2dhidden
SETUVAR --export FZF_DEFAULT_COMMAND:fd\x20\x2d\x2dtype\x20f\x20\x2d\x2dhidden\x20\x2d\x2dno\x2dignore\x2dvcs\x20\x2d\x2dexclude\x20\x2egit
SETUVAR --export FZF_DEFAULT_OPTS:\x2d\x2dreverse\x20\x2d\x2dheight\x2020\x25\x20\x2d\x2dinline\x2dinfo
...
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen All these are things I do not wish to setup on every machine, that is the reason why many use dotfiles to sync. |
@thernstig Well spotted! We need to store each file's relative path without the prefix and append |
@jorgebucaran I should be the good citizen and do this, but I have no time currently, as I have too many other obligations. I apologize for this beforehand as I feel I should help out since I am using your great tools. |
I'm finally free to work on this. ✊ The plan is to:
Looks easy to do, but the implementation needs to take care of the migration smoothly for users, which could be tricky. Fisher state example:
|
@thernstig Do you happen to be using a custom |
No, no custom |
Store relative pathThere's an annoying issue where changing If you decide to change your $ fisher list >plugins
$ fisher remove <plugins
$ set --universal fisher_path /path/to/location
$ curl -L git.io/fisher | source && fisher install<plugins && rm plugins Store full path, don't expand
|
I would suggest the former option, as syncing dotfiles through machines which may have different home location is more common than changing P. S. Not related to this issue though, I think storing the full path of local plugins also causes inconvenience for syncing dotfiles. I prefer previous Fisher versions where ~ doesn't get expanded. |
@jorgebucaran Sorry I didn't make myself clear, I mean I better open a new issue about this... |
Just realized I haven't answered this. Both options cover my concern (use relative path for home), so I don't have strong opinions about either. |
@jorgebucaran If "store the entire path, don't expand ~" solves the case where users changes |
@jorgebucaran Did you get the stamina to continue on this? |
Hey! Good question! :) I'm just a bit worried about adding more debt, but I'm not against adding this feature either. How many people (do you think) want or need this divided by other Fisher users? |
@jorgebucaran that is a very good question. I cannot say. Anything would be anecdotal. I do think using dotfiles is becoming more common, so in that sense the number of users that would want this will probably increase as time goes. But that is still a guess. |
@jorgebucaran I have a minor request. I manage my fish config across different machines by modifying the universal variables. I do not sync the #!/usr/bin/env fish
if test -e "$HOME/.config/fish/fish_variables"
rm "$HOME/.config/fish/fish_variables"
fish -c echo "" # This will autogenerate the default fish_variables file.
end
set_universal_settings # this is a function that holds my universal settings This works quite nicely, since I don't change things often. The problem is that when I run this, it deletes and recreates the This could be resolved by having a force/overwrite flag ( I know that you don't want to add more debt but does this sound like a reasonable feature to you? |
I made this comment on a PR somewhere else, but can't find it now. 😅 Basically, I'd prefer to prevent you from getting into this situation instead. If that's really not possible, then we could look into adding a |
@jorgebucaran do you have something in mind that would help me to prevent this situation? |
Actually, implementing this issue (#611) would prevent you from getting into the wanting a way to force install situation, no? |
Yeah 🙂 |
I've been committing my fish_variables into my dotfiles but am trying to move away from that. Paths are different across my machines and it causes too much churn in my dotfiles. That brought me here because I'm experiencing the same issue as the others. Either a force flag, or better logic that will re-bootstrap plugins would be helpful for me. I'd be happy to help test any changes if needed. |
fish documentation encourages users to use universal variables for the configuration and the easiest way to transfer those across machines is to commit Now, all this should be addressed on the fish shell level (they're planning to remove universal variables altogether fish-shell/fish-shell#7317 (comment) actually), but keeping in mind that more and more work is being done in virtual environments like Codespaces recently, I think this issues definitely has its merits, especially after VS Code added dotfiles sync support right into the editor. |
4.4.0 is out and this is in. Now it should be easier to sync dotfiles across machines that have different $HOME locations. A script runs once after updating Fisher that migrates your existing variables to the new architecture. Lines 234 to 237 in 357d682
Please do let me know if you find any bugs or have suggestions. 🙏 |
Great news @jorgebucaran! Now if only fish nvm and the universal variable |
That's a discussion for nvm.fish. 😁 |
Fisher 4.1.0 uses universal variables to maintain both the list of what plugins are installed, and what paths are installed for each plugin. This is potentially problematic in the scenario where I'm syncing my fish config between two machines, as having the universal variables get out of date may cause fisher to orphan installed files. There are two main scenarios here:
If I sync my fish config including
fish_variables
file. The fish documentation says not to modify thefish_variables
file externally but to always use fish commands to do so. Experimentally, if I modify myfish_variables
and then query variables from another pre-existing shell, the shell won't pick up on the variables until I've shown a new prompt first. This means if I sync my config and then immediately runfisher update
, it will be using the old values of the universal variables, meaning if the list of files installed by plugins changed as part of the sync, fisher will then potentially orphan files.If I sync my fish config but omit the
fish_variables
file (which represents what I actually do on my own machines), syncing changes to the list of installed plugin files will allow fisher to orphan files. Basically the same scenario as the first one except I don't have to runfisher update
as the very first action after the sync, I can run it arbitrarily later instead.Instead of using universal variables, fisher should put a file on disk in
$fisher_path
that describes what's currently installed. It's still possible for me to sync ignoring that file, but that's really my fault. Or it could even be clever and make the file something likeconf.d/_fisher_state.fish
which would set global variables, and fisher could re-source that file upon invocation (to ensure it picks up on any synced changes). Since any syncing I'm doing is presumably syncing that dir, this would ensure I don't skip the file by virtue of not allowlisting its path (which is to say, my original sync setup actually explicitly listed which paths inside~/.config/fish
to sync instead of listing which files to ignore).The text was updated successfully, but these errors were encountered: