Skip to content

Instantly share code, notes, and snippets.

@cuongtransc
Created April 5, 2016 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuongtransc/9767da8a4fc9d105f5bf0c55ad858a79 to your computer and use it in GitHub Desktop.
Save cuongtransc/9767da8a4fc9d105f5bf0c55ad858a79 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment