Skip to content

Instantly share code, notes, and snippets.

@LplusKira
Last active October 27, 2020 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LplusKira/e6c44f54b79b04b5dba9198fec5a9acd to your computer and use it in GitHub Desktop.
Save LplusKira/e6c44f54b79b04b5dba9198fec5a9acd to your computer and use it in GitHub Desktop.
For ubuntu 16.04
###
# Tmux config for 3.0a
###
# set the prefix of tmux from ctl-b to ctl-a
set-option -g prefix C-a
# use bash as tmux' default shell
set-option -g default-shell "/bin/bash" #"/bin/zsh" #
# vvv enable copying from vim in tmux panes
# Use vim keybindings in copy mode
setw -g mode-keys vi
bind p paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
# ^^^ 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@'
# List of 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 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/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
# (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
# Plugin Management:
# (w\ prefix)
# I --> fetch plugin
# U --> fetch plugin
# alt + u --> uninstall commented plugins
# ref: https://jdhao.github.io/2019/01/17/tmux_plugin_management/
# features tmux provides to me
# * processes r alive after logout (no need to use 'nohup + &')
# * collaboration (go attach sb else's session!)
# * utilize every single space of ur monitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment