tmuxrc/README.md

166 lines
5.1 KiB
Markdown
Raw Permalink Normal View History

2023-03-18 19:35:56 +01:00
# [tmuxrc][tmuxrc_repo]
![Tmux](https://img.shields.io/badge/tmux-v3.3-brightgreen)
![Fzf](https://img.shields.io/badge/fzf-v0.35-green)
2023-03-18 19:45:23 +01:00
**tmuxrc** is a collection of [RUNCOM][RUNCOM] & Plugins dedicated to the terminal multiplexer [Tmux][TMUX_repo].
2023-03-18 19:35:56 +01:00
- I use this configuration with my custom [bash environment][bashrc_repo] to always work in Tmux locally and in SSH sessions.
----
## Features
2023-03-18 19:45:23 +01:00
- 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.
2023-03-18 20:48:08 +01:00
- [extrakto][extrakto]: select, copy/insert/complete text without a mouse (prefix Tab).
2023-03-18 19:45:23 +01:00
- [tmux-sidebar][tmux-sidebar]: directory tree for the current path.
2023-03-18 20:48:08 +01:00
- 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.
2023-03-18 19:45:23 +01:00
- Compatible with my environment config: [bashrc][bashrc_repo].
2023-03-18 20:10:41 +01:00
- Check more in the conf file …
2023-03-18 19:35:56 +01:00
## 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`
2023-03-18 20:48:08 +01:00
- exa for the tmux-sidebar: `sudo apt install exa`
2023-03-18 19:35:56 +01:00
### Recommended
- bash 5+
- bash_completion
- My environment config: [bashrc][bashrc_repo]
## Installation
2023-03-18 19:45:23 +01:00
### [Tmux][TMUX_repo]
2023-03-18 19:35:56 +01:00
- With APT:
```bash
2023-03-19 17:35:45 +01:00
# check version and repository with apt
sudo apt show -a tmux 2> /dev/null | grep -E 'Version:|APT-Sources:'
2023-03-18 19:35:56 +01:00
# if your apt repositories deliver at least 3.3, you can install it
sudo apt install tmux
2023-03-19 17:35:45 +01:00
# or if there is a specific repository
sudo apt -t repo-backports install tmux
2023-03-18 19:35:56 +01:00
```
- 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
2023-03-18 19:45:23 +01:00
make && sudo make install
2023-03-18 19:35:56 +01:00
```
2023-03-18 19:45:23 +01:00
### [Gitmux][gitmux_repo]
2023-03-18 19:35:56 +01:00
- Copy it manually to /usr/local/bin: https://github.com/arl/gitmux/releases
2023-03-18 19:45:23 +01:00
- Or you need `jq` to parse the latest release in cli:
2023-03-18 19:35:56 +01:00
```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
```
2023-03-18 19:45:23 +01:00
### [Fzf][fzf_repo]
2023-03-18 19:35:56 +01:00
- With APT:
```bash
2023-03-19 17:35:45 +01:00
# check version and repository with apt
sudo apt show -a fzf 2> /dev/null | grep -E 'Version:|APT-Sources:'
2023-03-18 19:35:56 +01:00
# if your apt repositories deliver at least 0.35, you can install it
2023-03-18 20:50:05 +01:00
sudo apt install fzf
2023-03-19 17:35:45 +01:00
# or if there is a specific repository
sudo apt -t repo-backports install fzf
2023-03-18 19:35:56 +01:00
```
- 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/
```
2023-03-18 19:45:23 +01:00
### [tmuxrc][tmuxrc_repo]
2023-03-18 19:35:56 +01:00
```bash
# backup current files
mkdir -p $HOME/.backups
2023-03-19 10:24:51 +01:00
cp -r --backup=t {"$HOME"/.tmux/,"$HOME"/.tmux.conf,"$HOME"/.config/tmux/} $HOME/.backups/
rm -Rf "$HOME"/.tmux/ "$HOME"/.tmux.conf "$HOME"/.config/tmux/
2023-03-18 19:35:56 +01:00
2023-03-18 19:45:23 +01:00
# install
2023-03-18 19:35:56 +01:00
mkdir -p $HOME/.config
cd $HOME/.config
2023-03-18 20:52:22 +01:00
git clone --depth=1 --recurse-submodules https://git.tkapias.net/tkapias/tmuxrc tmux
2023-03-19 10:03:06 +01:00
cp tmux/gitmux.conf $HOME/.config/
2023-03-18 19:35:56 +01:00
```
## Configuration
2023-03-20 06:26:46 +01:00
### 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].
2023-03-18 19:35:56 +01:00
### SSH/Remote
2023-03-18 19:45:23 +01:00
If you install this configuration on a remote system, you will need another prefix than on the local tmux (ctrl+x).
2023-03-18 19:35:56 +01:00
2023-03-18 19:45:23 +01:00
You can change the prefix to ctrl+w on the remote system like this:
2023-03-18 19:35:56 +01:00
```bash
2023-03-19 09:14:40 +01:00
sed -i -e 's/C-x/C-w/g' -e 's/Ctrl-x/Ctrl-w/g' $HOME/.config/tmux/tmux.conf
2023-03-18 19:35:56 +01:00
```
----
[//]: # (LINKS)
[tmuxrc_repo]: https://git.tkapias.net/tkapias/tmuxrc
[TMUX_repo]: https://github.com/tmux/tmux
[bashrc_repo]: https://git.tkapias.net/tkapias/bashrc
2023-03-20 06:26:46 +01:00
[urxvtrc_repo]: https://git.tkapias.net/tkapias/urxvtrc
2023-03-18 19:35:56 +01:00
[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
2023-03-18 19:45:23 +01:00
[fzf_repo]: https://github.com/junegunn/fzf.git
2023-03-18 19:35:56 +01:00
[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