Đổi key Ctrl-B thành Ctrl-Z (cop vào ~/.tmux.conf
):
unbind C-b
set -g prefix C-z
bind C-z send-prefix
Copy bằng chuột, tô để copy (cop vào ~/.tmux.conf
):
Phải cài xclip (sudo apt install xclip
nếu chưa cài).
# https://unix.stackexchange.com/questions/318281/how-to-copy-and-paste-with-a-mouse-with-tmux
set -g mouse on
setw -g mode-keys vi
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
Sử dụng xsel thay vì xclip: https://unix.stackexchange.com/questions/77355/tmux-xclip-copy-no-longer-working
Tự động start tmux (cop vào ~/.bashrc
hoặc ~/.zshrc
):
if command -v tmux >/dev/null 2>&1; then
# if not inside a tmux session, and if no session is started, start a new session
[ -z "${TMUX}" ] && (tmux attach || tmux) >/dev/null 2>&1
fi