Skip to content

Instantly share code, notes, and snippets.

@fishman
Created December 21, 2014 18:07
Show Gist options
  • Save fishman/cab71165ba4689167e5f to your computer and use it in GitHub Desktop.
Save fishman/cab71165ba4689167e5f to your computer and use it in GitHub Desktop.
# ~/.tmux.conf
# Informations {{{
# File : ~/.tmux.conf
# Purpose: Setup file for the terminal multiplexer called "tmux"
# Author : Reza Jelveh
# Set the command for new windows to "zsh"
set -g default-command zsh
# control cmus <http://cmus.sourceforge.net/>
# bind -n F7 run-shell 'cmus-remote --pause >/dev/null 2>&1'
# bind -n C-F10 run-shell 'cmus-remote -u >/dev/null 2>&1'
# bind -n C-F11 run-shell 'cmus-remote --prev >/dev/null 2>&1'
# bind -n C-F12 run-shell 'cmus-remote --next >/dev/null 2>&1'
bind -n C-F10 run-shell 'mpc toggle >/dev/null 2>&1'
bind -n C-F11 run-shell 'mpc prev >/dev/null 2>&1'
bind -n C-F12 run-shell 'mpc next >/dev/null 2>&1'
# vi mode
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# "I' == current window index
# 'H' == Hostname
# 'F' == current window flag
# 'P' == current pane index
# 'S' == Session name
# 'T' == current window title
# 'W' == current window name
# '#' == a literal "#"
# Where appropriate, special character sequences may be prefixed with a
# number to specify the maximum length, in this line "#10W'.
set-window-option -g window-status-format '#I#F #10W '
setw -g window-status-current-format '#I#F #10W'
# toggle last window like screen
bind-key C-a last-window
# confirm before killing a window or the server
bind-key k confirm kill-window
bind-key K confirm kill-server
# ctrl+left/right cycles thru windows
# I rarely use this, and when I do it's by mistake
# bind -n C-left swap-window -t -1
# bind -n C-right swap-window -t +1
bind-key -n C-up next
bind-key -n C-down prev
bind-key r source-file ~/.tmux.conf
bind-key S command-prompt -p ssh: "new-window -n %1 'ssh %1'"
# sometimes needed.. maybe..
setw -g xterm-keys on
# scrollback buffer n lines
set -g history-limit 10000
# listen for activity on all windows
set -g bell-action any
# enable wm window titles
set -g set-titles on
# wm window title string (uses statusbar variables)
set -g set-titles-string '#H: #W'
# default statusbar colors
set -g status-fg cyan
set -g status-bg default
set -g status-attr default
set -g status on
set -g status-interval 2
set -g status-utf8 on
set -g status-left-length 60
set -g status-right-length 90
set -g status-fg colour231
set -g status-bg colour234
set -g status-left-length 20
# set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]⮀'
set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]'
set -g status-right '#(powerline tmux right)'
set -g status-right-length 150
set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour244] #[fg=colour249]#W"
# set -g window-status-current-format "#[fg=colour234,bg=colour31]⮀ #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]⮀"
set -g window-status-current-format "#[fg=colour234,bg=colour31] #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
set-option -g status-right "#(~/.dotfiles/tmux-powerline/powerline.sh right)"
# set-option -g visual-activity on
# set-window-option -g monitor-activity on
set -g bell-action any
# active window title colors
set-window-option -g window-status-current-fg yellow
set-window-option -g window-status-current-bg default
# enable 256 color
set -g default-terminal "screen-256color"
set -g terminal-overrides "xterm*:smcup@:rmcup@:*88col*:colors=88,*256col*:colors=256,xterm*:XT"
# New session called ``Worksation''
new -s Workstation -nCmus cmus
neww -t 1 -nMutt mutt
neww -t 2 -nNews 'newsbeuter -o'
neww -t 3 -nIRC weechat
# run-shell 'tmuxifier load-window gsoc'
# Turn monior-activity for cmus *off*
set-window-option -t:0 monitor-activity off
# Set a space-separated string containing a list of envi‐ ronment
# variables to be copied into the session environ‐ ment when a new
# session is created or an existing session is attached
set -g update-environment "DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION GNOME_KEYRING_PID GNOME_KEYRING_SOCKET DBUS_SESSION_BUS_ADDRESS GPG_AGENT_INFO"
set -g mouse-resize-pane on
set -g mouse-select-pane on
set-window-option -g mode-mouse on
# vim fixes
setw -g xterm-keys on
set -sg escape-time 0
set-option -g pane-active-border-fg black
set-option -g pane-border-fg black
##CLIPBOARD selection integration
##Requires prefix key before the command key
#Copy tmux paste buffer to CLIPBOARD
bind C-c run "tmux save-buffer - | xclip -i -selection clipboard"
#Copy CLIPBOARD to tmux paste buffer and paste tmux paste buffer
bind C-v run "tmux set-buffer -- \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
# TODO: support xquartz
# if-shell 'uname | grep -q Darwin' 'set-option -g default-command "reattach-to-user-namespace -l zsh"'
# if-shell 'uname | grep -q Darwin' 'bind C-v run-shell "reattach-to-user-namespace -l zsh -c \"tmux set-buffer -- \'$(pbpaste)\'; tmux paste-buffer\""'
# if-shell 'uname | grep -q Darwin' "bind C-c run-shell \"reattach-to-user-namespace -l zsh -c 'tmux show-buffer | pbcopy'\""
bind C-h select-pane -L
bind C-j select-pane -D
bind C-k select-pane -U
bind C-l select-pane -R
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | egrep -iq '(vim|mc)' && tmux send-keys 'C-\\') || tmux select-pane -l"
# Sometimes we want screen keys
# unbind C-b
# set -g prefix ^A
# bind a send-prefix
# Optional status
# set -g status-left "#[fg=green]host: (#[default]#[fg=yellow]#H#[default]#[fg=green]) | "
# set -g status-left-length 40
# set -g status-right-length 50
# set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]#(powerline tmux left)'
# set -g status-right "#(~/bin/battery Discharging; ~/bin/battery Charging) | %e %B %R | #[fg=red]#(if [[ -a /dev/shm/username/cmus-status ]]; then cat /dev/shm/username/cmus-status | cut -c-70; else echo 'cmus: - stopped -'; fi)"
# set -g status-right "#(~/bin/battery Discharging; ~/bin/battery Charging) | %e %B %R | #[fg=red]#(mpc current | cut -c-70)"
# set-option -g status-left "#(~/.dotfiles/powerline/scripts/powerline tmux left)"
# set-window-option -g window-status-current-format "#[fg=colour234, bg=colour27]#[fg=colour240, bg=colour18] #I #W #[fg=colour27, bg=colour235]"
# set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour240] #[fg=colour249]#W "
# set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I  #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment