├── README.md
├── install.png
└── tmux.conf
/README.md:
--------------------------------------------------------------------------------
1 | # tmux-tutorial
2 | Tutorial Link: [Youtube](https://www.youtube.com/watch?v=8CFmwNtW8M4), [Bilibili](https://www.bilibili.com/video/BV1Mj411N7xS/)
3 | ## Installation:
4 |
5 | image source: [here](https://github.com/tmux/tmux/wiki/Installing)
6 |
7 | ## Useful terminal commands
8 | Feel free to set your own alias
9 | | Cmd | Description |
10 | | ---- | -------- |
11 | | man tmux | show tmux documentation |
12 | | tmux new -s `[Session Name]` | create a new tmux session |
13 | | tmux a -t `[Session Name]` | attach to an existing session |
14 | | tmux detach | detach current session |
15 | | tmux kill-session -t `[Session Name]` | Delete a specific Session |
16 |
17 |
18 | ## My Session Shortcut
19 | Remember to use these shortcuts inside a tmux session, not normal terminal.
20 | My prefix key is `Ctrl-b` or `C-b`, you can map it other keys.
21 | All key remappings and options setting go into `~/.tmux.conf`, remember to source this config file every time you make changes.
22 | | Shortcut | Description |
23 | | ---- | -------- |
24 | | `prefix` + `:list-keys` | See all key binds, and press `q` to quit|
25 | | `prefix` + `:show-options -g ` | See all global sessions options, and press `q` to quit|
26 | | `prefix` + `r` | Source the `.tmux.conf` file|
27 | | `prefix` + `$` | Rename current active session |
28 | | `prefix` + `d` | Detach current active session |
29 | | `prefix` + `,` | Rename current active window |
30 | | `prefix` + `c` | Create new window |
31 | | `prefix` + `&` | Kill current window |
32 | | `prefix` + `n` | Next window |
33 | | `prefix` + `p` | Previous window |
34 | | `prefix` + `w` | List all Sessions and windows |
35 | | `prefix` + `\|` | Split windows left and right |
36 | | `prefix` + `-` | Split windows up and down |
37 | | `Ctrl` + `h/j/k/l` | Move to the left/down/up/right pane, enabled by vim-tmux-navigator |
38 | | `prefix` + `h/j/k/l` | Resize pane, direction keys can be repeated |
39 | | `prefix` + `m` | Maximize/Unmaximize current pane |
40 | | `[` | Enter copy mode |
41 | | `Ctrl`+`c` | Exit copy mode|
42 |
43 | ## Plugins:
44 | To install a plugin, add `set -g @plugin [Plugin]` in `.tmux.conf`, don't forget to initialize `tpm` at the end. Save and quit config file then `prefix+I` to install the plugins.
45 | 1. [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm): Plugin manager tpm
46 | 2. [Vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator): Fast navigation among panes and (Neo)Vim
47 | 3. [Tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect): Restore tmux env after system restart
48 | 4. [Tmux-continuum](https://github.com/tmux-plugins/tmux-continuum): Continuous Saving
49 | 5. [Theme-Pack](https://github.com/jimeh/tmux-themepack): Change theme color of Tmux sessions
50 |
--------------------------------------------------------------------------------
/install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bryant-video/tmux-tutorial/f13883a0a79837496ccd552c605150fb2b295a9a/install.png
--------------------------------------------------------------------------------
/tmux.conf:
--------------------------------------------------------------------------------
1 | unbind %
2 | bind | split-window -h -c "#{pane_current_path}"
3 |
4 | unbind '"'
5 | bind - split-window -v -c "#{pane_current_path}"
6 |
7 | unbind r
8 | bind r source-file ~/.tmux.conf
9 |
10 | bind -r j resize-pane -D 5
11 | bind -r k resize-pane -U 5
12 | bind -r l resize-pane -R 5
13 | bind -r h resize-pane -L 5
14 | bind -r m resize-pane -Z
15 |
16 |
17 | set -g mouse on
18 | set -g mode-keys vi
19 | set -sg escape-time 10 # make delay shorter
20 |
21 | ### Copy Mode
22 | bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v"
23 | bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y"
24 |
25 |
26 | ### Plugins
27 | set -g @plugin 'tmux-plugins/tpm'
28 |
29 | set -g @plugin 'christoomey/vim-tmux-navigator'
30 | set -g @plugin 'jimeh/tmux-themepack'
31 | set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart
32 | set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for you every 15 minutes
33 |
34 | set -g @resurrect-capture-pane-contents 'on'
35 | set -g @continuum-restore 'on'
36 | run '~/.tmux/plugins/tpm/tpm' # Initialize TPM
37 |
--------------------------------------------------------------------------------