和这个搏斗了几个小时,我都快疯了。当我在家里进入我的机器时,默认的shell是zsh。我可以用echo $SHELL
确认这一点,后者输出/usr/bin/zsh
当我从zsh调用tmux时,它会将我带入带有bash的tmux窗格中。如果我运行echo $SHELL
,它会输出/bin/bash
。如果然后运行chsh -s /usr/bin/zsh
,$SHELL变量实际上不会得到更新并仍然输出\bin\bash
。
我从tmux手册中了解到,默认的shell是在~/.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)?*# 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"
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"
*
A7
发布于 2020-01-27 22:40:31
解决方案是在.tmux.conf中实际添加以下一行
set-option -g default-shell /bin/zsh
最愚蠢的是,我确实知道这一点,并且确实添加了行,但是我似乎要么没有保存文件,要么没有在这样做之后重新启动服务器。第二天我接通电话时一切都很顺利。
https://unix.stackexchange.com/questions/563553
复制相似问题