version 1.106, 2020/01/05 20:39:25 |
version 1.107, 2020/01/27 08:53:13 |
|
|
{ |
{ |
RB_REMOVE(key_bindings, &table->key_bindings, bd); |
RB_REMOVE(key_bindings, &table->key_bindings, bd); |
cmd_list_free(bd->cmdlist); |
cmd_list_free(bd->cmdlist); |
|
free((void *)bd->note); |
free(bd); |
free(bd); |
} |
} |
|
|
|
|
} |
} |
|
|
void |
void |
key_bindings_add(const char *name, key_code key, int repeat, |
key_bindings_add(const char *name, key_code key, const char *note, int repeat, |
struct cmd_list *cmdlist) |
struct cmd_list *cmdlist) |
{ |
{ |
struct key_table *table; |
struct key_table *table; |
|
|
|
|
bd = xcalloc(1, sizeof *bd); |
bd = xcalloc(1, sizeof *bd); |
bd->key = key; |
bd->key = key; |
|
if (note != NULL) |
|
bd->note = xstrdup(note); |
RB_INSERT(key_bindings, &table->key_bindings, bd); |
RB_INSERT(key_bindings, &table->key_bindings, bd); |
|
|
if (repeat) |
if (repeat) |
|
|
key_bindings_init(void) |
key_bindings_init(void) |
{ |
{ |
static const char *defaults[] = { |
static const char *defaults[] = { |
"bind C-b send-prefix", |
"bind -N 'Send the prefix key' C-b send-prefix", |
"bind C-o rotate-window", |
"bind -N 'Rotate through the panes' C-o rotate-window", |
"bind C-z suspend-client", |
"bind -N 'Suspend the current client' C-z suspend-client", |
"bind Space next-layout", |
"bind -N 'Select next layout' Space next-layout", |
"bind ! break-pane", |
"bind -N 'Break pane to a new window' ! break-pane", |
"bind '\"' split-window", |
"bind -N 'Split window vertically' '\"' split-window", |
"bind '#' list-buffers", |
"bind -N 'List all paste buffers' '#' list-buffers", |
"bind '$' command-prompt -I'#S' \"rename-session -- '%%'\"", |
"bind -N 'Rename current session' '$' command-prompt -I'#S' \"rename-session -- '%%'\"", |
"bind % split-window -h", |
"bind -N 'Split window horizontally' % split-window -h", |
"bind & confirm-before -p\"kill-window #W? (y/n)\" kill-window", |
"bind -N 'Kill current window' & confirm-before -p\"kill-window #W? (y/n)\" kill-window", |
"bind \"'\" command-prompt -pindex \"select-window -t ':%%'\"", |
"bind -N 'Prompt for window index to select' \"'\" command-prompt -pindex \"select-window -t ':%%'\"", |
"bind ( switch-client -p", |
"bind -N 'Switch to previous client' ( switch-client -p", |
"bind ) switch-client -n", |
"bind -N 'Switch to next client' ) switch-client -n", |
"bind , command-prompt -I'#W' \"rename-window -- '%%'\"", |
"bind -N 'Rename current window' , command-prompt -I'#W' \"rename-window -- '%%'\"", |
"bind - delete-buffer", |
"bind -N 'Delete the most recent paste buffer' - delete-buffer", |
"bind . command-prompt \"move-window -t '%%'\"", |
"bind -N 'Move the current window' . command-prompt \"move-window -t '%%'\"", |
"bind 0 select-window -t:=0", |
"bind -N 'Describe key binding' '/' command-prompt -kpkey 'list-keys -1N \"%%%\"'", |
"bind 1 select-window -t:=1", |
"bind -N 'Select window 0' 0 select-window -t:=0", |
"bind 2 select-window -t:=2", |
"bind -N 'Select window 1' 1 select-window -t:=1", |
"bind 3 select-window -t:=3", |
"bind -N 'Select window 2' 2 select-window -t:=2", |
"bind 4 select-window -t:=4", |
"bind -N 'Select window 3' 3 select-window -t:=3", |
"bind 5 select-window -t:=5", |
"bind -N 'Select window 4' 4 select-window -t:=4", |
"bind 6 select-window -t:=6", |
"bind -N 'Select window 5' 5 select-window -t:=5", |
"bind 7 select-window -t:=7", |
"bind -N 'Select window 6' 6 select-window -t:=6", |
"bind 8 select-window -t:=8", |
"bind -N 'Select window 7' 7 select-window -t:=7", |
"bind 9 select-window -t:=9", |
"bind -N 'Select window 8' 8 select-window -t:=8", |
"bind : command-prompt", |
"bind -N 'Select window 9' 9 select-window -t:=9", |
"bind \\; last-pane", |
"bind -N 'Prompt for a command' : command-prompt", |
"bind = choose-buffer -Z", |
"bind -N 'Move to the previously active pane' \\; last-pane", |
"bind ? list-keys", |
"bind -N 'Choose a paste buffer from a list' = choose-buffer -Z", |
"bind D choose-client -Z", |
"bind -N 'List key bindings' ? list-keys -N", |
"bind E select-layout -E", |
"bind -N 'Choose a client from a list' D choose-client -Z", |
"bind L switch-client -l", |
"bind -N 'Spread panes out evenly' E select-layout -E", |
"bind M select-pane -M", |
"bind -N 'Switch to the last client' L switch-client -l", |
"bind [ copy-mode", |
"bind -N 'Clear the marked pane' M select-pane -M", |
"bind ] paste-buffer", |
"bind -N 'Enter copy mode' [ copy-mode", |
"bind c new-window", |
"bind -N 'Paste the most recent paste buffer' ] paste-buffer", |
"bind d detach-client", |
"bind -N 'Create a new window' c new-window", |
"bind f command-prompt \"find-window -Z -- '%%'\"", |
"bind -N 'Detach the current client' d detach-client", |
"bind i display-message", |
"bind -N 'Search for a pane' f command-prompt \"find-window -Z -- '%%'\"", |
"bind l last-window", |
"bind -N 'Display window information' i display-message", |
"bind m select-pane -m", |
"bind -N 'Select the previously current window' l last-window", |
"bind n next-window", |
"bind -N 'Toggle the marked pane' m select-pane -m", |
"bind o select-pane -t:.+", |
"bind -N 'Select the next window' n next-window", |
"bind p previous-window", |
"bind -N 'Select the next pane' o select-pane -t:.+", |
"bind q display-panes", |
"bind -N 'Select the previous pane' p previous-window", |
"bind r refresh-client", |
"bind -N 'Display pane numbers' q display-panes", |
"bind s choose-tree -Zs", |
"bind -N 'Redraw the current client' r refresh-client", |
"bind t clock-mode", |
"bind -N 'Choose a session from a list' s choose-tree -Zs", |
"bind w choose-tree -Zw", |
"bind -N 'Show a clock' t clock-mode", |
"bind x confirm-before -p\"kill-pane #P? (y/n)\" kill-pane", |
"bind -N 'Choose a window from a list' w choose-tree -Zw", |
"bind z resize-pane -Z", |
"bind -N 'Kill the active pane' x confirm-before -p\"kill-pane #P? (y/n)\" kill-pane", |
"bind '{' swap-pane -U", |
"bind -N 'Zoom the active pane' z resize-pane -Z", |
"bind '}' swap-pane -D", |
"bind -N 'Swap the active pane with the pane above' '{' swap-pane -U", |
"bind '~' show-messages", |
"bind -N 'Swap the active pane with the pane below' '}' swap-pane -D", |
"bind PPage copy-mode -u", |
"bind -N 'Show messages' '~' show-messages", |
"bind -r Up select-pane -U", |
"bind -N 'Enter copy mode and scroll up' PPage copy-mode -u", |
"bind -r Down select-pane -D", |
"bind -N 'Select the pane above the active pane' -r Up select-pane -U", |
"bind -r Left select-pane -L", |
"bind -N 'Select the pane below the active pane' -r Down select-pane -D", |
"bind -r Right select-pane -R", |
"bind -N 'Select the pane to the left of the active pane' -r Left select-pane -L", |
"bind M-1 select-layout even-horizontal", |
"bind -N 'Select the pane to the right of the active pane' -r Right select-pane -R", |
"bind M-2 select-layout even-vertical", |
"bind -N 'Set the even-horizontal layout' M-1 select-layout even-horizontal", |
"bind M-3 select-layout main-horizontal", |
"bind -N 'Set the even-vertical layout' M-2 select-layout even-vertical", |
"bind M-4 select-layout main-vertical", |
"bind -N 'Set the main-horizontal layout' M-3 select-layout main-horizontal", |
"bind M-5 select-layout tiled", |
"bind -N 'Set the main-vertical layout' M-4 select-layout main-vertical", |
"bind M-n next-window -a", |
"bind -N 'Select the tiled layout' M-5 select-layout tiled", |
"bind M-o rotate-window -D", |
"bind -N 'Select the next window with an alert' M-n next-window -a", |
"bind M-p previous-window -a", |
"bind -N 'Rotate through the panes in reverse' M-o rotate-window -D", |
"bind -r S-Up refresh-client -U 10", |
"bind -N 'Select the previous window with an alert' M-p previous-window -a", |
"bind -r S-Down refresh-client -D 10", |
"bind -N 'Move the visible part of the window up' -r S-Up refresh-client -U 10", |
"bind -r S-Left refresh-client -L 10", |
"bind -N 'Move the visible part of the window down' -r S-Down refresh-client -D 10", |
"bind -r S-Right refresh-client -R 10", |
"bind -N 'Move the visible part of the window left' -r S-Left refresh-client -L 10", |
"bind -r DC refresh-client -c", |
"bind -N 'Move the visible part of the window right' -r S-Right refresh-client -R 10", |
"bind -r M-Up resize-pane -U 5", |
"bind -N 'Reset so the visible part of the window follows the cursor' -r DC refresh-client -c", |
"bind -r M-Down resize-pane -D 5", |
"bind -N 'Resize the pane up by 5' -r M-Up resize-pane -U 5", |
"bind -r M-Left resize-pane -L 5", |
"bind -N 'Resize the pane down by 5' -r M-Down resize-pane -D 5", |
"bind -r M-Right resize-pane -R 5", |
"bind -N 'Resize the pane left by 5' -r M-Left resize-pane -L 5", |
"bind -r C-Up resize-pane -U", |
"bind -N 'Resize the pane right by 5' -r M-Right resize-pane -R 5", |
"bind -r C-Down resize-pane -D", |
"bind -N 'Resize the pane up' -r C-Up resize-pane -U", |
"bind -r C-Left resize-pane -L", |
"bind -N 'Resize the pane down' -r C-Down resize-pane -D", |
"bind -r C-Right resize-pane -R", |
"bind -N 'Resize the pane left' -r C-Left resize-pane -L", |
|
"bind -N 'Resize the pane right' -r C-Right resize-pane -R", |
|
|
"bind -n MouseDown1Pane select-pane -t=\\; send-keys -M", |
"bind -n MouseDown1Pane select-pane -t=\\; send-keys -M", |
"bind -n MouseDrag1Border resize-pane -M", |
"bind -n MouseDrag1Border resize-pane -M", |