cuongtransc
4/5/2016 - 2:58 PM

Fix tmux-1.9 default path

Fix tmux-1.9 default path

#!/bin/bash

# Source: https://bugs.launchpad.net/byobu/+bug/1393793

# Step 1: Create ~/.byobu/f-keys.tmux
cat > ~/.byobu/f-keys.tmux <<"EOM"
bind-key -n F2 new-window -c "#{pane_current_path}" \; rename-window "-"
bind-key -n C-F2 display-panes \; split-window -h -c "#{pane_current_path}"
bind-key -n S-F2 display-panes \; split-window -v -c "#{pane_current_path}"

# This seems to open a new session in / instead of the current directory; may want to keep it commented out for now
#bind-key -n C-S-F2 new-session -c "#{pane_current_path}"
bind-key -n M-S-F8 new-window -c "#{pane_current_path}" -k "byobu-layout restore; clear; $SHELL"
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux.disable \; source $BYOBU_CONFIG_DIR/f-keys.tmux.disable \; display-message "Byobu F-keys: DISABLED"
EOM

# Step 2: Create ~/.byobu/f-keys.tmux.disable
cat > ~/.byobu/f-keys.tmux.disable <<"EOM"
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux \; source $BYOBU_CONFIG_DIR/f-keys.tmux \; display-message "Byobu F-keys: ENABLED"
EOM

# Step 3: Add to ~/.byobu/.tmux.conf
cat > ~/.byobu/.tmux.conf <<"EOM"
source-file $BYOBU_CONFIG_DIR/f-keys.tmux
EOM

# Step 4: Add to ~/.byobu/keybindings.tmux
cat > ~/.byobu/keybindings.tmux <<"EOM"
# screen ^C c
unbind ^C
bind ^C new-window -c "#{pane_current_path}"
unbind c
bind c new-window -c "#{pane_current_path}"

# split -v |
unbind |
bind | split-window -c "#{pane_current_path}"
EOM