Skip to content

Instantly share code, notes, and snippets.

@sgray10
Created March 24, 2015 20:19
Show Gist options
  • Save sgray10/eeb60304718f5784da2c to your computer and use it in GitHub Desktop.
Save sgray10/eeb60304718f5784da2c to your computer and use it in GitHub Desktop.
# keybindings
unbind C-b
unbind C-r
unbind h
unbind j
unbind s
unbind v
unbind m
unbind C-f
# reload tmux.conf
bind C-r source-file ~/.tmux.conf \; display 'Reloaded tmux.conf'
# better split window aliases
bind h split-window -h
bind v split-window -v
# toggle mouse
bind m run 'tmuxmouse'
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
# join window into pane
bind j command-prompt -p "join pane from: " "join-pane -s '%%'"
# send pane to window
bind s command-prompt -p "send pane to: " "join-pane -t '%%'"
# global
set -g default-command "reattach-to-user-namespace -l zsh"
set -g default-terminal "screen-256color"
set -gs escape-time 0
set -gs repeat-time 600
set -g quiet off
set -g prefix C-t
set -g status-utf8 on
set -g set-titles on
set -g display-panes-time 1000
set -g display-time 1000
set -g monitor-activity on
set -g visual-activity on
set -g bell-action any
set -g base-index 1
set -g renumber-windows on
# window
setw -g utf8 on
setw -g pane-base-index 1
setw -g automatic-rename on
# status
set -g status on
set -g status-utf8 on
set -g status-interval 1
run 'tmuxtheme ~/.dotfiles/tmux/themes/1.theme'
# mouse on
run 'tmuxmouse on'
theme[status-fg]=colour231
theme[status-bg]=colour234
theme[status-left-length]=150
theme[status-left]='#[fg=colour16,bg=colour254,bold] #h:[#S] #[fg=colour254,bg=colour234,nobold]'
theme[status-right-length]=50
theme[status-right]="[#(battery -t)][%a %h %d %l:%M:%S %p]"
theme[window-status-format]="#[fg=colour244,bg=colour234]#I #[fg=colour240] #[default]#W "
theme[window-status-current-format]="#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I  #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
theme[message-style]="fg=white,bg=colour234,bold"
theme[window-status-fg]=colour249
theme[window-status-activity-fg]=red
theme[window-status-activity-bg]=none
oheme[window-status-activity-attr]=none
theme[window-status-bell-attr]=none
theme[window-status-activity-fg]=none
theme[window-status-bell-fg]=red
theme[set-titles-string]='#h ❐ #S ● #I #W'
theme[pane-border-fg]=white
theme[pane-border-bg]=default
theme[pane-active-border-fg]=green
theme[pane-active-border-bg]=default
#!/usr/bin/env bash
function opt_is {
$(tmux show-options -g|grep "$1"|grep -q "$2") && echo 0 || echo 1
}
function _set_global_opt {
tmux set-option -gq -t "$1" "$2" "$3"
}
function setmouse() {
local value="$1"
local session=`tmux display -p`
_set_global_opt "$session" "mode-mouse" "$value"
_set_global_opt "$session" "mouse-utf8" "$value"
_set_global_opt "$session" "mouse-resize-pane" "$value"
_set_global_opt "$session" "mouse-select-pane" "$value"
_set_global_opt "$session" "mouse-select-window" "$value"
tmux display-message "Mouse: $value"
}
function toggle_mouse() {
[[ $(opt_is "mouse-utf8" "on") -eq 0 ]] && setmouse "off" || setmouse "on"
}
# toggle or set the mouse if applicable
[ $# -eq 0 ] && toggle_mouse && exit 0
[ $# -eq 1 ] && [[ "$1" = "off" || "$1" = "on" ]] && setmouse "$1" && exit 0
echo "usage: $0 [ on | off ]"
echo "Note: choosing no option will toggle the status."
exit 1
#!/usr/bin/env bash
function apply_theme {
session=`tmux display -p`
declare -A theme && . "$1"
for key in "${!theme[@]}"
do
tmux set-option -gqt "$session" "$key" "${theme[$key]}"
done
}
[ $# -eq 1 ] && apply_theme "$1" && exit 0
echo "usage: $0 file" && exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment