22 releases

0.1.13 Jan 16, 2024
0.1.12 Nov 16, 2023
0.1.11 May 4, 2023
0.1.5 Mar 7, 2023
0.0.6 Nov 6, 2022

#42 in Text editors

Download history 178/week @ 2024-11-30 400/week @ 2024-12-07 89/week @ 2024-12-14 7/week @ 2024-12-21 8/week @ 2024-12-28 31/week @ 2025-01-04 38/week @ 2025-01-11

69 downloads per month

MIT and LGPL-3.0

4.5MB
849 lines

Contains (ELF exe/lib, 14MB) plugin/vmux

vmux logo

Discord Crates.io

Helper to use vim/neovim as a terminal multiplexer

video demos

Neovim conf '22 presentation session switching CLI + functionalities inside vim

docker demo

docker run -it yazgoo/vmux:master (more info on how to use it, based on Dockerfile)

install

You will need rust and cargo installed.

Install the plugin with post-update hook to install vmux crate:

with vim-plug
Plug 'yazgoo/vmux', {'do': 'cargo install vmux' }
with lazy.nvim
{ 'yazgoo/vmux', build = 'cargo install vmux' }
with packer.nvim
use { 'yazgoo/vmux', run = '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)

with vim-plug
source ~/.config/nvim/plugged/vmux/plugin/setup_vmux.sh <your_editor>
with lazy.nvim
source ~/.local/share/nvim/lazy/vmux/plugin/setup_vmux.sh <your_editor>
with packer.nvim
source ~/.local/share/nvim/site/pack/packer/start/vmux/plugin/setup_vmux.sh <your_editor>

Note: if you are using Fish shell, consider using bass with the following added to config.fish:

bass source <path-to-setup_vmux.sh> <your_editor>

usage

interactive usage

video demo

vmux new or vmux will start vmux in interactive mode. You'll be prompted to:

  • create a new session (via New: ... (pre-named), or New (custom-named))
  • exit (via Detach)
  • open an existing session

You can leave current session with CTRL+g. (you can change default escape key from CTRL+g (with -e a) to CTRL+a ).

usage within vim/neovim

video demo

Within vim, vmux provides integration between vim and terminal. Run :help vmux from within vim for more info. Here is an example configuration.

cli usage

  • vmux new <session_name> creates a new session,
  • vmux list list running sessions,
  • vmux attach <full_session_name> attaches to a running session (as per vmux list)
  • you can group sessions with -s option.

customizing

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).

list sessions names

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 per line, see this for an example.

session setup

You can define a custom way to setup a new session via ~/.config/vmux/hooks/session_name.
The script takes the session name as argument and should print environment variables of the form key=value.

For example, this script will print the content of .envrc and set working directory to ~/dev/$1 (via PWD line).

wallpaper

You can put images which will be used as wallpapers inside ~/.config/vmux/wallpapers/.

detach / attach callbacks

You can define callbacks on attach / detach session. For example, to share data between (n)vim instances (including registers content), you can use shared data files (Shada), by adding in your vim conf:

function! VmuxCustomDetachCallback()
  wshada
endfunction

function! VmuxCustomAttachCallback()
  rshada
endfunction

you can get info about current session via the following env var:

  • VMUX_SESSION_GROUP: session group name
  • VMUX_DISPLAY_NAME: session display name within current group
  • VMUX_SESSION_NAME: full session name used to identify the session uniquely

Dependencies

~27–39MB
~554K SLoC

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy