Skip to content

Instantly share code, notes, and snippets.

@facundovictor
Forked from ivanalejandro0/.tmux.conf
Last active April 7, 2016 17:06
Show Gist options
  • Select an option

  • Save facundovictor/34de3f5d4c7cbc923847 to your computer and use it in GitHub Desktop.

Select an option

Save facundovictor/34de3f5d4c7cbc923847 to your computer and use it in GitHub Desktop.
Tmux configuration file with Powerline-like status bar, system clipboard integration and some other nice tweaks.
source "/usr/share/tmux/powerline.conf"
# Thanks to:
# http://blog.yjl.im/2009/11/migrating-to-tmux-from-gnuscreen.html
# https://gist.github.com/ivanalejandro0/7459223
# 0 is too far
set -g base-index 1
#Disable window auto renaming
set -g allow-rename off
# Terminal emulator window title
set -g set-titles on
set -g set-titles-string '#S:#I.#P #W'
# use vi mode
set-window-option -g mode-keys vi
# use mouse
setw -g mode-mouse on
# Bigger history
set -g history-limit 10000
# Notifying if other windows has activities
setw -g monitor-activity on
set -g visual-activity on
# to be friendly with vim: get shift, alt, ctrl keys working
set -g xterm-keys on
# to avoid esc delay in vim
set -s escape-time 0
# display the messages in the status bar a little longer than the default
# set-option -g display-time 4000
# enable for remote hosts:
# set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock
# THEMING ---------------------------------------------------------------------
# https://github.com/skwp/dotfiles/blob/master/tmux/tmux.conf
# https://gist.github.com/alexyoung/6040385
set -g status-interval 1
set -g status-fg black
set -g status-bg colour232
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
set -g message-attr bold
set -g window-status-format "#[fg=colour10,bg=colour234] #I #[fg=colour231,bold]#W#F #[fg=colour31,bg=colour234,nobold]"
set -g window-status-current-format "#[fg=colour10,bg=colour31] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
# Left status bar
set -g status-left-length 52
set -g status-left '#[fg=colour235,bg=colour252,bold] #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]'
#set -g status-left-length 30
#set -g status-left '#[fg=green](#S) #(whoami)'
# Right status bar
set -g status-right-length 451
#set -g status-right '#[fg=green]battery ♥#(acpi | cut -d ',' -f 2) | #[fg=yellow]%a %d %b %Y #[fg=green]:: %l:%M %p '
#set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
# Highlight the active window in status bar
setw -g window-status-current-bg blue
# Clock
setw -g clock-mode-colour green
setw -g clock-mode-style 24
# color settings
# some times you need to use: `alias tmux="tmux -2"`
set -g default-terminal "xterm-256color"
# set -g default-terminal "screen-256color"
# BINDINGS --------------------------------------------------------------------
# Change prefix key to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display-message 'Configuration reloaded.'
# Last active window
# unbind l
# bind C-a last-window
# For moving windows
bind-key -n C-S-Left move-window -t -1
bind-key -n C-S-Right move-window -t +1
# This is needed for tmux > 1.8
# http://unix.stackexchange.com/a/109255/66916
bind c new-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
# Split like vim
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -v -c "#{pane_current_path}"
# C-c: save into system clipboard (+). With preselection.
bind C-c choose-buffer "run-shell -b 'tmux save-buffer -b %% - | xclip -i -sel clipboard' \; run-shell -b \" tmux display \\\"Clipboard \(+\) filled with: $(tmux save-buffer -b %1 - | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \\\" \" "
# C-v: copy from system clipboard (+).
bind C-v run-shell -b "tmux set-buffer \"$(xclip -o -selection clipboard)\" \; tmux paste-buffer" \; run-shell -b "tmux display \"Copied from \(+\) $(xclip -o -selection clipboard | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \""
# C-d: save into selection clipboard (*). With preselection.
bind C-d choose-buffer "run-shell -b \"tmux save-buffer -b %% - | xclip \" \; run-shell -b \" tmux display \\\"Clipboard \(*\) filled with: $(tmux save-buffer -b %1 - | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \\\" \" "
# C-f: copy from * clipboard.
bind C-f run-shell "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" \; run-shell "tmux display \"Copied from \(*\) $(xclip -o | dd ibs=2 obs=1 status=noxfer count=80 2> /dev/null)... \""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment