diff --git a/.tmux.conf b/.tmux.conf index 6124aca..63534dc 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,39 +1,11 @@ -# fmux v0.1 +# fmux v0.5 # LWS 2017 # make tmux play nice with various apps set -g default-terminal "screen-256color" -# remap prefix from 'C-b' to 'C-a' for recovering screen users -unbind C-b -set-option -g prefix C-b -bind-key C-b send-prefix - -# byobu style F-key bindings (only the useful ones) - -bind-key -n F2 new-window -bind-key -n F3 previous-window -bind-key -n F4 next-window -bind-key -n F6 detach -bind-key -n F7 copy-mode -bind-key -n C-F6 kill-pane -bind-key -n F8 command-prompt -p "(rename-window) " "rename-window '%%'" -bind-key -n C-F8 command-prompt -p "(rename-session) " "rename-session '%%'" - -# split panes using | and - -bind | split-window -h -bind - split-window -v -unbind '"' -unbind % - -# switch panes using Alt-arrow without prefix -bind -n M-Left select-pane -L -bind -n M-Right select-pane -R -bind -n M-Up select-pane -U -bind -n M-Down select-pane -D - -# reload config file -bind r source-file ~/.tmux.conf +# source ~/fmux/f-keys, which adds the useful byobu F-key shortcuts +source ~/fmux/f-keys # pane border colors diff --git a/README.md b/README.md index 4ae23f1..16986cf 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,12 @@ This project implements byobu-like function key bindings for common tmux commands, but without as much overhead as byobu. It also adds some useful status-bar widgets on the right, implemented with a bash script. +## Key bindings + +I've added the most common/useful F-key shortcuts for moving between tmux windows, as well as splitting existing windows into panes with `Ctrl-b |` and `Ctrl-b -`. + +In case any of these bindings interfere with other commands, they can be temporarily toggled on or off with `Shfit-F12`. + ## Installation 1. Clone this repository to your home folder. diff --git a/f-keys b/f-keys new file mode 100644 index 0000000..c79966c --- /dev/null +++ b/f-keys @@ -0,0 +1,29 @@ +# fmux key bindings page + +# byobu style F-key bindings (only the useful ones) + +bind-key -n F2 new-window +bind-key -n F3 previous-window +bind-key -n F4 next-window +bind-key -n F6 detach +bind-key -n F7 copy-mode +bind-key -n C-F6 kill-pane +bind-key -n F8 command-prompt -p "(rename-window) " "rename-window '%%'" +bind-key -n C-F8 command-prompt -p "(rename-session) " "rename-session '%%'" +bind-key -n S-F12 source ~/fmux/f-keys.disable \; display-message "fmux F-keys: DISABLED" + + +# split panes using | and - +bind | split-window -h +bind - split-window -v +unbind '"' +unbind % + +# switch panes using Alt-arrow without prefix +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +# reload config file +bind r source-file ~/.tmux.conf diff --git a/f-keys.disable b/f-keys.disable new file mode 100644 index 0000000..f0ca2e2 --- /dev/null +++ b/f-keys.disable @@ -0,0 +1,21 @@ +# disable fmux keybindings +# this enables re-enabling with Shift-F12 (same as byobu) +# in fact, this whole concept is ripped wholesale, with love, from byobu + +bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux \; source $HOME/.byobu/keybindings.tmux \; display-message "fmux F-keys: ENABLED" + +# unbind everything that might conflict +unbind-key -n F2 new-window +unbind-key -n F3 previous-window +unbind-key -n F4 next-window +unbind-key -n F6 detach +unbind-key -n F7 copy-mode +unbind-key -n C-F6 kill-pane +unbind-key -n F8 command-prompt -p "(rename-window) " "rename-window '%%'" +unbind-key -n C-F8 command-prompt -p "(rename-session) " "rename-session '%%'" +unbind | split-window -h +unbind - split-window -v +unbind -n M-Left select-pane -L +unbind -n M-Right select-pane -R +unbind -n M-Up select-pane -U +unbind -n M-Down select-pane -D \ No newline at end of file