Commit Graph

426 Commits (934f357149dba903f091237e7ea7c7ba78471614)

Author SHA1 Message Date
Nicholas Marriott 43cd40e87a The cursession member in struct cmd_ctx is always either curclient->session or
NULL when curclient is also NULL, so just eliminate it.
2009-08-23 16:45:00 +00:00
Tiago Cunha 29b1b2fb5e Sync OpenBSD patchset 231:
Infrastructure and commands to manage the environment for processes started
within tmux.

There is a global environment, copied from the external environment when the
server is started and each session has an (initially empty) session
environment which overrides it.

New commands set-environment and show-environment manipulate or display the
environments.

A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.
2009-08-09 17:48:55 +00:00
Nicholas Marriott 6491274f60 Infrastructure and commands to manage the environment for processes started
within tmux.

There is a global environment, copied from the external environment when the
server is started and each sesssion has an (initially empty) session
environment which overrides it.

New commands set-environment and show-environment manipulate or display the
environments.

A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.
2009-08-08 21:52:43 +00:00
Tiago Cunha 1650b8552f Sync OpenBSD patchset 200:
Merge pane number into the target specification for pane commands. Instead of
using -p index, a target pane is now addressed with the normal -t window form
but suffixed with a period and a pane index, for example :0.2 or
mysess:mywin.1. An unadorned number such as -t 1 is tried as a pane index in
the current window, if that fails the same rules are followed as for a target
window and the current pane in that window used.

As a side-effect this now means that swap-pane can swap panes between
different windows.

Note that this changes the syntax of the break-pane, clear-history, kill-pane,
resize-pane, select-pane and swap-pane commands.
2009-07-30 20:45:20 +00:00
Tiago Cunha 8ce1f0b047 Sync OpenBSD patchset 197:
Add an additional heuristic to work out the current session when run from the
command line. The name of all slave ptys in the server is known, so if the
client was run on a tty, look for any sessions containing that tty and use the
most recently created.

This is more reliable than looking at $TMUX if windows have been moved or
linked between sessions.
2009-07-30 20:26:20 +00:00
Nicholas Marriott 071494d8fa Merge pane number into the target specification for pane commands. Instead of
using -p index, a target pane is now addressed with the normal -t window form
but suffixed with a period and a pane index, for example :0.2 or
mysess:mywin.1. An unadorned number such as -t 1 is tried as a pane index in
the current window, if that fails the same rules are followed as for a target
window and the current pane in that window used.

As a side-effect this now means that swap-pane can swap panes between different
windows.

Note that this changes the syntax of the break-pane, clear-history, kill-pane,
resize-pane, select-pane and swap-pane commands.
2009-07-30 13:45:56 +00:00
Nicholas Marriott 2b331084b4 Add an additional heuristic to work out the current session when run from the
command line. The name of all slave ptys in the server is known, so if the
client was run on a tty, look for any sessions containing that tty and use the
most recently created.

This is more reliable than looking at $TMUX if windows have been moved or
linked between sessions.
2009-07-29 17:03:16 +00:00
Tiago Cunha d637cb33da Sync OpenBSD patchset 181:
Make all messages sent between the client and server fixed size.

This is the first of two changes to make the protocol more resilient and less
sensitive to other changes in the code, particularly with commands. The client
now packs argv into a buffer and sends it to the server for parsing, rather
than doing it itself and sending the parsed command data.

As a side-effect this also removes a lot of now-unused command marshalling
code.

Mixing a server without this change and a client with or vice versa will cause
tmux to hang or crash, please ensure that tmux is entirely killed before
upgrading.
2009-07-28 22:12:16 +00:00
Nicholas Marriott 34a82e7629 Make all messages sent between the client and server fixed size.
This is the first of two changes to make the protocol more resilient and less
sensitive to other changes in the code, particularly with commands. The client
now packs argv into a buffer and sends it to the server for parsing, rather
than doing it itself and sending the parsed command data.

As a side-effect this also removes a lot of now-unused command marshalling
code.

Mixing a server without this change and a client with or vice versa will cause
tmux to hang or crash, please ensure that tmux is entirely killed before
upgrading.
2009-07-26 12:58:44 +00:00
Tiago Cunha 2386fa2355 Sync OpenBSD patchset 178:
cmd_find_index should return -2 on error.
2009-07-25 08:59:38 +00:00
Nicholas Marriott c6dac5c3c9 cmd_find_index should return -2 on error. 2009-07-24 18:46:40 +00:00
Tiago Cunha fb0301f8b8 Sync OpenBSD patchset 164:
Tidy the target parsing code a bit and correct the behaviour so that as before
a string with no colon as a target window is first looked up as a window then
as a session, noted by Iain Morgan.

