Added Shift-F12 to disable bindings

This commit is contained in:
Lloyd W. Slade 2017-09-13 16:21:09 -04:00
parent 73362ff93c
commit 0ce0737e29
4 changed files with 59 additions and 31 deletions

View file

@ -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

View file

@ -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.

29
f-keys Normal file
View file

@ -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

21
f-keys.disable Normal file
View file

@ -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