tmux and screen have different models so there is no exact equivalent.
In screen terms, a split lets you display multiple windows at the same time. next
(C-a n
) rotates windows through the active part of the split; this lets you rotate “hidden” windows through the active region of the split.
In tmux terms, a split divides a window into one or more panes. Each part of a split window is an individual pane, panes are never hidden (if a window is selected (visible) all its panes are, too), and a pane can only be used in a single split of one window (a pane can not be in multiple windows, and it can not be in multiple splits of the same window). There are commands to move panes around in (or between) windows, but not in an identical way to next
in screen.
You could use a binding like the following to arrange a similar effect:
bind-key C-n swap-pane -s :+.top \; rotate-window -Ut :+
You will probably want to put this in your ~/.tmux.conf
file, but you can just type/paste it after Prefix : to bind it in your current server instance.
To use the binding, pick your “main window”, split it, create a “pane container” window immediately after the “main window”, then use the binding to rotate any pane in the “main window” among the group in the “pane container” window.
Here is how you might create the setup:
Pick a window to use as your “main window”. Start (e.g.) Vim in it.
Split your “main window” into two panes.
E.g. Prefix " (:split-window
)
You can use this pane as your testing window (or log viewer, or whatever).
Create a new window (the “pane container”) immediately after your main window.
E.g. Prefix c (:new-window
)
It is important that no other window gets between the indexes of the “main window” and the “pane container” window (+
in the window specifiers used in the bound commands means “the next higher numbered window”).
Split this window into a number of panes. To rotate through three panes, split this window into two panes (the third pane is the one in the “main window”).
Maybe you need a shell for git, and a shell for running a database interface. Put each in a separate pane in this “pane container” window.
Switch back to your “main window”. Select the pane that you want to “rotate out”.
You can use Prefix Up/Down/Left/Right to move among the panes.
Invoke the binding to swap the current pane with the first pane in “pane container” window and (“behind the scenes”) rotate the panes inside the “pane container” window (so that the next time you run the binding, the first command swaps with the “next” pane in the sequence).
Prefix Control-n (the binding use C-n, but you could change this to whatever you like).
To scroll backwards through the panes, you can use the below:
bind-key C-p swap-pane -s :+.bottom \; rotate-window -Dt :+
Patches are usually contained in .diff
files, because the patches are created using the diff
command.
A patch is a series of insertions and deletions into source code. For this reason, in order to use the patch, you must build the application (e.g., "foobar") from source after applying the patch. So, in steps:
1. Get the source package for foobar.
Most linux distributions (n.b. patching is not unique to linux) have "source packages" you can use for this purpose, but since these are heterogeneous, I will only refer to the format of the original source here. The original source is not part of the distro and may be hard to find. A good place to start is wikipedia, which has articles for many popular applications, and the article should contain a link to a homepage with a source download. You can also google yourself, obviously. The source package will be called something like foobar.0.1.tar.bz2
. Unpack this -- you now have a directory called foobar.0.1
.
2. Add the patch.
Sometimes patches are single files and sometimes they are a set of several files. Copy those into foobar.0.1
and cd foobar.0.1
. Next, you need to run the patch
command. This reads from standard input, so you want to pipe the .diff
file in. The tricky part is determining what to use for the -p
option (if there are no instructions with the patch). To do that you need to look at the beginning of the patch file. For example:
--- old/comm.c 2003-09-08 14:25:08.000000000 +0000
+++ new/comm.c 2006-07-07 02:39:24.000000000 +0000
In this case, comm.c
is the name of the source file that will be altered. However, notice that there is a directory appended to it. Since these are not the same directory ("old" vs. "new"), this is a big clue that this part of the path is junk (for our purposes). The purpose of the -p
switch (see man patch
) is to eliminate this prefix. It takes a number, which is the number of slashes (/
) to eliminate, with everything in between; in this case we would use -p1
to reduce the path to just plain comm.c
.
That presumes comm.c
is actually in the same directory, which will be another clue as to whether your interpretation is correct. If both those lines were src/comm.c
, and comm.c
is actually in the src
subdirectory of your build tree, then you need to use -p0
-- beware that not using -p
at all will remove ALL slashes. If the path is absolute (i.e., begins with /
), that's probably what you want. Now apply the patch:
patch -p1 < patch.diff
The source has now been modified. If there are more .diff
files, apply those the same way.
3. Build and install.
This is the normal process you would go through to build something from source -- first ./configure
, then make
, make check
, make install
. Before you do the last one, if you already have an existing installation of foobar
, decide whether you want to remove or overwrite that or how you are going to deal with the naming conflict. You probably want foobar
to refer to your new, patched version, and not the old one.
Best Answer
You might want to take a look into patchutils [1]. For the vim part, I wrote a small vim plugin that helps with navigating in patches: diff_navigator [2].
[1] http://cyberelk.net/tim/software/patchutils/
[2] http://www.vim.org/scripts/script.php?script_id=2361