Skip to content

Instantly share code, notes, and snippets.

@a-morales
Last active December 30, 2015 00:59
Show Gist options
  • Save a-morales/7753399 to your computer and use it in GitHub Desktop.
Save a-morales/7753399 to your computer and use it in GitHub Desktop.
my .tmux.conf file along with the scripts I use for the status bar. I am using the following theme https://github.com/chriskempson/tomorrow-theme with the inconsolata-dz patched font https://github.com/Lokaltog/powerline-fonts
unbind C-b
set -g prefix C-o
bind v send-prefix
#setting utf8 encoding
set -g utf8
set-window-option -g utf8 on
#default settings
set -g default-terminal "screen-256color"
set-option -g default-shell $SHELL
set-option -g default-command "reattach-to-user-namespace -l zsh"
#monitor any activity that happens in other windows and screens
setw -g monitor-activity on
set -g visual-activity on
#set window and pane index to 1
set -g base-index 1
set -g pane-base-index 1
#aggressive resize
setw -g aggressive-resize on
#clear screen
bind C-l send-keys 'C-l'
#use PREFIX | and - to split windows
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
#window options
set-option -g allow-rename off
set-option -g renumber-windows on
#enabling mouse specific features
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
#swap windows with its neighbor
bind-key H swap-window -t -1
bind-key L swap-window -t +1
#reload config file
bind-key r source-file ~/.tmux.conf\;\
display "Config Reloaded."
#clear the screen
bind-key C-k clear-history \;\
display "Screen Cleared"
#set simple status bar
bind-key s \
set -g status-left-length 0\;\
set -g status-justify left \;\
display "Simple Status Bar Enabled"
#set full status bar
bind-key S \
set -g status-left-length 70\;\
set -g status-justify centre\;\
display "Full Status Bar Enabled"
#run a command in the command prompt
bind-key e \
command-prompt "run -b 'cd #{pane_current_path} && %1'"
#quick to-do list
bind-key T clock-mode
bind-key t \
command-prompt -p "Todo:" "run -b 'echo %1 >> ~/Documents/txtFiles/todo.txt'"
#swap ; and :
bind-key \; command-prompt
bind-key : last-pane
#use vim keybinding in copy mode
setw -g mode-keys vi
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
#update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
#Clock options
set-window-option -g clock-mode-colour green
set-window-option -g clock-mode-style 24
#status bar options
set-option -g status on #enable status bar
set -g status-utf8 on #enable utf-8 for status bar
set -g status-interval 10 #set update frequency
set -g status-justify centre #position windows in the middle
#color stuff
#pane colors
set-option -g pane-border-fg colour246
set-option -g pane-active-border-fg colour4
#setting color for status bar
set-option -g status-bg colour234
set-option -g status-fg colour4
set-option -g status-attr dim
#setting window list colors
set-window-option -g window-status-fg colour4
set-window-option -g window-status-bg colour235
set-window-option -g window-status-attr dim
set-window-option -g window-status-current-fg colour1
set-window-option -g window-status-current-bg colour235
set-window-option -g window-status-current-attr bright
#setting the right status bar
set -g status-left-length 70
set -g status-left "#[fg=colour234,bg=colour2] #S:#I.#P #[fg=colour2, bg=colour4] #[fg=colour234]cpu: #(sh ~/.bin/getCPU.sh)%% #[fg=colour4, bg=colour5] #[fg=colour234]mem: #(sh ~/.bin/getMem.sh)%% #[fg=colour5,bg=colour6] #[fg=colour234]bat: #(sh ~/.bin/getBatt.sh) #[fg=colour6,bg=colour234]#[fg=colour234]"
#set -g status-left "#(node ~/Documents/Programming/projects/muxly/muxly.js left) here"
set -g status-right-length 60
set -g status-right "#[fg=colour3,bg=colour234]#[fg=colour234,bg=colour3]%d %b %Y - %H:%M %p "
#setting status bar message options
set -g message-bg colour238
set -g message-fg colour6
set -g message-command-bg colour238
set -g message-command-fg colour6
set -g display-time 1500
#setting options for when an alert happens
set -g window-status-bell-bg colour240
set -g window-status-content-bg colour240
set -g window-status-activity-bg colour240
#setting options to move between panes with vim keys
bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R
#tmux/vim magic
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
#!/bin/sh
state=`osascript -e 'tell application "iTunes" to player state as string'`;
if [ $state = 'playing' ]; then
artist=`osascript -e 'tell application "iTunes" to artist of current track as string'`;
track=`osascript -e 'tell application "iTunes" to name of current track as string'`;
echo "#[fg=colour1]#[fg=colour234,bg=colour1] $artist: $track #[fg=colour3,bg=colour1]";
else
echo "#[fg=colour3,bg=colour234]"
fi
#! /bin/bash
pmset -g batt | egrep "([0-9]+\%).*" -o | cut -f1 -d';'
#!bin/sh
ps aux | awk {'sum+=$3;print sum'} | tail -n 1
#!bin.sh
ps aux | awk {'sum+=$4;print sum'} | tail -n 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment