Helper to use vim/neovim as a terminal multiplexer
Neovim conf 2022 |
session switching:
![]() |
CLI + functionalities inside vim:
![]() |
bash
docker run -it yazgoo/vmux:master
see interactive usage for more info on how to use it.
A full example of actual installation/customization can be found in Dockerfile.
You will need rust and cargo installed.
Install the following vim plugin (e.g. here with vimplug), with a hook to install vmux crate:
vimscript
Plug 'yazgoo/vmux', {'do': 'cargo install vmux' }
Add the following to your .zshrc
or .bashrc
(replace <your_editor>
with vim or nvim (default)).
For vim you'll need it compiled with +clientserver
flag:
bash
source ~/.config/nvim/plugged/vmux/plugin/setup_vmux.sh <your_editor>
See video demo. vmux new
will start vmux in interactive mode.
You'll be prompted to:
New: ...
(pre-named), or New
(custom-named))Detach
)You can leave current session with CTRL+g
.
(you can change default escape key from CTRL+g
(with -e a
) to CTRL+a
).
See video demo.
Within vim, vmux provides integration between vim and terminal.
Run :help vmux
from within vim for more in depth help.
see docker/init.vim for an example of configuration.
you can also manage sessions from the CLI:
vmux new <session_name>
to create a new session namevmux list
to list session namesvmux attach <full_session_name>
to attach to a running session (as per vmux list
)For an optimal experience, you should at least add
list_sessions_names
and session_name
hook files described below.
Both files must be executable (if they are a script, they should have a shebang).
You can define a custom way to setup a new session via ~/.config/vmux/hooks/session_name
,
which takes the session name as argument.
The script just needs to print environment variables of the form key=value
(env
command will do that).
For example, this script will print the content of .envrc
and set working directory to ~/dev/$1
(via PWD
line).
You can define a list of new session names via ~/.config/vmux/hooks/list_sessions_names
The script just needs to output session names one by line, see docker for an example.
You can put images which will be used as wallpapers inside ~/.config/vmux/wallpapers/
.
This project relies on the following fundamentals crates: