My .bash_aliases
(loaded from .bashrc
) defines an alias for tmux like this:
alias tmux='tmux -f /home/myuser/.config/tmux/tmux.conf -L mysocket'
Now I have a script tmux-sessionizer.sh that I execute (not source) as part of a keymap in nvim. The script invokes tmux:
...
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c $selected
exit 0
fi
...
However the problem is that this tmux invocation will not use my alias, since aliases are not loaded when a bash script is executed (this is known). This means that the sessionizer script wont use my socket that I always provide with the -L flag in the alias. But if it doesn’t use this socket then it won’t find the session. The question is how do I work around this?