## Installation
```sh
brew install tmux
```
## Tmux Plugin Manager Installation
```sh
git clone https://github.com/tmux-plugins/tpm
```
## Tmux conf file
```conf: title=.tmux.conf
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin '
[email protected]:user/plugin'
# set -g @plugin '
[email protected]:user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
```
## Tmux Overview
Tmux has three main objects
1. Sessions
2. Windows
3. Panes
**Sessions:** The top most layer, you can have multiple sessions and each session is a collection of one or more windows
**Windows:** Windows can have multiple panes, you can think of tabs
**Panes:** These are splits in a single window
# Windows
## Create a window
To create a new window press
```
<prefix-key> c
```
## Change between windows
To go into the previous window
```
<prefix-key> p
```
To go to the next window
```
<prefix-key> n
```
To go to the n^th window
The number is displayed at the bottom
```
<prefix-key> <number>
```
To kill/delete the window
```
<prefix-key> &
```
# Panes
## Split Panes
To split the Pane vertically
```
<prefix-key> %
```
To split the Pane Horizontally
```
<prefix-key> "
```
## Switch between panes
Press the prefix key and then the arrow key in whichever direction you want to move
```
<prefix-key> <arrow-key>
```
You can also swap panes around by using `{` (left) or `}` (right) to move left or right
```
<prefix-key> {
```
Panes also have numbers which can be used to jump quickly
```
<prefix-key> q
```
Will reveal the numbers for each pane, then press the desired number to switch
## Make the pane take full space
To make the pane use full space
```
<prefix-key> z
```
To make the pane move out to a separate window
```
<prefix-key> !
```
## Close the Pane
```
<prefix-key> x
```
# Sessions
A new session can be created using the `tmux` command whilst not attached to a tmux session. This will create the new session and attach to it
To create a new session with a name
```sh
tmux new -s my-session
```
While you are in the tmux active session, a new session can be created using`:new` command
## List sessions
To list active sessions in tmux you can use
```sh
tmux ls
```
While you are in the tmux active session, you can use, and you can attach to it by pressing enter
```
<prefix-key> s
```
You can also use it to preview all the windows for each session, and you can attach to it by pressing enter
```
<prefix-key> w
```
## Attach to a session
When you run `tmux` it will attach to the recent session
If you want to specify which session it has to attach, you can specify
```sh
tmux -t my-session
```
## Install Plugin
To install plugin
```
<prefix-key> I
```