Also attempt to clarify the description of the target specification in the man
page.
2009-07-23 13:06:31 +00:00
Nicholas Marriott f7df0bac96 Tidy the target parsing code a bit and correct the behaviour so that as before
a string with no colon as a target window is first looked up as a window then
as a session, noted by Iain Morgan.

Also attempt to clarify the description of the target specification in the man
page.
2009-07-22 21:23:29 +00:00
Nicholas Marriott 48c36d628a No paths.h in cmd.c; add _PATH_DEV for Solaris. 2009-07-21 13:07:50 +00:00
Nicholas Marriott 6f5150a943 - New command display-message (alias display) to display a message in the
status line (bound to "i" and displays the current window and time by
  default). The same substitutions are applied as for status-left/right.
- Add support for including the window index (#I), pane index (#P) and window
  name (#W) in the message, and status-left or status-right.
- Bump protocol version.

From Tiago Cunha, thanks!
2009-07-17 18:45:08 +00:00
Tiago Cunha ae7dda10ce - New command display-message (alias display) to display a message in the
status line (bound to "i" by default).
- Add support for including the window index, pane index, and window name
  in status-left, or status-right.
- Bump protocol version.
2009-07-17 18:32:54 +00:00
Nicholas Marriott 770ea563ee Changed the wrong thing here. 2009-07-17 15:56:46 +00:00
Nicholas Marriott d6908dd9c2 Return -1 not NULL on error, pointed out by Roy Marples. 2009-07-15 17:46:09 +00:00
Nicholas Marriott ac2ab6501d Add a -k flag to unlink-window which makes it behave the same as the old
kill-window - if a window is linked into only one session it unlinked and
destroyed.
2009-07-15 17:45:29 +00:00
Nicholas Marriott 780fd8f7a6 Return -1 not NULL on error, pointed out by Roy Marples. 2009-07-15 15:09:17 +00:00
Nicholas Marriott d358a352c0 Tidy up and improve target (-t) argument parsing:
- move the code back into cmd.c and merge with the existing functions where
  possible;
- accept "-tttyp0" as well as "-t/dev/ttyp0" for clients;
- when looking up session names, try an exact match first, and if that fails
  look for it as an fnmatch pattern and then as the start of a name - if more
  that one session matches an error is given; so if there is one session called
  "mysession", -tmysession, -tmysess, -tmysess* are equivalent but if there
  is also "mysession2", the last two are errors;
- similarly for windows, if the argument is not a valid index or exact window
  name match, try it against the window names as an fnmatch pattern and a
  prefix.
2009-07-14 06:42:06 +00:00
Nicholas Marriott 023d8d38ec Tidy up and improve target (-t) argument parsing:
- move the code back into cmd.c and merge with the existing functions where
  possible;
- accept "-tttyp0" as well as "-t/dev/ttyp0" for clients;
- when looking up session names, try an exact match first, and if that fails
  look for it as an fnmatch pattern and then as the start of a name - if more
  that one session matches an error is given; so if there is one session called
  "mysession", -tmysession, -tmysess, -tmysess* are equivalent but if there
  is also "mysession2", the last two are errors;
- similarly for windows, if the argument is not a valid index or exact window
  name match, try it against the window names as an fnmatch pattern and a
  prefix.
2009-07-13 17:47:46 +00:00
Nicholas Marriott eee3dd297e New command, if-shell (alias if). Executes the tmux command in the second
argument if the shell command in the first succeeds, for example:

       if "[ -e ~/.tmux.conf.alt ]" "source .tmux.conf.alt"

Written by Tiago Cunha, many thanks.
2009-07-09 18:14:18 +00:00
Nicholas Marriott 81181bfb72 New command, if-shell (alias if). Executes the tmux command in the second
argument if the shell command in the first succeeds, for example:

       if "[ -e ~/.tmux.conf.alt ]" "source .tmux.conf.alt"

Written by Tiago Cunha, many thanks.
2009-07-09 15:47:49 +00:00
Nicholas Marriott 2ddcb51df3 Fix $Id$. 2009-07-08 18:03:03 +00:00
Nicholas Marriott a182502af0 Don't let ambiguous commands override an exact alias match: eg if commands
"abc-1", "abc-2", "abc-3" exist and "abc-3" has the alias "abc", "tmux abc"
should execute abc-3, not complain about the command being ambiguous.
2009-07-08 18:01:55 +00:00
Nicholas Marriott b4efd1ca89 Don't let ambiguous commands override an exact alias match: eg if commands
"abc-1", "abc-2", "abc-3" exist and "abc-3" has the alias "abc", "tmux abc"
should execute abc-3, not complain about the command being ambiguous.

Not a problem at the moment but will be soon.
2009-07-07 21:23:22 +00:00
Nicholas Marriott a5830b9603 Restore $Id$ and add script to do so. 2009-06-25 16:21:32 +00:00
Nicholas Marriott b9155e835a Print a better message than '(null)' if no command is specified ("tmux \;"). 2009-06-25 15:56:39 +00:00
Nicholas Marriott 85e0d8a221 Print a better message than '(null)' if no command is specified ("tmux \;"). 2009-06-04 23:34:32 +00:00
Nicholas Marriott 35876eaab9 Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti
2009-06-01 22:58:49 +00:00
Nicholas Marriott 1001902143 select-layout command and some key bindings. 2009-05-16 11:48:47 +00:00
Nicholas Marriott 96ca072482 clear-history command. 2009-05-14 16:56:23 +00:00
Nicholas Marriott 143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott 044e6f7660 previous-layout command. 2009-04-30 21:17:06 +00:00
Nicholas Marriott cdf472f2de Merge resize-pane-{up,down} into resize-pane. 2009-04-30 06:01:24 +00:00
Tiago Cunha 058772e4e6 - confirm-before command.
- Bound "&" and "x" by default to confirm-before "kill-window" and
  confirm-before "kill-pane", respectively.
2009-04-27 13:21:16 +00:00
Nicholas Marriott 325d43e417 rotate-window command. 2009-04-03 17:21:46 +00:00
Nicholas Marriott 8216f7b3d9 swap-pane command. 2009-04-02 23:28:16 +00:00
Nicholas Marriott b6450b167b Basic horizontal splitting and layout management. Still some redraw and other
issues - particularly, don't mix with manual pane resizing and be careful when
viewing from multiple clients; generally cycling the layout a few times will
fix most problems. Getting this in for testing while I think about how to deal
with manual mode.

Split window as normal and cycle the layouts with C-b space. Some of the
layouts will work better when swap-pane comes along.
2009-04-01 18:21:42 +00:00
Nicholas Marriott 56f80a5b09 break-pane command to split a pane off into a new window; bound to ! by default. 2009-03-07 09:29:54 +00:00
Tiago Cunha 4213ff8faa copy-buffer command. 2009-02-03 17:21:19 +00:00
Tiago Cunha f62ed6aaa3 load-buffer command 2009-01-25 19:00:10 +00:00
Nicholas Marriott 93230a64bc Pass return code from _exec; allow command sequences to work from the command line. 2009-01-19 18:23:40 +00:00
Nicholas Marriott 3efd1f5014 find-window command. 2009-01-18 17:20:52 +00:00
Nicholas Marriott a15f8fc4a6 Support command sequences separated by " ; ". Also clean up command printing. 2009-01-18 14:40:48 +00:00
Nicholas Marriott 8ea49712fd suspend-client command and suspend client when ^Z key binding is used. 2009-01-18 12:09:42 +00:00
Nicholas Marriott d29ca39e0e Two new commands, choose-window and choose-session which work only when bound to a key and allow the window or session to be selected from a list. 2009-01-15 19:27:31 +00:00
Nicholas Marriott d1eb153368 switch-pane is now select-pane. 2009-01-14 19:56:55 +00:00
Nicholas Marriott 3f51dcdfc3 up-pane and down-pane commands. 2009-01-14 19:41:15 +00:00
Nicholas Marriott f85559144f kill-pane command. 2009-01-13 06:50:10 +00:00
Nicholas Marriott c35a50b21a Commands to resize panes; also a pane generic cmd, not used yet. 2009-01-12 19:23:14 +00:00
Nicholas Marriott 162bacdcd9 Window splitting. Two vertical panes fixed 50% each. This is a huge diff, still a couple of bugs (notably heap corruption somewhere causing segfault on exit). 2009-01-11 23:31:46 +00:00
Nicholas Marriott d78bc5dfc4 save-buffer command, from Tiago Cunha. 2009-01-11 23:14:57 +00:00
Nicholas Marriott e3feb067a5 Server locking. set-password and lock-server commands, plus automatic locking. 2009-01-11 00:48:42 +00:00
Nicholas Marriott 88ab74ac20 Clock mode. 2009-01-10 19:35:40 +00:00
Nicholas Marriott a1b43faa43 Trim spaces. 2009-01-10 01:51:22 +00:00
Nicholas Marriott fb6c8ecae6 New command, server-info, to show server info + terminal details. Also tweak term stuff a bit. 2009-01-10 01:30:38 +00:00
Nicholas Marriott 4af8db90e8 Complete option names as well. 2009-01-06 17:04:56 +00:00
Nicholas Marriott 5445918b3e source-file command from Tiago Cunha. 2008-12-15 21:21:56 +00:00
Nicholas Marriott 5c3d973a4a Import OpenBSD's getopt(3) to workaround broken glibc version. 2008-12-10 20:25:42 +00:00
Nicholas Marriott 62457bce0b Trim. 2008-09-26 06:45:28 +00:00
Nicholas Marriott df2b3bcf44 Fix stupid GNU getopt behaviour. 2008-09-25 23:28:15 +00:00
Nicholas Marriott 33aa931541 Support OS X by moving to gettimeofday(2) and adding poll compat from OpenSSH. 2008-08-28 17:45:30 +00:00
Nicholas Marriott 403b1b27ab Handle exact match properly. 2008-07-19 10:07:50 +00:00
Nicholas Marriott e5cf8594e8 long for pid. 2008-07-01 20:35:16 +00:00
Nicholas Marriott d90d646ca8 Zombie windows, requested by Will Maier. 2008-06-29 07:04:31 +00:00
Nicholas Marriott 571935c823 Handle bad session/client properly. 2008-06-27 17:10:01 +00:00
Nicholas Marriott b87789707b Oops, forgot to commit move-window. Also add select-prompt to allow index to be typed. 2008-06-25 20:43:14 +00:00
Nicholas Marriott 7836298f29 Allow use of alt keys. move-window command. 2008-06-25 20:33:20 +00:00
Nicholas Marriott 59da4dce67 list-commands command. 2008-06-23 22:24:16 +00:00
Nicholas Marriott c24d849fa4 Split options into a table to allow abbreviations. 2008-06-23 07:41:21 +00:00
Nicholas Marriott 76019e1d52 If one match, add trailing space. 2008-06-21 14:16:30 +00:00
Nicholas Marriott e70e9513a8 Simple tab completion of option names in command prompt. 2008-06-21 14:11:39 +00:00
Nicholas Marriott 4e4f71febb Swap in new paste buffer code and add a couple more commands. 2008-06-20 17:31:48 +00:00
Nicholas Marriott 9798dcd4df Start of improved buffer code. Only set-buffer/show-buffer commands so far. 2008-06-20 08:36:20 +00:00
Nicholas Marriott 74d8f0bf1d Command prompt for interactive commands. 2008-06-19 20:45:21 +00:00
Nicholas Marriott 99df48d70f Trimify. 2008-06-18 22:21:51 +00:00
Nicholas Marriott ff21dbd58b Explanation of -t. 2008-06-16 22:03:27 +00:00
Nicholas Marriott 4c166484f4 Memory leak/missing init. 2008-06-16 07:01:41 +00:00
Nicholas Marriott 1d0810547f show-window-options command. 2008-06-16 06:10:02 +00:00
Nicholas Marriott 557b6b86b0 Add a couple of extra option types, and implement show-options command. 2008-06-15 08:01:54 +00:00
Nicholas Marriott 197347b61f Don't bork on link/swap the same window. Also extend comment. 2008-06-05 22:59:38 +00:00
Nicholas Marriott 0b9b873a55 Big reorganisation of command-line syntax. 2008-06-05 21:25:00 +00:00
Nicholas Marriott 642c0b00ab Easy bits of arg printing for list-keys. 2008-06-05 16:35:32 +00:00
Nicholas Marriott 0f95671fe3 Disable/enable window activity monitoring with set-window-option command. 2008-06-04 17:54:27 +00:00
Nicholas Marriott 73c9b25d2d It is too easy to create things in the same second; use a timespec instead. 2008-06-03 18:13:54 +00:00
Nicholas Marriott 743956edf8 Allow -c anywhere -s was allowed. 2008-06-03 16:55:09 +00:00
Nicholas Marriott 3e6b145923 Allow fnmatch(3) on -s, and select newest session if multiple. 2008-06-03 05:47:09 +00:00
Nicholas Marriott eaee4dc800 Quick and dirty kill-server command. 2008-06-03 05:10:38 +00:00
Nicholas Marriott a26f58c7c3 Last bits of basic configuration file. By default in ~/.tmux.conf or specified with -f. Just a list of tmux commands executed when the server is started and before and any session/window is created. 2008-06-02 21:08:36 +00:00
Nicholas Marriott c7243b73cb Move -s and -c down a level so handling them is the responsibility of the command (with some helper functions), rather than the top-level. This changes the action command syntax so that -s and -c must be after the command rather than before. 2008-06-02 18:08:17 +00:00
Nicholas Marriott 65f4284e7f New command, send-keys, to send a set of keys. 2008-06-01 20:20:25 +00:00
Nicholas Marriott 103748d6ad Major reorganisation of screen handling. 2007-12-06 09:46:23 +00:00
Nicholas Marriott 8da0b1fb99 Mostly-complete copy and paste. 2007-11-23 17:52:54 +00:00
Nicholas Marriott 18d72e6928 Partial copy mode. Currently does the same as scroll mode but using a cursor. Also fix bug where resizing would leave crap lying around. 2007-11-22 18:09:43 +00:00
Nicholas Marriott 9a6e47cfa8 Initial history support. 2007-11-21 13:11:41 +00:00
Nicholas Marriott 6e04524596 switch-client command. 2007-11-16 21:31:03 +00:00
Nicholas Marriott b359f9b594 Add -c option to specify client, and move detach/refresh to client rather than session. 2007-11-16 21:12:31 +00:00
Nicholas Marriott ce5f02fc9e Report available commands on ambiguous commands. Tidy TODO a bit. 2007-11-16 13:23:59 +00:00
Nicholas Marriott e4a6cdefda kill-window command. 2007-11-12 14:21:41 +00:00
Nicholas Marriott 16321270c8 rename-session command. 2007-11-09 11:02:01 +00:00
Nicholas Marriott 48ad0431fb swap-window command. 2007-10-30 11:10:33 +00:00
Nicholas Marriott 941eab33e9 %u -> %d for indexes. Some lint fixes. 2007-10-30 10:59:43 +00:00
Nicholas Marriott 4a325c8f93 unlink-window command. Also fix some u_int -> int problems. 2007-10-26 16:57:32 +00:00
Nicholas Marriott 5a954bd9bd link-window command to link a window into another session. 2007-10-26 13:03:59 +00:00
Nicholas Marriott 9f06104c3a has-session command. 2007-10-25 17:44:25 +00:00
Nicholas Marriott 25e94a0526 List client command. 2007-10-23 09:36:19 +00:00
Nicholas Marriott 1b9647669a Kill window command. Nuke some backspace stuff. 2007-10-19 11:10:35 +00:00
Nicholas Marriott 94f003bbec Refresh session command. 2007-10-19 09:21:26 +00:00
Nicholas Marriott 514d6fa1ec Accept colours as strings. 2007-10-12 13:51:44 +00:00
Nicholas Marriott f3404ee922 send-prefix command. 2007-10-12 13:03:58 +00:00
Nicholas Marriott 26b340964a Lose command index enum in favour of runtime-calculated index. 2007-10-04 22:04:01 +00:00
Nicholas Marriott 75e1e4b91e Lose usage and move it into the struct. 2007-10-04 21:48:11 +00:00
Nicholas Marriott 68a5d5c00b Window attachment, malloc debugging, fix a segfault with no sessions. 2007-10-04 11:52:03 +00:00
Nicholas Marriott ff56ed7bd6 Nuke ?. 2007-10-04 11:23:17 +00:00
Nicholas Marriott 225e07fe38 Select window command. 2007-10-04 10:54:21 +00:00
Nicholas Marriott 19c1e1a800 Rename window. 2007-10-04 10:39:07 +00:00
Nicholas Marriott 57157a1cde set-option command to set meta. 2007-10-04 10:11:32 +00:00
Nicholas Marriott 774b556669 Key binding and unbinding. 2007-10-04 09:30:53 +00:00
Nicholas Marriott 7ba01f6843 New window command. 2007-10-03 23:32:26 +00:00
Nicholas Marriott df716ecc8f Rewrite command handling to be more generic. Not finished! 2007-10-03 21:31:07 +00:00
Nicholas Marriott aaa98ab4a2 Rename some bits. 2007-10-03 12:43:47 +00:00
Nicholas Marriott fe06744d66 String/number arguments.. 2007-10-03 12:34:16 +00:00
Nicholas Marriott dadc56d754 Key binding, unbinding. 2007-10-03 11:26:34 +00:00
Nicholas Marriott 9bb907f2a7 Move command handling into the server and tidy up some bits. 2007-10-03 10:18:32 +00:00