summaryrefslogtreecommitdiffstats
path: root/cmd.c
AgeCommit message (Collapse)Author
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-04-22Get rid of the extra layer of flags and cmd_prepare() and just store thenicm
CMD_FIND_* flags in the cmd_entry and call it for the command. Commands with special requirements call it themselves and update the target for hooks to use.
2017-04-21Make the cmd_find_* functions more obvious when looking for a client,nicm
rather than having it inside other functions. Should be no change to the way targets are resolved just yet.
2017-01-24server-info can become an alias rather than a command.nicm
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-10Need to escape ; twice because the command list parser will eat one,nicm
reported by Theo Buehler.
2017-01-10Quote backslash as well for %%%.nicm
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-28Fix the prefer unattached session behaviour ofnicm
attach-session/switch-client, reported by Thomas Sattle.
2016-11-02Make an empty state on error rather than leaving something partiallynicm
created (which now is now a fatal() later).
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-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-13Some improvements and bug fixes for hooks:nicm
- Prepare the state again before the "after" hooks are run, because the command may have killed or moved windows. - Use the hooks list from the newly prepared target, not the old hooks list (only matters for new-session really). - Correctly detect an invalid current state and ignore it in cmd_find_target ("killw; swapw"). - Change neww, new, killp, killw, splitw, swapp, swapw to update the current state (used if no explicit target is given) to something more useful after they have finished. For example, neww changes it to the newly created window. Hooks are still relatively new and primitive so there are likely to be more changes to come. Parts based on bug reports from Uwe Werler and Iblis Lin.
2016-10-05Allow cmd_mouse_at return arguments to be NULL.nicm
2016-03-01Remove some more unused variables, and use RB_FOREACH_SAFE innicm
key_bindings_unref_table.
2016-01-19Split out getting the current state from the target search so it can benicm
replaced if we already know the current.
2016-01-19I no longer use my SourceForge address so replace it.nicm
2015-12-14Use cmd_find_clear_state instead of an extra function doing the same.nicm
2015-12-14Instead of combined flags for -c, -s, -t, split into different setsnicm
using an enum and simplify the parsing code.
2015-12-13Use member names in cmd_entry definitions so I stop getting confusednicm
about the order.
2015-12-13Actually I thought cmd_get_state_client was unnecessary but it will benicm
needed.
2015-12-13-c needs to be able for fail for display-message.nicm
2015-12-13Remove an unnecessary function.nicm
2015-12-13Don't log an error when doing the first check for move-window.nicm
2015-12-13Change cmd_find_target to use a state struct from the caller.nicm
2015-12-13Remove the cmd_find_{session,window,pane,index} functions (which arenicm
just wrappers around cmd_find_target) and just use cmd_find_target directly.
2015-12-13Move logging into cmd_find_target rather than each function.nicm
2015-12-13Instead of every command resolving the target (-t or -s) itself, preparenicm
the state (client, session, winlink, pane) for it it before entering the command. Each command provides some flags that tell the prepare step what it is expecting. This is a requirement for having hooks on commands (for example, if you hook "select-window -t1:2", the hook command should to operate on window 1:2 not whatever it thinks is the current window), and should allow some other target improvements. The old cmd_find_* functions remain for the moment but that layer will be dropped later. Joint work with Thomas Adam.
2015-12-08Add hooks infrastructure, basic commands (set-hook, show-hooks) and anicm
couple of not very useful client hooks. This will eventually let commands be run at various points and on notifications. Joint work with Thomas Adam.
2015-11-27Do not set a limit on the length of commands when printing them.nicm
2015-09-01All the cmd_*_entry declarations do not need to be in tmux.h.nicm
2015-04-27Rewrite of the target resolution internals to be simpler and morenicm
consistent but with much less duplication, but keeping the same internal API. Also adds more readable aliases for some of the special tokens used in targets (eg "{start}" instead of "^"). Some behaviours may have changed, for example prefix matches now happen before fnmatch.
2015-04-25Make message log a TAILQ.nicm
2015-04-25Move the functions to convert ids from strings into session.c and window.c.nicm
2015-04-24Convert clients list into a TAILQ.nicm
2015-04-21Look up indexes as number before name, makes more sense if windows arenicm
named starting with numbers. From Thomas Adam.
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-08Add xreallocarray and remove nmemb argument from xrealloc.nicm
2014-09-25Support using pane id as part of session or window specifier (so %1nicm
means session-of-%1 or window-of-%1) and window id as part of session (so @1 means session-of-@1).
2014-09-25Support ! for last pane.nicm
2014-07-13Show an error if cmd_find_session can't find the current session, likenicm
the other functions.
2014-05-13If multiple arguments are given to new-session, new-window,nicm
split-window, respawn-window or respawn-pane, pass them directly to execvp() to help avoid quoting problems. One argument still goes to "sh -c" like before. Requested by many over the years. Patch from J Raynor.
2014-05-09Just use char ** for argv like normal people, not char *const *.nicm
2014-04-16Remove the choose-list command to prepare for some later choose-* work.nicm
2014-03-31Don't write into buffer if no arguments, reported by Filipe Rosset.nicm
2014-01-09Allow attach-session -t to accept a window and pane to select them onnicm
attach. Based on a diff from J Raynor.
2013-10-10We accidentally haven't been using $TMUX to work out the session for anicm
while and in fact it is less useful that using the client ttyname. So don't bother and don't pass it from the client. If we need it in future it is in c->environ.
2013-10-10Remove now unused cmd_get_default_path.nicm