Skip to content

Commit

Permalink
update tmux conf
Browse files Browse the repository at this point in the history
  • Loading branch information
xingchensong committed Dec 3, 2021
1 parent f86017f commit 37eb905
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 7 deletions.
8 changes: 4 additions & 4 deletions scripts/install_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

# install miniconda3-py3.8
wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64.sh
# update vim (>= 8.2)
# update vim (>= 8.2) tmux (>= 2.5)
conda update -n base conda -y && conda install -y pip
conda install -c conda-forge vim zsh shellcheck -y
conda install -c conda-forge vim zsh shellcheck tmux cmake ruby gawk -y
pip3 install --user pynvim neovim jedi autopep8 cpplint pylint isort cmakelint cmake-format flake8==3.8.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
# autojump
git clone git://github.com/wting/autojump.git
cd autojump && ./install.py
# tmux 2.6
conda install -c riipl-org tmux
# # tmux 2.6
# conda install -c riipl-org tmux
5 changes: 4 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
cp -R zsh/zsh-autosuggestions $HOME/.oh-my-zsh/custom/plugins/
cp -R zsh/zsh-syntax-highlighting $HOME/.oh-my-zsh/custom/plugins/

# 2. vim && vim-plug
# 2. vim && vim-plug, tmux && tmux-plug
mkdir -p $HOME/.vim/colors
mkdir -p $HOME/.vim/backup
cp vim/color/*.vim $HOME/.vim/colors/
Expand All @@ -60,6 +60,9 @@ if [ ! -f "$HOME/.viminfo" ]; then
fi
mkdir -p $HOME/.vim/autoload
cp $CURRENT_DIR/vim/vim-plug/plug.vim $HOME/.vim/autoload
mkdir -p $HOME/.tmux
mkdir -p $HOME/.tmux/plugins
cp -R $CURRENT_DIR/tmux/tpm $HOME/.tmux/plugins

# 3. python3-pip clang ctags
# see scripts/install_pkg.sh
Expand Down
114 changes: 113 additions & 1 deletion tmux/tmux.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,114 @@
set -g default-terminal screen-256color
# -------------------------------------------------------------------------------
# tmux-plug
# -------------------------------------------------------------------------------
set -g @plugin 'https://github.com.cnpmjs.org/tmux-plugins/tpm'
set -g @plugin 'https://github.com.cnpmjs.org/tmux-plugins/tmux-sensible'
set -g @plugin 'https://github.com.cnpmjs.org/thewtex/tmux-mem-cpu-load'
set -g @plugin 'https://github.com.cnpmjs.org/tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'https://github.com.cnpmjs.org/tmux-plugins/tmux-resurrect'
set -g @plugin 'https://github.com.cnpmjs.org/tmux-plugins/tmux-continuum'
set -g @plugin 'https://github.com.cnpmjs.org/schasse/tmux-jump'
set -g @plugin 'https://github.com.cnpmjs.org/tmux-plugins/tmux-copycat'
set -g @plugin 'https://github.com.cnpmjs.org/tmux-plugins/tmux-pain-control'
set -g @plugin 'https://github.com.cnpmjs.org/tmux-plugins/tmux-net-speed'

# tmux-prefix-highlight
set -g @prefix_highlight_fg 'white' # default is 'colour231'
set -g @prefix_highlight_bg 'blue' # default is 'colour04'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_mode_attr 'fg=black,bg=green' # default is 'fg=default,bg=yellow'
set -g @prefix_highlight_prefix_prompt 'Wait'
set -g @prefix_highlight_copy_prompt 'Copy'
set -g @prefix_highlight_sync_prompt 'Sync'
set -g @prefix_highlight_empty_prompt ' ' # default is '' (empty char)
set -g @prefix_highlight_empty_attr 'fg=default,bg=default' # default is 'fg=default,bg=default'
set -g @prefix_highlight_empty_has_affixes 'on' # default is 'off'
set -g @prefix_highlight_empty_prompt '@SXC'
set -g @prefix_highlight_output_prefix '< '
set -g @prefix_highlight_output_suffix ' >'
# tmux-resurrect
# 修改会话数据的保持路径,此处不能使用除了$HOME, $HOSTNAME, ~之外的环境变量
set -g @resurrect-dir '$HOME/.tmux/resurrect'
set -g @resurrect-capture-pane-contents 'on'
# tmux-continuum
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-save-interval '0'
# tmux-jump
set -g @jump-bg-color '\e[0m\e[90m'
set -g @jump-fg-color '\e[1m\e[31m'
# tmux-net-speed
set -g @net_speed_format "D:%8s U:%8s"

# -------------------------------------------------------------------------------
# Common
# -------------------------------------------------------------------------------
# terminal color
set -g default-terminal xterm-256color
set-option -ga terminal-overrides ",*256col*:Tc"
# keys
setw -g xterm-keys on
setw -g mode-keys vi
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# increase scrollback buffer size
set -g history-limit 50000
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# refresh 'status-left' and 'status-right' more often
set -g status-interval 5
# focus events enabled for terminals that support them
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# Status bar
set -g status on
set -g status-left-length 120
set -g status-right-length 120
set -g set-titles on
set -g set-titles-string "[#S] #I:#W"
set -g status-bg "#657b83"
set -g status-fg white
set-option -g status-justify centre
set -g status-right " | #{net_speed} | #($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --interval 2 --cpu-mode 1)"
set -g status-left '#[fg=cyan][#{session_name}] #{prefix_highlight} | #[fg=cyan,bg=default,nobright]%a-%Y-%m-%d-%H:%M:%S #[fg=default,noblink]| Continuum status: #{continuum_status} | '
# window
setw -g automatic-rename off
set-option -g allow-rename off
set-window-option -g window-style default
set-window-option -g clock-mode-colour black
set-window-option -g clock-mode-style 24
set-window-option -g monitor-activity on
set-window-option -g visual-bell off
# pane
set-option -g display-panes-active-colour blue
set-option -g display-panes-colour brightred
# message style
set-option -g message-style bg=black,fg=default,noreverse
# bell
set -g bell-action none
set-window-option -g bell-action none

# -------------------------------------------------------------------------------
# Bind Keys
# -------------------------------------------------------------------------------
# easier and faster switching between next/prev window
bind C-m previous-window
bind C-n next-window
# source .tmux.conf as suggested in `man tmux`
bind r source-file ~/.tmux.conf \; display-message "Config reloaded.."
# vim-mode copy and paste
bind Escape copy-mode # 绑定esc键为进入复制模式
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind p pasteb # 绑定p键为粘贴文本
# Killer
bind x kill-pane
bind X kill-window
# open a new window in the current directory
bind C new-window -c "#{pane_current_path}" -n "shell"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
2 changes: 2 additions & 0 deletions vim/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ if has("termguicolors")
set t_Co=256
" enable true color
set termguicolors
" https://superuser.com/questions/401926/how-to-get-shiftarrows-and-ctrlarrows-working-in-vim-in-tmux
set t_ut=
endif
set background=dark
if v:version < 801
Expand Down
2 changes: 1 addition & 1 deletion zsh/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ if [[ $(hostname -f) == LAPTOP-* ]]; then
# <<< conda initialize <<<
fi

if [[ $(hostname -f) == SongXingchen-PC* || $(hostname -f) == songxingchen.hobot.cc ]]; then
if [[ $(hostname -f) == SongXingchen-PC* || $(hostname -f) == songxingchen*.hobot.cc ]]; then
export PATH=$PATH:$HOME/tools/go/bin
source ~/proxy.sh
# >>> conda initialize >>>
Expand Down

0 comments on commit 37eb905

Please sign in to comment.