-
Notifications
You must be signed in to change notification settings - Fork 6
Tmux Usage
Tmux is a highly customizable terminal multiplexer which can be used with many add-ons and own shortcuts.
Our Tmux configuration includes the following files which are responsible of different functionalities:
- Tmux bash functions, which are used as shortcuts to control the main functionalities of the Tmux server and TUI. It also contains a small piece of code that makes that a terminal that has just been created attaches to a tmux session if already exists or creates a new one if there are none. With this we
- Tmux .conf file, which is a configuration file that includes tmux directives that we customized. This is mainly the script that tells us how Tmux looks and behaves.
- Emoji bash function, which is a file that contains a small piece of code which obtains the current time and uses it to obtain the most adequate emoji of a clock for that given time. This script is called to generate the time emoji in our tmux bottom bar.
The first most important thing is that because Tmux works in Terminal it has the mouse deactivated by default, so you can not scroll. You can select text and copy text from a Tmux window by actually using the GUI interface of the terminal window that you are using, in my case gnome-terminal. You can not interact with the actual Tmux screen elements with the mouse in this mode.
To invert the mouse mode we can use the tm
function, which adds the line in tmux.conf
that makes Tmux use the mouse. You will need to reload Tmux configuration to see the effects with Prefix + r
afterwards. In the opposite way, if we have the mouse active by a configuration line in our tmux.conf
, activating the tm
function will result in the deletion of this line and after reloading configuration you will see that the mouse is now inactive.
We do recommend not mess up a lot with this function tm
in the same tmux session since a buggy behaviour in the mouse is observed if you activate / deactivate mouse too many times. You may close a tmux session with tks
function and have a fresh start if that happens with the configuration that you want, though.
In a Tmux window press Prefix
& [
, this will make you enter in copy-mode, which is a mode where you can scroll using:
- The arrow keys for character / line
-
Av Pag
/Re pag
keys for many lines.
You can scape copy mode by pressing q
- Select normally with the mouse if you are in a graphical environment. The terminal GUI interface that you are using will be the one displaying the menus, as when you do not have tmux installed.
- In a Tmux window enter in
copy-mode
, which is a mode where you can select, scroll and copy text. You can move with the arrow keys:- To start selecting press
Spacebar
(default) - To start selecting press
v
(vi-like)
- To start selecting press
- After normal selection,
right click
. The GUI interface of the terminal that you are using will show a drop-down menu where you can clickcopy
. - After normal selection,
Ctrl
+Shift
+c
. This will copy the selection to the system clipboard. - After selection in copy-mode, to copy the selection press
Enter
: This only copies to Tmux clipboard (default) - After selection in copy-mode, to copy the selection press
y
: This copies to tmux clipboard + system clipboard and exits copy mode (vi-like) - After selection in copy-mode, to copy the selection press
Ctrl
+c
: this copies to tmux clipboard + sytem clipboard and exits copy mode.
-
Right click
in the Tmux terminal after copying to system clipboard. The GUI interface of the terminal that you are using will show a drop-down menu where you can clickpaste
from the system clipboard. - After having copied to system clipboard use
ctrl
+shift
+v
to paste from it. - After having copied to Tmux clipboard use
prefix
&shift
+p
to paste from it. - After having copied to Tmux clipboard use
prefix
&]
to paste from it. - After having copied to system clipboard, use
prefix
&ctrl
+v
to inject its content into Tmux clipboard and then paste this content.
Axel (?)
-
tns
: Creates and attaches to as many sessions as arguments supplied, which will be the names for these sessions.
Best regards, and happy coding :)
- The Linux-Auto-Customizer Team