Add a choose-client command and extend choose-{session,window} to accept a

template. After a choice is made, %% (or %1) in the template is replaced by the
name of the session, window or client suitable for -t and the result executed
as a command. So, for example, "choose-window "killw -t '%%'"" will kill the
selected window.

The defaults if no template is given are (as now) select-window for
choose-window, switch-client for choose-session, and detach-client for
choose-client (now bound to D).
This commit is contained in:
Nicholas Marriott
2009-08-25 12:18:51 +00:00
parent 4f1d81c4ce
commit 7b847ced4a
9 changed files with 366 additions and 72 deletions

View File

@@ -130,6 +130,7 @@ key_bindings_init(void)
{ ']', 0, &cmd_paste_buffer_entry },
{ 'c', 0, &cmd_new_window_entry },
{ 'd', 0, &cmd_detach_client_entry },
{ 'D', 0, &cmd_choose_client_entry },
{ 'f', 0, &cmd_command_prompt_entry },
{ 'i', 0, &cmd_display_message_entry },
{ 'l', 0, &cmd_last_window_entry },
@@ -143,7 +144,7 @@ key_bindings_init(void)
{ 'x', 0, &cmd_confirm_before_entry },
{ '{', 0, &cmd_swap_pane_entry },
{ '}', 0, &cmd_swap_pane_entry },
{ '\002', 0, &cmd_send_prefix_entry },
{ '\002', /* C-b */ 0, &cmd_send_prefix_entry },
{ '1' | KEYC_ESCAPE, 0, &cmd_select_layout_entry },
{ '2' | KEYC_ESCAPE, 0, &cmd_select_layout_entry },
{ '3' | KEYC_ESCAPE, 0, &cmd_select_layout_entry },
@@ -162,7 +163,7 @@ key_bindings_init(void)
{ KEYC_LEFT | KEYC_CTRL, 1, &cmd_resize_pane_entry },
{ KEYC_RIGHT | KEYC_CTRL, 1, &cmd_resize_pane_entry },
{ 'o' | KEYC_ESCAPE, 0, &cmd_rotate_window_entry },
{ '\017', 0, &cmd_rotate_window_entry },
{ '\017', /* C-o */ 0, &cmd_rotate_window_entry },
};
u_int i;
struct cmd *cmd;