Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BREAKING: Change default behavior of this plugin #12

Closed
budimanjojo opened this issue Oct 6, 2024 · 2 comments · Fixed by #13
Closed

BREAKING: Change default behavior of this plugin #12

budimanjojo opened this issue Oct 6, 2024 · 2 comments · Fixed by #13

Comments

@budimanjojo
Copy link
Owner

I was using zellij instead of tmux for some time now and now I want to switch back to tmux so naturally I need this plugin again.
And I found some problem with this plugin (it was a long time ago and maybe my knowledge has improved now I hope):

  1. It's a bad de# fish to get the behavior or $fish_tmux_autostart set to true. Because fish will always load everything inside $__fish_config_dir/conf.d directory before loading config.fish. This means this plugin will run before fish evaluate the user config file. So to change the default behavior of this plugin you'll need to set universal variable, then restart the plugin for it to take effect. This is also why problem such as Tmux not found on startup #4 happened. User should be able to control when to start tmux in their config.fish. I'm thinking about removing $fish_tmux_autostart and let user control it instead just like how zellij does. This is a breaking change.
  2. There are some new features in the upstream that I haven't include here, one of them is having $fish_tmux_config should defaults to $HOME/.tmux.conf and $XDG_CONFIG_HOME/tmux/tmux.conf if not set instead of just default to $HOME/.tmux.conf. This minimizes the need to set the variable.
  3. Another new feature from upstream is automatically set $TERM variable to tmux or tmux-256color too instead of just screen and screen-256color.
@budimanjojo
Copy link
Owner Author

I will release the current state as v1 and v2 for this breaking change. So you can pin to v1 you prefer the old behavior.

@budimanjojo
Copy link
Owner Author

If you're updating, here are what you need to do to make it work just like the current default:

  • In your config.fish, add set fish_tmux_autostart true anywhere you want as long as tmux command is available in $PATH.
  • You might want to remove the variables you have set in $__fish_config_dir/fish_variables using set -Ux fish_tmux_xxx before.

Here are the overview of the changes for v2:

  • use alias instead of abbr to match upstream
  • added features which were added in upstream
  • $fish_tmux_autostart is now false by default to match upstream
  • most variables are now local to function when called instead of being globally set
  • autostart feature is now a function that gets called automatically when $fish_tmux_autostart is changed
  • plugin can now run as root just like upstream, you can change this behavior manually in your config.fish file
  • removed fish_tmux_alter_path hack as you can now control when to run this plugin

Basically, v2 works exactly like the zsh plugin except for the different variable names ($ZSH_TMUX_XXX become $fish_tmux_xxx).

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

Successfully merging a pull request may close this issue.

1 participant