Skip to content

Instantly share code, notes, and snippets.

@chirayuk
Last active March 23, 2019 16:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save chirayuk/6084618 to your computer and use it in GitHub Desktop.
Save chirayuk/6084618 to your computer and use it in GitHub Desktop.
~/.tmux.conf for tmux 1.5 (e.g. for use on Cloud9 console.)
# This is a modified version that supports tmux 1.5 so you can use tmux on Cloud9 IDE.
# https://gist.github.com/chirayuk/6084618
# NOTE: The default TERM value under Cloud9 is set to vt100. This won't give
# you colors under tmux. Before running tmux, "export
# TERM=screen-256color" and then run tmux. If you already ran tmux
# before doing so, you can "tmux kill-server" to kill it and start a new
# one.
#nop# # https://gist.github.com/chirayuk/5377283
#nop# set default-command /Users/chirayu/ck/vcs/ck5/scripts/for_os_x/tmux_shell_with_clipboard_support
# Change the prefix key to `
unbind C-b
set -g prefix `
# send the prefix to client inside window (ala nested sessions)
bind-key ` send-prefix
# Reload config
bind-key R source $HOME/.tmux.conf
# VI mode keybindings
set-window-option -g mode-keys vi
set-option -g status-keys vi
# Mouse bindings.
set-window-option -g mode-mouse on
set-option -g mouse-select-window on
set-option -g mouse-select-pane on
set-option -g mouse-resize-pane on
set-window-option -g utf8 on
# set-window-option -g automatic-rename off
set bell-action none
# Force 256 color - start tmux with "tmux -2"
set -g default-terminal "screen-256color"
# xterm-keys
set-window -g xterm-keys on
# status bar
# color 3 = yellow, color 11 = bright yellow
set-option -g status-bg magenta
set-option -g status-fg colour11
# set-option -g status-attr bold
set-option -g message-bg magenta
set-option -g message-fg colour11
# set-option -g message-attr bold
# set-option -g status-interval 5
# Highlighting the active window in status bar
set-window-option -g window-status-current-bg blue
set-window-option -g window-status-current-fg colour11
set-window-option -g window-status-current-attr bold
#nop# set-window-option -g window-status-last-bg blue
#nop# set-window-option -g window-status-last-fg yellow
#nop# set-window-option -g window-status-last-attr dim
#nop#
#nop# # Custom(chirayu): Clipboard sync.
#nop# bind-key y run-shell "ck copy_tmux_buffer"
#nop# bind-key -t vi-copy Enter copy-pipe "ck copy_tmux_buffer"
#nop# bind-key p run-shell "ck paste_to_tmux_buffer"
#nop#
#nop# # Zoom window.
#nop# bind-key Enter resize-pane -Z
# key bindings for splitting
unbind %
bind-key | split-window -h
unbind '"'
bind-key - split-window -v
# key bindings for switching windows
unbind p
bind-key -r left previous-window
unbind n
bind-key -r right next-window
# key bindings for switching panes
bind-key -r Up select-pane -t.-1
bind-key -r Down select-pane -t.+1
# Goto window by number.
bind-key g command-prompt "select-window -t :'%%'"
# Send input to all panes
bind-key * set-window-option synchronize-panes
bind-key m set-window-option mode-mouse on \; set-option mouse-select-window on \; set-option mouse-select-pane on \; set-option mouse-resize-pane on
bind-key M set-window-option mode-mouse off \; set-option mouse-select-window off \; set-option mouse-select-pane off \; set-option mouse-resize-pane off
# Resize panes.
bind-key -r M-Left resize-pane -L 1
bind-key -r M-Right resize-pane -R 1
bind-key -r M-Up resize-pane -U 1
bind-key -r M-Down resize-pane -D 1
# History and buffer history
set-option -g history-limit 40000
set-option -g buffer-limit 400000
# Terminal emulator window title
set-option -g set-titles off
# set-option -g set-titles-string '#S:#I.#P #W'
# Status Bar
# set-option -g status-justify centre
set-option -g status-left-length 24
set-option -g status-left '#[fg=colour15][#S]#[default]'
set-option -g status-right '#[fg=colour15]%H:%M [#(hostname -s)]#[default]'
# Notifying if other windows has activities
set-option -g visual-activity on
set-window-option -g monitor-activity off
# Clock
set-window-option -g clock-mode-colour green
set-window-option -g clock-mode-style 24
# Swapping.
# Swap panes.
bind-key { swap-pane -d -s:.-1
bind-key } swap-pane -d -s:.+1
# Swap windows.
bind-key -r M-{ swap-pane -d -s:-1
bind-key -r M-} swap-pane -d -s:+1
bind-key X command-prompt -p "Swap with with number:" "swap-pane -d -s:%%"
# htop
bind-key "~" split-window -h "exec htop" \; swap-pane -U
# Logging
# Appears not to write anything to the file :(
bind-key "P" pipe-pane -o 'cat >>$HOME/logs/tmux.log' \; display-message 'Started logging to $HOME/logs/tmux.log'
# Layout
set-window-option -g other-pane-width 44
set-window-option -g other-pane-height 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment