summaryrefslogtreecommitdiffstats
path: root/key-bindings.c
AgeCommit message (Collapse)Author
2020-03-12Tidy up the default mouse key bindings and:nicm
- Add double and triple click bindings to copy a word or line outside copy mode. The text is selected for a short period to show what has been copied. This is in line with the existing mouse selection where the text is copied and the selection is cleared when the mouse button is released. - Change the existing double and triple click bindings in copy mode to behave in the same way. - Add a button 2 binding to paste the top buffer.
2020-01-27Add support for adding a note to a key binding (with bind-key -N) andnicm
use this to add descriptions to the default key bindings. A new -N flag to list-keys shows key bindings with notes rather than the default bind-key command used to create them. Change the default ? binding to use this to show a readable summary of keys. Also extend command-prompt to return the name of the key pressed and add a default binding (/) to show the note for the next key pressed Suggested by Alex Tremblay in GitHub issue 2000.
2020-01-05Common function to free key bindings.nicm
2019-12-19When adding a list with multiple commands to the queue, the next item tonicm
insert after needs to be the last one added, not the first. Reported by Jason Kim in GitHub issue 2023.
2019-12-02Remove client menu, I don't think it adds anything.nicm
2019-11-26Add default # and * binding with vi(1) keys.nicm
2019-11-20Do not check the client readonly flag when there is no client, GitHub issue ↵nicm
1980.
2019-09-18Up and Down are already used, use < and > instead.nicm
2019-09-16Change menu key bindings to Up and Down and also close it on any mousenicm
press if opened by key.
2019-09-10Set up format tree for %if, GitHub issue 1896.nicm
2019-05-28Change the default right click pane to open the menu if not in a modenicm
and no application mouse.
2019-05-28Add key bindings to open the window and pane menus (C-m and M-m for now).nicm
2019-05-28Allow menu items to be disabled by putting a - at the start of theirnicm
name, rather than just including #[dim] which still allowed them to be chosen.
2019-05-28Change display-menu from taking a single string to a set of arguments,nicm
which is much easier to work with. Based on a diff from Avi Halachmi.
2019-05-27Add an additional {} syntax for defining strings in the configurationnicm
file, making it much tidier to define commands that contain other tmux or shell commands (like if-shell). Also tweak bind-key to expect a string if it is only given one argument, so {} can be used with it as well. From Avi Halachmi.
2019-05-23Replace the split parser code (cfg.c and cmd-string.c) with a singlenicm
parser using yacc(1). This is a major change but is clearer and simpler and allows some edge cases to be made more consistent, as well as tidying up how aliases are handled. It will also allow some further improvements later. Entirely the same parser is now used for parsing the configuration file and for string commands. This means that constructs previously only available in .tmux.conf, such as %if, can now be used in string commands (for example, those given to if-shell - not commands invoked from the shell, they are still parsed by the shell itself). The only syntax change I am aware of is that #{} outside quotes or a comment is now considered a format and not a comment, so #{ is now a syntax error (notably, if it is at the start of a line). This also adds two new sections to the man page documenting the syntax and outlining how parsing and command execution works. Thanks to everyone who sent me test configs (they still all parse without errors - but this doesn't mean they still work as intended!). Thanks to Avi Halachmi for testing and man page improvements, also to jmc@ for reviewing the man page changes.
2019-05-12Add simple menus to tree, client, buffer modes.nicm
2019-05-10Add support for simple menus usable with mouse or keyboard. New commandnicm
display-menu shows a menu (bound to the mouse on status line by default) and a couple of extra formats for the default menus.
2019-05-09send-keys also needs to insert key commands in the right order.nicm
2019-04-29Add support for keys to jump between matching brackets - C-M-f and C-M-bnicm
in emacs, % in vi. Suggested by and help from Chris Barber in GitHub issue 1666.
2018-10-18Support for windows larger than visible on the attached client. This hasnicm
been a limitation for a long time. There are two new options, window-size and default-size, and a new command, resize-window. The force-width and force-height options and the session_width and session_height formats have been removed. The new window-size option tells tmux how to work out the size of windows: largest means it picks the size of the largest session, smallest the smallest session (similar to the old behaviour) and manual means that it does not automatically resize windows. The default is currently largest but this may change. aggressive-resize modifies the choice of session for largest and smallest as it did before. If a window is in a session attached to a client that is too small, only part of the window is shown. tmux attempts to keep the cursor visible, so the part of the window displayed is changed as the cursor moves (with a small delay, to try and avoid excess redrawing when applications redraw status lines or similar that are not currently visible). The offset of the visible portion of the window is shown in status-right. Drawing windows which are larger than the client is not as efficient as those which fit, particularly when the cursor moves, so it is recommended to avoid using this on slow machines or networks (set window-size to smallest or manual). The resize-window command can be used to resize a window manually. If it is used, the window-size option is automatically set to manual for the window (undo this with "setw -u window-size"). resize-window works in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has -a and -A flags. -a sets the window to the size of the smallest client (what it would be if window-size was smallest) and -A the largest. For the same behaviour as force-width or force-height, use resize-window -x or -y, and "setw -u window-size" to revert to automatic sizing.. If the global window-size option is set to manual, the default-size option is used for new windows. If -x or -y is used with new-session, that sets the default-size option for the new session. The maximum size of a window is 10000x10000. But expect applications to complain and much higher memory use if making a window excessively big. The minimum size is the size required for the current layout including borders. The refresh-client command can be used to pan around a window, -U -D -L -R moves up, down, left or right and -c returns to automatic cursor tracking. The position is reset when the current window is changed.
2018-08-20Add -Z to find-window as well.nicm
2018-08-02Make key trees and some other bits static.nicm
2018-02-28Add -Z flag to choose-tree, choose-client, choose-buffer tonicm
automatically zoom the pane when the mode is entered and unzoom when it exits, assuming the pane is not already zoomed. Add -Z to the default key bindings.
2017-11-15Add a common function for spreading out cells and use it for the twonicm
even layouts and to add a -E flag to select-layout to spread out cells evenly without changing parent cells.
2017-10-05Add -- to some key bindings so leading -s work.nicm
2017-09-08When removing a key table clear it out of clients, fixes issue withnicm
unbind -a reported by Thomas Sattler.
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.