Commit Graph

112 Commits (dd3c72f132c911b0ba61b56a56f46510704d3392)

Author SHA1 Message Date
Thomas Adam 7922f4ee7b Merge branch 'obsd-master' 2019-12-12 14:33:47 +00:00
nicm 5134666702 Change source-file to use new file code which allows it to read from
stdin.
2019-12-12 12:49:36 +00:00
Thomas Adam 5b2048fbb9 Merge branch 'obsd-master' 2019-12-10 16:01:25 +00:00
nicm 55eb3e4773 Make TMUX_CONF a list of files and expand leading $FOO or ~. 2019-12-10 14:22:15 +00:00
Thomas Adam 03945276f7 Merge branch 'obsd-master' 2019-06-20 09:02:26 +01:00
nicm ae541287d3 Expand command formats in %if and move the config file loading later (to
when the first client has identified) so all the client formats are
available, fixes problems reported by Thomas Sattler.
2019-06-20 06:51:36 +00:00
Thomas Adam ee9bc355f5 Merge branch 'obsd-master' 2019-06-18 13:02:28 +01:00
nicm 9272fe36e2 Add a cmdq_continue function rather than twiddling the flag directly. 2019-06-18 11:08:42 +00:00
Thomas Adam c91680822d Merge branch 'obsd-master' 2019-06-05 23:02:26 +01:00
nicm 8f40796f05 Add a -v flag to source-file to show the commands and line numbers. 2019-06-05 20:00:53 +00:00
Thomas Adam 19a3a9ee20 Merge branch 'obsd-master' 2019-05-23 21:02:30 +01:00
nicm f3e01ecc42 Fix line numbers - commands are added after the line ends so they need to
get line - 1.
2019-05-23 18:39:00 +00:00
Thomas Adam 75aeb733f2 Merge branch 'obsd-master' 2019-05-23 13:02:27 +01:00
nicm 723010ba72 Replace the split parser code (cfg.c and cmd-string.c) with a single
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-23 11:13:30 +00:00
Thomas Adam 98ee93bde3 Merge branch 'obsd-master' 2019-05-20 15:02:40 +01:00
nicm 87d82170a6 Fix ordering of source-file with multiple files and add flags to load_cfg. 2019-05-20 13:23:32 +00:00
Thomas Adam d4177e954c Merge branch 'obsd-master' 2019-05-03 23:02:28 +01:00
nicm 45ae9a8e35 Fix order of insertion in load_cfg. 2019-05-03 21:21:00 +00:00
Thomas Adam 3c1f0cfc34 Merge branch 'obsd-master' 2019-04-18 14:08:13 +01:00
nicm 3f189945d8 Pass target client and session to load_cfg from source-file so formats
work. Reported by Thomas Sattler.
2019-04-18 11:07:28 +00:00
Thomas Adam cb039b986e Merge branch 'obsd-master' 2019-04-03 09:02:41 +01:00
nicm f6c54f3f03 Do not load /etc/tmux.conf if given -f. 2019-04-03 06:43:19 +00:00
Thomas Adam 3ec05e9405 Merge branch 'obsd-master' 2019-03-12 12:02:42 +00:00
nicm 3f6bfbaf2b Allow multiple modes to be open in a pane. A stack of open modes is kept
and the previous restored when the top is exited. If a mode that is
already on the stack is entered, the existing instance is moved to the
top as the active mode rather than being opened new.
2019-03-12 11:16:49 +00:00
Thomas Adam bc72cf2f52 Merge branch 'obsd-master' 2019-03-08 12:02:39 +00:00
nicm de730f68a4 Make the mode used to view command output (a variant of copy mode) use
its own mode definition struct with a different init function rather
than calling special setup functions.
2019-03-08 10:34:20 +00:00
Thomas Adam a1009e7bd3 Merge branch 'obsd-master' 2019-03-07 20:02:41 +00:00
nicm 3c24bc5617 Tidy changing the mode into window_copy_init_for_output. 2019-03-07 19:34:22 +00:00
Thomas Adam fa8294436c Merge branch 'obsd-master' 2019-02-16 14:02:37 +00:00
nicm 82f0c859a2 Use starting client cwd in config file, GitHub issue 1606. 2019-02-16 11:42:08 +00:00
Thomas Adam 84ddc72744 Merge branch 'obsd-master' 2018-01-17 11:26:10 +00:00
nicm 481703d669 Some unused code, GitHub issue 1219. 2018-01-15 15:27:03 +00:00
Thomas Adam f069c0ba09 Merge branch 'obsd-master' 2017-10-06 20:01:17 +01:00
nicm 9c4caf49a2 Support %else in config files to match %if, from Brad Town in GitHub
issue 1071.
2017-10-06 18:02:30 +00:00
Nicholas Marriott 35008200bd Differences to OpenBSD. 2017-05-31 16:34:39 +01:00
Thomas Adam f17ecaa495 Merge branch 'obsd-master'
Conflicts:
	Makefile.am
	cfg.c
	server-client.c
2017-05-31 15:56:13 +01:00
nicm aad4e4ddb1 Rewrite of choose mode, both to simplify and tidy the code and to add
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-30 21:44:59 +00:00
Thomas Adam e354b0e40f Merge branch 'obsd-master' 2017-05-01 14:01:14 +01:00
nicm 0ccfb61bb0 In order that people can use formats like #D in #() in the status line
and not have to wait for an update when they change pane, we allow
commands to run more than once a second if the expanded form
changes. Unfortunately this can mean them being run far too often
(pretty much continually) when multiple clients exist, because some
formats (including #D) will always differ between clients.

To avoid this, give each client its own tree of jobs which means that
the same command will be different instances for each client - similar
to how we have the tag to separate commands for different panes.

GitHub issue 889; test case reported by Paul Johnson.
2017-05-01 12:20:55 +00:00
Thomas Adam 65d6278f88 Merge branch 'obsd-master' 2017-04-25 18:01:11 +01:00
nicm 4a51a9d9d5 Block the initial client if there is one until the configuration file
has finished loading.
2017-04-25 14:46:23 +00:00
Thomas Adam 4612419c14 Merge branch 'obsd-master' 2017-04-21 16:01:18 +01:00
nicm 428be9803c History needs to be loaded after config parsing is done - now that
commands are queued, that's in cfg_done not after start_cfg finishes.
2017-04-21 14:04:54 +00:00
nicm 311dad8c28 Do not run the config file in the context of the first client, instead
use no client like we did before. This means commands like new-session
won't try to attach if they are in the config file.
2017-04-21 13:15:43 +00:00
Thomas Adam 5f662d91db Merge branch 'obsd-master'
Conflicts:
	server-client.c
	tmux.1
2017-04-06 11:10:17 +01:00
nicm ab4a4b2ad0 cfg_file can be static. 2017-04-05 10:45:39 +00:00
Thomas Adam 6c333cc486 Merge branch 'obsd-master' 2017-02-03 14:01:13 +00:00
nicm 7d23d019c0 Add a window or pane id "tag" to each format tree and use it to separate
jobs, this means that if the same job is used for different windows or
panes (for example in pane-border-format), it will be run separately for
each pane.
2017-02-03 11:57:27 +00:00
Thomas Adam 7b60645732 Merge branch 'obsd-master' 2017-01-16 00:01:10 +00:00
nicm 52847a9518 It is silly for cmd_list_parse to return an integer error when it could
just return NULL.
2017-01-15 22:00:56 +00:00