tmuxの$ SHELLは私が始めたシェルの$ SHELLとは異なります。

tmuxの$ SHELLは私が始めたシェルの$ SHELLとは異なります。

私はこの問題に数時間苦労し、それが私を狂わせました。自宅のコンピュータにSSHで接続するときのデフォルトのシェルはzshです。私はこれを確認できecho $SHELLます/usr/bin/zsh

zshでtmuxを呼び出すと、bashシェルがあるtmuxウィンドウに移動します。を実行すると出力されecho $SHELL/bin/bash実行するとchsh -s /usr/bin/zsh <user>$ SHELL変数は実際には更新されずに出力されます\bin\bash

tmux のマニュアルページで、デフォルトのシェルが ~/.tmux.conf ファイルに設定されていることを知って、そうしましたが効果がないようです。ここに関連する設定ファイルを含めます。

私は.tmux.confの他の設定に言及する必要があります。はい動作します。キーバインディングが機能し、色が一致します。それを把握できません。どんな助けでも大変感謝します。

ハードウェアは、最新バージョンのRaspbianを実行するRaspberry Pi 4です。

~/.tmux.conf:

unbind C-b
set-option -g prefix C-q
bind-key C-q send-prefix

bind h split-window 
bind v split-window -h

#set-option -g pane-border-fg colour235 #base02
#set-option -g pane-active-border-fg colour240 #base01

set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000

setw -g mode-keys vi
setw -g monitor-activity on

bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5

bind-key -n M-K resize-pane -U 5
bind-key -n M-J resize-pane -D 5
bind-key -n M-H resize-pane -L 5
bind-key -n M-L resize-pane -R 5

# Shift arrow to switch windows
bind -n M-N  previous-window
bind -n M-M next-window

set -sg escape-time 0

# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h"  "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j"  "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k"  "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l"  "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"

set -g status-bg "black"
set -g status-fg "white"

~/.zshrcは良い尺度です。

# OMZ home directory
export ZSH=/home/joe/.oh-my-zsh

# Set OMZ theme
ZSH_THEME=spaceship
SPACESHIP_CHAR_SUFFIX=' '
SPACESHIP_HOST_SHOW=always
SPACESHIP_USER_SHOW=always
SPACESHIP_PROMPT_ORDER=(
user          # Username section
host          # Hostname section
dir           # Current directory section
git           # Git section (git_branch + git_status)
exec_time     # Execution time
battery       # Battery level and status
vi_mode       # Vi-mode indicator
jobs          # Background jobs indicator
exit_code     # Exit code section
char          # Prompt character
)

# Couple OMZ settings
COMPLETION_WAITING_DOTS="true"
plugins=(git sudo wd tmux)

# Source OMZ file, needs to be *before* other aliases
source $ZSH/oh-my-zsh.sh

# Fixes some undesirable behavior in Termite with OMZ
export LC_CTYPE="en_US.UTF-8"
export ANDROID_HOME="/home/joe/Android/Sdk/"

# User Specified Aliases
alias ekeymap="vim /home/joe/qmk_firmware/keyboards/ergodox_ez/keymaps/josephemorgan91"
alias rename=perl-rename
alias zconfig="vim ~/.zshrc"
alias zsource="source ~/.zshrc"
alias ls="ls --color=auto"
alias la="ls -a --color=auto"
alias ll="ls -la --color=auto"
alias keyswapper="~/Scripts/keyswapper"
alias sheader="~/Scripts/student_header.sh"
alias ctags="ctags -R -f ./.git/tags ."
alias tmux="tmux -u"
alias R="R --quiet"
alias update-grub="sudo zsh ~/Scripts/update-grub"
alias vimconfig="vim ~/.vimrc"
alias emacs="emacs -nw"

# Setup folder for dev
    alias cconfig="cp ~/Scripts/ycm_c_config ./.ycm_extra_config.py"
    alias gitignore="cp ~/.dotfiles/.gitignore ./.gitignore"
    alias readme="cp ~/.dotfiles/.README_TEMPLATE ./README"
    alias gogit="readme & gitignore & git init"

    set_wallpaper() {
        echo "Setting wallpaper: $PWD/$1\n"
        ln -s -f -v $PWD/$1 /home/joe/.wallpaper.jpg
        ln -s -f -v $PWD/$2 /home/joe/.wallpaper-lh.jpg
        feh --bg-scale $PWD/$2 --bg-scale $PWD/$1
    }

# Uses xclip application to pipe output to clipboard.
# Usage - $ cat /path/to/a/file | xclip
# Works on any utility that produces output
alias xclip="xclip -selection c"

export EDITOR='vim'

export term="xterm-256color"

# if command -v tmux>/dev/null; then
#   [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux
# fi

stty -ixon

xset r rate 200 45

ベストアンサー1

解決策は、.tmux.confに次の行を追加することです。

set-option -g default-shell /bin/zsh

愚かなことは、私は確かにこれを知って実際にその行を追加しましたが、ファイルを保存したり、それをした後にサーバーを再起動しなかったようです。翌日接続したとき、すべてがうまく機能し始めました。

おすすめ記事