Skip to content

Instantly share code, notes, and snippets.

@yacut
Last active February 27, 2018 10:32
Show Gist options
  • Save yacut/17b7d2b7116e7456d493e63311067052 to your computer and use it in GitHub Desktop.
Save yacut/17b7d2b7116e7456d493e63311067052 to your computer and use it in GitHub Desktop.
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# 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'
set -g @continuum-restore 'on'
set -g @plugin 'tmux-plugins/tmux-yank'
# Make the current window the first window
bind T swap-window -t 1
set-window-option -g aggressive-resize
setw -g aggressive-resize on
set-window-option -g window-status-current-format '#[fg=white,bold]** #{window_index} #[fg=red]#{pane_current_command} #[fg=blue]#(echo "#{pane_current_path}" | rev | cut -d'/' -f-3 | rev) #[fg=white]|'
set-window-option -g window-status-format '#[fg=white,bold]#{window_index} #[fg=red]#{pane_current_command} #[fg=blue]#(echo "#{pane_current_path}" | rev | cut -d'/' -f-3 | rev) #[fg=white]|'
bind-key -r w choose-window -F '#{window_index} | #{pane_current_command} | #{host} | #{pane_current_path}'
# update internal
set-option -g status-interval 1
# source .tmux.conf file
bind r source-file ~/.tmux.conf \; display "Configuration Reloaded!"
# vertical split
bind | split-window -h -c "#{pane_current_path}"
# horizontal split
bind - split-window -v -c "#{pane_current_path}"
# new window
bind c new-window -c "#{pane_current_path}"
# pane movement similar to vim
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# to cycle through windows
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
bind b previous-window
# easier and faster switching between next/prev window
bind C-p previous-window
bind C-n next-window
# enable mouse
setw -g mode-mouse on
# allow mouse to select windows and panes
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
# for vim-tmux-clipboard
set -g focus-events on
# remap copy paste keys
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
# switch between sessions
bind -r ( switch-client -p
bind -r ) switch-client -n
# set zsh as default shell
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
export TERM=screen-256color
export ZSH_TMUX_AUTOSTART=true
export ZSH_TMUX_AUTOSTART_ONCE=true
export ZSH_TMUX_AUTOCONNECT=true
export ZSH_TMUX_AUTOQUIT=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment