tmuxrc/README.md
2023-03-20 12:26:46 +07:00

166 lines
5.1 KiB
Markdown

# [tmuxrc][tmuxrc_repo]
![Tmux](https://img.shields.io/badge/tmux-v3.3-brightgreen)
![Fzf](https://img.shields.io/badge/fzf-v0.35-green)
**tmuxrc** is a collection of [RUNCOM][RUNCOM] & Plugins dedicated to the terminal multiplexer [Tmux][TMUX_repo].
- I use this configuration with my custom [bash environment][bashrc_repo] to always work in Tmux locally and in SSH sessions.
----
## Features
- Plugins (included as submodules):
- [tpm][tpm]: Plugin Manager.
- [tmux-prefix-highlight][tmux-prefix-highlight]: highlights when you press tmux prefix key.
- [tmux-menus][tmux-menus]: Popup menus.
- [extrakto][extrakto]: select, copy/insert/complete text without a mouse (prefix Tab).
- [tmux-sidebar][tmux-sidebar]: directory tree for the current path.
- Prefix rebinded to `Ctrl+x` (`Ctrl+w` for remote/ssh sessions).
- Toggle Sync mode for visible panes with `Prefix-a`.
- Toggle Zoom current Pane with `Prefix-Z`. Next & Previous: `Prefix-e`,`Prefix-z`.
- Open a popup session changer with `Prefix-Ctrl+j`.
- Open a popup Scratch session with `Prefix-Ctrl+g`.
- Nice status (display current command) & color theme with true colors.
- Compatible with my environment config: [bashrc][bashrc_repo].
- Check more in the conf file …
## Requirements
- [Tmux][TMUX_repo] 3.3+:
- libevent 2.x (apt or [build][libevent_repo])
- ncurses (apt or [build][ncurses_repo])
- [Gitmux][gitmux_repo]
- [Fzf][fzf_repo] 0.35+ for `fzf-tmux`
- exa for the tmux-sidebar: `sudo apt install exa`
### Recommended
- bash 5+
- bash_completion
- My environment config: [bashrc][bashrc_repo]
## Installation
### [Tmux][TMUX_repo]
- With APT:
```bash
# check version and repository with apt
sudo apt show -a tmux 2> /dev/null | grep -E 'Version:|APT-Sources:'
# if your apt repositories deliver at least 3.3, you can install it
sudo apt install tmux
# or if there is a specific repository
sudo apt -t repo-backports install tmux
```
- Or build & install:
```bash
mkdir -p $HOME/Builds && cd $HOME/Builds
wget https://github.com/tmux/tmux/releases/download/3.3a/tmux-3.3a.tar.gz
tar -zxf tmux-*.tar.gz
cd tmux-*/
./configure
make && sudo make install
```
### [Gitmux][gitmux_repo]
- Copy it manually to /usr/local/bin: https://github.com/arl/gitmux/releases
- Or you need `jq` to parse the latest release in cli:
```bash
# for linux_amd64
sudo apt install jq
_RELEASES=$(curl -s https://api.github.com/repos/arl/gitmux/releases/latest)
_URL=$(echo "$_RELEASES" | jq -r '.assets[] | select( .name | match("linux_amd64")) | .browser_download_url')
wget -c -nv "$_URL" -O - | sudo tar --no-same-owner -xzv -C /usr/local/bin gitmux
```
### [Fzf][fzf_repo]
- With APT:
```bash
# check version and repository with apt
sudo apt show -a fzf 2> /dev/null | grep -E 'Version:|APT-Sources:'
# if your apt repositories deliver at least 0.35, you can install it
sudo apt install fzf
# or if there is a specific repository
sudo apt -t repo-backports install fzf
```
- Or build & install:
```bash
mkdir -p $HOME/Builds && cd $HOME/Builds
git clone --depth 1 https://github.com/junegunn/fzf.git
cd fzf
sudo ./install --all --no-bash --no-zsh --no-fish
sudo cp shell/completion.bash /etc/bash_completion.d/fzf
sudo cp bin/* /usr/local/bin/
```
### [tmuxrc][tmuxrc_repo]
```bash
# backup current files
mkdir -p $HOME/.backups
cp -r --backup=t {"$HOME"/.tmux/,"$HOME"/.tmux.conf,"$HOME"/.config/tmux/} $HOME/.backups/
rm -Rf "$HOME"/.tmux/ "$HOME"/.tmux.conf "$HOME"/.config/tmux/
# install
mkdir -p $HOME/.config
cd $HOME/.config
git clone --depth=1 --recurse-submodules https://git.tkapias.net/tkapias/tmuxrc tmux
cp tmux/gitmux.conf $HOME/.config/
```
## Configuration
### TERM name, true color and osc 52 copy
You may need to modify the name of your `$TERM` in the "terminal-features" & "terminal-overrides" inside tmux.conf.
Your terminal need features related to 256 or true colors and OSC 52 copy.
### URxvt - Rxvt-unicode
Urxvt is an old terminal but it is currently my favorite due to the amount of customizations available and it's performance.
By default it can not perform OSC 52 or display some font icons. Please refer to my other repository [urxvtrc][urxvtrc_repo].
### SSH/Remote
If you install this configuration on a remote system, you will need another prefix than on the local tmux (ctrl+x).
You can change the prefix to ctrl+w on the remote system like this:
```bash
sed -i -e 's/C-x/C-w/g' -e 's/Ctrl-x/Ctrl-w/g' $HOME/.config/tmux/tmux.conf
```
----
[//]: # (LINKS)
[tmuxrc_repo]: https://git.tkapias.net/tkapias/tmuxrc
[TMUX_repo]: https://github.com/tmux/tmux
[bashrc_repo]: https://git.tkapias.net/tkapias/bashrc
[urxvtrc_repo]: https://git.tkapias.net/tkapias/urxvtrc
[RUNCOM]: https://en.wikipedia.org/wiki/RUNCOM
[libevent_repo]: https://github.com/libevent/libevent/releases/latest
[ncurses_repo]: https://invisible-mirror.net/archives/ncurses/
[gitmux_repo]: https://github.com/arl/gitmux
[fzf_repo]: https://github.com/junegunn/fzf.git
[tpm]: https://github.com/tmux-plugins/tpm
[tmux-prefix-highlight]: https://github.com/tmux-plugins/tmux-prefix-highlight
[tmux-menus]: https://github.com/jaclu/tmux-menus
[extrakto]: https://github.com/laktak/extrakto
[tmux-sidebar]: https://github.com/tmux-plugins/tmux-sidebar