Skip to content

Instantly share code, notes, and snippets.

@pdobrowolski
Created June 10, 2015 16:19
Show Gist options
  • Save pdobrowolski/834db2decda4befb97ca to your computer and use it in GitHub Desktop.
Save pdobrowolski/834db2decda4befb97ca to your computer and use it in GitHub Desktop.
Very unfinished version of tmux.config
set -g utf8
set-window-option -g utf8 on
set -g status-utf8 on
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm:colors=256'
#Set prefix to C-Space
unbind C-b
set -g prefix C-Space
bind Space send-prefix
bind Space copy-mode
bind C-Space copy-mode
# Closing window/pane without confirmation
bind-key x kill-pane
bind-key & kill-window
# Clear panel
bind-key r send-keys "clear && tmux clear-history" \; send-keys "Enter"
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
#Mouse works as expected
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
setw -g monitor-activity on
set -g visual-activity on
set -g mode-keys vi
set -g history-limit 10000
# y and p as in vim
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
bind -t vi-copy 'Space' halfpage-down
bind -t vi-copy 'Bspace' halfpage-up
bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard'
# extra commands for interacting with the ICCCM clipboard
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# easy-to-remember split pane commands
bind \ split-window -h
bind - split-window -v
unbind '"'
unbind %
# moving between windows with vim movement keys
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes with vim movement keys
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
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Source tmuxline snapshot
source-file .tmux/tmuxline_snapshot
# List of plugins
# Supports `github_username/repo` or full git repo URLs
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-yank \
tmux-plugins/tmux-resurrect \
'
# Other examples:
# github_username/plugin_name \
# git@github.com/user/plugin \
# git@bitbucket.com/user/plugin \
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run-shell '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment