summaryrefslogtreecommitdiffstats
path: root/key-bindings.c
AgeCommit message (Collapse)Author
2017-06-09Use brackets around prompts which looks better and matches the other modes.nicm
2017-05-30Rewrite of choose mode, both to simplify and tidy the code and to addnicm
some modern features. Now the common code is in mode-tree.c, which provides an API used by the three modes now separated into window-{buffer,client,tree}.c. Buffer mode shows buffers, client mode clients and tree mode a tree of sessions, windows and panes. Each mode has a common set of key bindings plus a few that are specific to the mode. Other changes are: - each mode has a preview pane: for buffers this is the buffer content (very useful), for others it is a preview of the pane; - items may be sorted in different ways ('O' key); - multiple items may be tagged and an operation applied to all of them (for example, to delete multiple buffers at once); - in tree mode a command may be run on the selected item (session, window, pane) or on tagged items (key ':'); - displayed items may be filtered in tree mode by using a format (this is used to implement find-window) (key 'f'); - the custom format (-F) for the display is no longer available; - shortcut keys change from 0-9, a-z, A-Z which was always a bit weird with keys used for other uses to 0-9, M-a to M-z. Now that the code is simpler, other improvements will come later. Primary key bindings for each mode are documented under the commands in the man page (choose-buffer, choose-client, choose-tree). Parts written by Thomas Adam.
2017-05-30Preserve search string when entering prompt again.nicm
2017-05-10Insert copy mode bindings at the right place in the command queue.nicm
2017-05-07Up to now, tmux sees \033\033[OA as M-Up and since we turned onnicm
xterm-keys by default, generates \033[1;3A instead of \033\033[OA. Unfortunately this confuses vi, which doesn't understand xterm keys and now sees Escape+Up pressed within escape-time as Escape followed by A. The issue doesn't happen in xterm itself because it gets the keys from X and can distinguish between a genuine M-Up and Escape+Up. Because xterm can, tmux can too: xterm will give us \033[1;3A (that is, kUP3) for a real M-Up and \033\033OA for Escape+Up - in fact, we can be sure any \033 preceding an xterm key is a real Escape key press because Meta would be part of the xterm key instead of a separate \033. So change tmux to recognise both sequences as M-Up for its own purposes, but generate the xterm version of M-Up only if it originally received the xterm version from the terminal. This means we will return to sending \033\033OA instead of the xterm key for terminals that do not support xterm keys themselves, but there is no practical way around this because they do not allow us to distinguish between Escape+Up and M-Up. xterm style escape sequences are now the de facto standard for these keys in any case. Problem reported by jsing@ and subsequently by Cecile Tonglet in GitHub issue 907.
2017-04-21Key needs to be initialized to zero now it has flags in it.nicm
2017-04-21Store state shared between multiple commands in the queue in a sharednicm
structure.
2017-04-05Add Home and End for copy mode.nicm
2017-02-06Cancel key table when switching session, unless the key is going tonicm
repeat. Reported by Amos Bird.
2017-01-24Add support for custom command aliases, this is an array option whichnicm
contains items of the form "alias=command". This is consulted when an unknown command is parsed.
2017-01-16Revert WIP parts of previous I didn't mean to commit yet.nicm
2017-01-16getopt() has a struct option so just return to using options_entry.nicm
2017-01-15It is silly for cmd_list_parse to return an integer error when it couldnicm
just return NULL.
2017-01-06Incremental search in copy mode (on for emacs keys by default) - muchnicm
the same as normal searching but updates the cursor position and marked search terms as you type. C-r and C-s in the prompt repeat the search, once finished searching (with Enter), N and n work as before.
2016-12-07Make prefix work in all tables (except the prefix table). Users who wantnicm
to avoid this can set prefix to "none" and bind send-prefix themselves. Allows C-b t be bound in the copy mode tables again, pointed out by millert@.
2016-11-24Fix so that we work out the right pane from mouse events - we were doingnicm
so too early, before the mouse event was necessarily valid, so could end up using the pane from the previous mouse event, or the active pane. It is important that we use the right pane now that different panes can have different key tables (for copy mode). Fixes problem reported by Greg Hurrell.
2016-11-23For mouse keys, use the mouse pane as the default current pane.nicm
2016-10-21Add %%% to substitute with quotes escaped (convert " to \"). Use thisnicm
for the prompts in copy mode. Fixes problems with jumping to ' reported by Theo Buehler.
2016-10-19Do not have a default binding for C-b in copy-mode-vi or it conflictsnicm
with the default prefix. Reported by natano@.
2016-10-16Mass rename struct cmd_q to struct cmdq_item and related.nicm
2016-10-16Rewrite command queue handling. Each client still has a command queue,nicm
but there is also now a global command queue. Instead of command queues being dispatched on demand from wherever the command happens to be added, they are now all dispatched from the top level server loop. Command queues may now also include callbacks as well as commands, and items may be inserted after the current command as well as at the end. This all makes command queues significantly more predictable and easier to use, and avoids the complex multiple nested command queues used by source-file, if-shell and friends. A mass rename of struct cmdq to a better name (cmdq_item probably) is coming.
2016-10-12The repeat prompt in both emacs and vi (and the old one in tmux) doesn'tnicm
support line editing and instead executes a command as soon as a non-number key is pressed. Add a -N flag to command-prompt for the same in copy mode. Reported by Theo Buehler.
2016-10-11Support double and triple clicks (they are cumulative, so double isnicm
fired then triple), and use for select-word and select-line in copy mode. Inspired by a different solution from Omar Sandoval.
2016-10-11Fundamental change to how copy mode key bindings work:nicm
The vi-copy and emacs-copy mode key tables are gone, and instead copy mode commands are bound in one of two normal key tables ("copy-mode" or "copy-mode-vi"). Keys are bound to "send-keys -X copy-mode-command". So: bind -temacs-copy C-Up scroll-up bind -temacs-copy -R5 WheelUpPane scroll-up Becomes: bind -Tcopy-mode C-Up send -X scroll-up bind -Tcopy-mode WheelUpPane send -N5 -X scroll-up This allows the full command parser and command set to be used - for example, we can use the normal command prompt for searching, jumping, and so on instead of a custom one: bind -Tcopy-mode C-r command-prompt -p'search up' "send -X search-backward '%%'" command-prompt also gets a -1 option to only require on key press, which is needed for jumping. The plan is to get rid of mode keys entirely, so more to come eventually.
2016-03-01Remove some more unused variables, and use RB_FOREACH_SAFE innicm
key_bindings_unref_table.
2016-01-19I no longer use my SourceForge address so replace it.nicm
2015-11-12Support UTF-8 key bindings by expanding the key type from int tonicm
uint64_t and converting UTF-8 to Unicode on input and the reverse on output. (This allows key bindings, there are still omissions - the largest being that the various prompts do not accept UTF-8.)
2015-11-05Pass through right click if mouse is on, from Patrick Palka.nicm
2015-10-27Use copy-mode -et= in WheelUpPane binding, from Patrick Palka.nicm
2015-10-26Default bindings for mouse wheel on status line to change window (likenicm
we had before), from Patrick Palka.
2015-10-21By popular demand add a default binding for mouse wheel up to scrollnicm
into history (if the mouse is, on of course).
2015-06-05Make it so that if a window or session target is prefixed with an =,nicm
only an exact name or index match is accepted, no special character, prefix match, or fnmatch.
2015-06-04Add support for a single "marked pane". There is one marked pane in thenicm
server at a time; it may be toggled or cleared with select-pane -m and -M (the border is highlighted). A new target '~' or '{marked}' specifies the marked pane to commands and it is the default target for the swap-pane and join-pane -s flag (this makes them much simpler to use - mark the source pane and then change to the target pane to run swapp or joinp).
2015-05-07Style spacing nits.nicm
2015-04-25Fix some char* -> char *.nicm
2015-04-21Bind mouse dragging so that it is passed through to applications if theynicm
want it rather than entering copy mode.
2015-04-20Support for multiple key tables to commands to be bound to sequences ofnicm
keys. The default key bindings become the "prefix" table and -n the "root" table. Keys may be bound in new tables with bind -T and switch-client -T used to specify the table in which the next key should be looked up. Based on a diff from Keith Amling.
2015-04-19Rewrite of tmux mouse support which was a mess. Instead of havingnicm
options for "mouse-this" and "mouse-that", mouse events may be bound as keys and there is one option "mouse" that turns on mouse support entirely (set -g mouse on). See the new MOUSE SUPPORT section of the man page for description of the key names and new flags (-t= to specify the pane or window under mouse as a target, and send-keys -M to pass through a mouse event). The default builtin bindings for the mouse are: bind -n MouseDown1Pane select-pane -t=; send-keys -M bind -n MouseDown1Status select-window -t= bind -n MouseDrag1Pane copy-mode -M bind -n MouseDrag1Border resize-pane -M To get the effect of turning mode-mouse off, do: unbind -n MouseDrag1Pane unbind -temacs-copy MouseDrag1Pane The old mouse options are now gone, set-option -q may be used to suppress warnings if mixing configuration files.
2014-10-22Fix some spacing nits.nicm
2014-10-20Instead of setting up the default keys by building the key structnicm
directly with a helper function in the cmd_entry, include a table of bind-key commands and pass them through the command parser and a temporary cmd_q. As well as being smaller, this will allow default bindings to be command sequences which will probably be needed soon.
2014-05-14Now that cmdlists are reference counted, there is no need for two-stepnicm
deletion via the dead_key_bindings tree. From Keith Amling.
2014-04-17Remove the "info" message mechanism, this was only used for about fivenicm
mostly useless and annoying messages. Change those commands to silence on success like all the others. Still accept the -q command line flag and "quiet" server option for now.
2013-03-24Add resize-pane -Z to temporary zoom the active pane to occupy the fullNicholas Marriott
window or unzoom (restored to the normal layout) if it already zoomed, bound to C-b z by default. The pane is unzoomed on pretty much any excuse whatsoever. We considered making this a new layout but the requirements are quite different from layouts so decided it is better as a special case. Each current layout cell is saved, a temporary one-cell layout generated and all except the active pane set to NULL. Prompted by suggestions and scripts from several. Thanks to Aaron Jensen and Thiago Padilha for testing an earlier version.
2013-03-24Add a command queue to standardize and simplify commands that call otherNicholas Marriott
commands and allow a command to block execution of subsequent commands. This allows run-shell and if-shell to be synchronous which has been much requested. Each client has a default command queue and commands are consumed one at a time from it. A command may suspend execution from the queue by returning CMD_RETURN_WAIT and then resume it by calling cmd_continue() - for example run-shell does this from the callback that is fired after the job is freed. When the command queue becomes empty, command clients are automatically exited (unless attaching). A callback is also fired - this is used for nested commands in, for example, if-shell which can block execution of the client's cmdq until a new cmdq becomes empty. Also merge all the old error/info/print functions together and lose the old curclient/cmdclient distinction - a cmdq is bound to one client (or none if in the configuration file), this is a command client if c->session is NULL otherwise an attached client.
2013-03-22Need to set clients in context before changing their reference count.Nicholas Marriott
2013-03-22Remove unnecessary initializers of cmd_ctx.Nicholas Marriott
2013-01-17Remove the layout undo/redo code which never really worked.Nicholas Marriott
2012-07-10xfree is not particularly helpful, remove it. From Thomas Adam.Nicholas Marriott
2012-07-08Add choose-tree command to show windows and sessions in the sameNicholas Marriott
list. Change choose-window and -session to use the same code. From Thomas Adam.
2012-06-18Add a couple of NULL pointer checks to key binding functions, fromNicholas Marriott
jspenguin on SF bug 3535531.