Last active
September 14, 2020 04:38
-
-
Save LplusKira/9667d9e70a518fc945be51d488c36167 to your computer and use it in GitHub Desktop.
For MBP
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
### | |
# Tmux config for 3.0a | |
### | |
# set the prefix of tmux from ctl-a to ctl-b | |
set-option -g prefix C-a | |
# use zsh as tmux' default shell | |
set-option -g default-shell "/bin/zsh" | |
## vvv enable copying from vim in tmux panes | |
## ref: https://evertpot.com/osx-tmux-vim-copy-paste-clipboard/ | |
## Copy-paste integration (First of all, be sure to disable what's mentioned in iterm2) | |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
# Setup 'v' to begin selection as in Vim | |
bind-key -T copy-mode-vi v send-keys -X begin-selection | |
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" | |
# Update default binding of `Enter` to also use copy-pipe | |
unbind -T copy-mode-vi Enter | |
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" | |
# Bind ']' to use pbpaste | |
bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer" | |
# ^^^ enable copying from vim in tmux panes | |
# enable mouse draging in sessions | |
set -g mouse on | |
# keep history | |
# also note the settings in iterm2, ref: http://dan.carley.co/blog/2013/01/11/tmux-scrollback-with-iterm2/ | |
set -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
# Tmux plugin manager | |
# - Install Plugins: https://github.com/tmux-plugins/tpm#installing-plugins | |
# - Put this at the bottom of ~/.tmux.conf ($XDG_CONFIG_HOME/tmux/tmux.conf works too): | |
# - List of plugins, plugin path: ~/.tmux/plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'tmux-plugins/tmux-resurrect' | |
set -g @plugin 'tmux-plugins/tmux-continuum' | |
# Other examples: | |
# set -g @plugin 'github_username/plugin_name' | |
# set -g @plugin '[email protected]/user/plugin' | |
# set -g @plugin '[email protected]/user/plugin' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run -b '~/.tmux/plugins/tpm/tpm' | |
# some useful guides: | |
# session: | |
# (w\ prefix) | |
# d --> detach from the current session | |
# $ --> rename the current session to, say qqr | |
# (w\o prefix) | |
# tmux attach -t yourAwesomSessionName --> attach to yourAwesomSessionName tmux session | |
# tmux new -s yourAwesomSessionName --> create yourAwesomSessionName tmux session | |
# window: | |
# (w\ prefix) | |
# c --> create a window | |
# p --> ping to previous window | |
# n --> ping to next window | |
# w --> list windows | |
# , --> rename the current window to, say qqr | |
# & --> kill a window (especially useful when the remote connection is closed and the window is not responding) | |
# | |
# pane: | |
# (w\ prefix): | |
# % --> split the current window vertically | |
# shift-" --> split the current window vertically | |
# o --> next pane | |
# ; --> previously used pane | |
# | |
# mgt: | |
# (w\ prefix, using tpm): | |
# I --> install plugin | |
# U --> update plugin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment