Skip to content

tmux with TPM does not apply zsh configuration after startup #295

@okm321

Description

@okm321

Issue

After installing some tmux plugins using TPM (Tmux Plugin Manager), tmux starts with zsh, but the zsh configuration (e.g., .zshrc) does not get applied automatically. I have to manually run $SHELL or exec zsh to apply my zsh settings. This issue only occurs when using TPM; without TPM, zsh works as expected.

Expected Behavior

When I start a new tmux session, it should load my zsh shell with all configurations from .zshrc as expected, even when TPM is used.

Current Behavior

When using TPM, tmux starts with zsh, but the configuration from .zshrc is not applied. This forces me to run $SHELL or exec zsh manually to load my settings. Without TPM, tmux loads zsh with the correct configuration as expected.

Steps to Reproduce

  1. Install tmux and TPM (Tmux Plugin Manager)
  2. Install any plugin using TPM.
  3. Start a new tmux session and observe that zsh starts, but the configuration (e.g., aliases or environment variables) is not applied.
  4. Remove TPM or disable plugins, then start tmux again to see that zsh's configuration is loaded correctly.

System Information

  • OS: macOS v15.0.1
  • Shell: zsh (installed via Homebrew)
  • Tmux Version: 3.5a
  • TPM Version: 3.1.0

CleanShot 2024-10-14 at 15 48 20

tmux.conf

.tmux.conf
TMUX_PLUGIN_MANAGER_PATH="~/.tmux/plugins"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'catppuccin/tmux#latest'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'xamut/tmux-weather'

set -g @catppuccin_flavor 'mocha' # latte,frappe, macchiato or mocha

## catppuccin config
set -g @catppuccin_window_left_separator "█"
set -g @catppuccin_window_middle_separator "█ "
set -g @catppuccin_window_right_separator_inverse "yes"
set -g @catppuccin_window_right_separator "█"
set -g @catppuccin_window_number_position "left"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_window_default_color "#{thm_black4}" # text clor
set -g @catppuccin_window_default_background "#{thm_bg}"
set -g @catppuccin_window_current_color "#{thm_magenta}" # text color
set -g @catppuccin_window_current_background "#{thm_bg}"

set -g @catppuccin_directory_color "yellow"
set -g @catppuccin_status_modules_left "session"
set -g @catppuccin_status_modules_right "directory gitmux application date_time weather battery"
set -g @catppuccin_weather_color "orange"
set -g @catppuccin_battery_color "magenta"
set -g @catppuccin_gitmux_color "blue"
set -g @catppuccin_status_left_separator  "█"
set -g @catppuccin_status_right_separator "█"
set -g @catppuccin_status_right_separator_inverse "yes"
set -g @catppuccin_status_fill "all"
set -g @catppuccin_gitmux_text "#(gitmux -cfg $HOME/.gitmux.conf \"#{pane_current_path}\")"
set -g @catppuccin_status_connect_separator "no"

## pane
set -g @catppuccin_pane_status_enabled "on"
set -g @catppuccin_pane_border_status bottom
set -g @catppuccin_pane_border_style "fg=#{thm_gray}"
set -g @catppuccin_pane_active_border_style "fg=#{thm_magenta}"

set -g @catppuccin_status_background "default"

set -g status-interval 1

# ウィンドウを切り替える
bind -n S-left previous-window
bind -n S-right next-window

# マウス操作を有効にする
set-option -g mouse on

# prefix+r で設定のリロード
bind r source-file ~/.tmux.conf \; display "Reloaded!"

set-window-option -g mode-keys vi

# PaneをVim-likeに移動する
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R

# window、paneの追加時に同一ディレクトリで開くようにする
bind c new-window -c '#{pane_current_path}'
bind '"' split-window -c '#{pane_current_path}'
bind % split-window -h -c '#{pane_current_path}'

# ステータスバーを上部に表示する
set -g status-position top
# checkhealth回避用
set -g escape-time 10
set -g focus-events on

bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"

set -g default-terminal "tmux-256color"
# set -ag terminal-overrides ",alacritty:RGB"

set-environment -g PATH "/opt/homebrew/bin:/usr/local/bin:/bin:usr/bin"
# プラグインマネージャの初期化(とりあえず最下部に記載)
run '~/.tmux/plugins/tpm/tpm'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions