Last active
June 20, 2020 10:52
-
-
Save bloatfan/68180c4f47f85bdb36993680e8a0ca4b to your computer and use it in GitHub Desktop.
.tmux.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 支持鼠标模式 | |
set -g mouse off | |
set-option -g history-limit 30000 | |
# PREFIX-Q 显示编号的驻留时长,单位 ms | |
set -g display-panes-time 10000 | |
# 关掉某个窗口后,编号重排 | |
set -g renumber-windows on | |
# 进入复制模式的时候使用 vi 键位(默认是 EMACS) | |
setw -g mode-keys vi | |
# ----------------------------------------------------------------------------- | |
# 使用插件 - via tpm | |
# 1. 执行 git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
# ----------------------------------------------------------------------------- | |
# 推荐的插件(请去每个插件的仓库下读一读使用教程) | |
set -g @plugin 'seebi/tmux-colors-solarized' | |
set -g @plugin 'tmux-plugins/tmux-pain-control' | |
set -g @plugin 'tmux-plugins/tmux-prefix-highlight' | |
set -g @plugin 'tmux-plugins/tpm' | |
# 移动 pane 以及修改大小插件 | |
# https://github.com/christoomey/vim-tmux-navigator#custom-key-bindings | |
set -g @plugin 'christoomey/vim-tmux-navigator' | |
# seebi/tmux-colors-solarized | |
set -g @colors-solarized 'dark' | |
# tmux-prefix-highlight | |
set -g status-right '#{prefix_highlight} #H | %a %Y-%m-%d %H:%M' | |
set -g @prefix_highlight_show_copy_mode 'on' | |
set -g @prefix_highlight_copy_mode_attr 'fg=white,bg=blue' | |
# https://github.com/roxma/vim-tmux-clipboard | |
# set -g focus-events on | |
# 初始化 TPM 插件管理器 (放在配置文件的最后) | |
run -b '~/.tmux/plugins/tpm/tpm' | |
################## BINDINGS ################## | |
# 在 copy-mode-vi 模式下,使用 v 开始选择 | |
bind-key -T copy-mode-vi v send-keys -X begin-selection | |
# bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel | |
bind-key -T copy-mode-vi y send-keys -X copy-selection | |
# 在 normal 模式下鼠标滑轮进入 copy-mode, 左键释放后,即复制,我不喜欢这样的行为 | |
# https://stackoverrun.com/cn/q/10149784 | |
unbind -T copy-mode MouseDragEnd1Pane | |
unbind -T copy-mode-vi MouseDragEnd1Pane | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# 如果 download=1 则表示需要下载 tmux | |
download=0 | |
tmux=`which tmux` | |
if [[ "$?" != "0" ]]; then | |
download=1 | |
fi | |
version=`$tmux -V | awk ' { print $2 } '` | |
if [[ "$version" < "2.1" ]]; then | |
download=1 | |
fi | |
if [[ "$download" == "1" ]]; then | |
wget "https://github.com/lslz627/software/raw/master/tmux/bin/tmux" -O /usr/local/bin/tmux | |
chmod u+x /usr/local/bin/tmux | |
tmux="/usr/local/bin/tmux" | |
fi | |
[[ -d "${HOME}/.tmux/plugins" ]] || mkdir -p "${HOME}/.tmux/plugins" | |
[[ -d "${HOME}/.tmux/plugins/tpm" ]] || git clone https://github.com/tmux-plugins/tpm ${HOME}/.tmux/plugins/tpm | |
wget https://gist.githubusercontent.com/lslz627/68180c4f47f85bdb36993680e8a0ca4b/raw/.tmux.conf -O ~/.tmux.conf | |
$tmux new -s tmux_init -d | |
$tmux send -t "tmux_init:0" "$tmux run-shell $HOME/.tmux/plugins/tpm/bindings/install_plugins" Enter | |
# tmux run-shell $HOME/.tmux/plugins/tpm/bindings/install_plugins | |
$tmux send -t "tmux_init:0" "exit" Enter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment