set-window-option -g mouse on

# Global settings

# Set prefix to ^(space)
# 
# C-@ is the same as C-spacebar! That's convenient. Doesn't interfere with C-b, C-a etc
set-option -g prefix C-@
unbind-key C-b
bind-key C-@ send-prefix

# start window indexing at one (default = 0)
set -g base-index 1


# log output
bind-key H pipe-pane 'cat >>$HOME/tmp/tmuxlog/tmux-#W-#I.log' \; display-message 'Started logging to $HOME/tmp/tmuxlog/tmux-#W-#I.log'
bind-key h pipe-pane \; display-message 'Ended logging to $HOME/tmp/tmuxlog/tmux-#W.log'
unbind-key l
unbind-key L
bind-key l command-prompt -p "Log file name: " "pipe-pane 'cat >>~/tmp/tmuxlog/%%'"
bind-key L pipe-pane \; display-message "LOG closed "  
#(probably: $(ls -t ~/tmp/tmuxlog | head -1) )"

# C-o: open newest logfile
#   o: open newest logfile
#   g: open newest logfile in gvim buffer
#bind-key C-o split-window 'exec emacs ~/tmuxlog/$(ls -t ~/tmuxlog | head -1)'
#bind-key   o split-window 'exec emacs ~/tmp/tmuxlog/$(ls -t ~/tmp/tmuxlog | head -1)'
bind-key   o run-shell  'emacs ~/tmp/tmuxlog/$(ls -t ~/tmp/tmuxlog | head -1)'
#bind-key   g run-shell 'gvim --remote-send ":split ~/tmuxlog/$(ls -t ~/tmuxlog | head -1)<CR>"'


# Ctrl-Left/Right cycles thru windows (no prefix)
bind-key -n "C-Left"  select-window -t :-
bind-key -n "C-Right" select-window -t :+
##################################################

# CPBL, 2013: 
# scrollback buffer n lines
set -g history-limit 10000
