1
0
Fork
You've already forked nvim-wrap
0
a thin nvim shell wrapper to explicitly set your nvim RPC socket location
  • Shell 55.5%
  • Roff 34.9%
  • Makefile 9.6%
Find a file
2026年03月17日 15:53:38 -06:00
.editorconfig Add initial version of nvim-wrap 2025年10月14日 12:43:03 -06:00
.gitignore Add option to zip manpage 2026年03月13日 23:05:46 -06:00
config.mk Add option to zip manpage 2026年03月13日 23:05:46 -06:00
LICENSE Initial commit 2025年10月14日 12:24:09 -06:00
Makefile Bump VERSION 2026年03月13日 23:06:26 -06:00
nvim-send.sh Update help text 2026年03月13日 15:28:17 -06:00
nvim-wrap.1.in Update manpage 2026年03月13日 15:32:02 -06:00
nvim-wrap.sh Add handling for --listen flag 2026年03月17日 15:42:48 -06:00
readme.md Update readme 2026年03月17日 15:53:38 -06:00

nvim-wrap

here 2 scripts are provided:

  • nvim-wrap
  • nvim-send

nvim-wrap: a paper thin wrapper to ensure that every instance of neovim we launch will always be listening to the pipe that nvim-send sends commands to, you can use this wrapper to set and unset environment variables if you want or to launch neovim with another wrapper, your imagination is the limit.

nvim-send: sends neovim commands into all nvim RTC pipes, if you provide the script with arguments it will send them like a single command, if you do not it will instead run the send_comms function which can be overriden from the config with whatever you want inside.

The RTC pipes will be defined as $XDG_RUNTIME_DIR/nvim/nvim.PID.timestamp, where PID is the process ID of the nvim-wrap script which is then inherited to the neovim instance by running it with exec, the timestamp is the amount of seconds since unix epoch at the time before the nvim instance is exec'd, if for whatever reason $XDG_RUNTIME_DIR was not set in the environment the script falls back to /tmp following the behaviour from upstream.

The location for the RTC pipe can be set on ${XDG_CONFIG_HOME:-${HOME}/.config}/nvim-wrap/configrc by setting the var pipe_loc to a different dir.

installation:

# clone the repo
git clone https://github.com/eylles/nvim-wrap.git
# to install just run
make install clean
# by default this will put both scripts in:
# $HOME/.local/bin
# you can configure that in config.mk

Now add some alias like this to your shell's rc (bashrc, zshrc, .profile)

alias nvim="nvim-wrap"

or even link the nvim-wrap script to /usr/bin/editor if you are using the debian alternatives system, just edit the config.mk and change PREFIX to /usr/local, install and then run this command to register nvim-wrap onto the alternatives system:

sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/nvim-wrap 30
# or if you want something more "complete", set "ZIP_MAN = true" in config.mk then run this command
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/nvim-wrap 30 --slave /usr/share/man/man1/editor.1.gz editor.1.gz /usr/local/man/man1/nvim-wrap.1.gz
# you will get the zipped manpage as editor.1.gz and accessible from man editor

have fun!!!

where do this comes from?

These scripts are a more general version from the nvim-colo-reload scripts found in the pywal-extra repo.

why tho?

A couple of reasons i've found through the years:

  • pywal integration: one common pitfal for pywal integration was/is that even if the colorscheme is able to perform dynamic reload when the base colors change like neopywal some other elements like the statusline colorscheme may not be reloaded so additional commands have to bee hooked on to the colorscheme change.

  • bad vertical scrolling on splits: an old bug that has existed since neovim 0.5 and was "fixed" on neovim 0.6, it tends to happen more on a true xterm since neovim has some wrong assumptions about scroll handling, to simplify neovim expects the sgmlp and sgmrp sequences to be set when the environment variable of a true xterm XTERM_VERSION exists within the environment, for xterm to have those specific scrolling sequences it has to use the decTerminalID vt420, but that is usually NOT the default terminal id configured for xterm as distributions usually set it to vt100 for compatibility while users tend to set it to vt340 for sixel graphics support, the real fix is for neovim to use the DECRQSS control sequence to get the correct scrolling method instead relaying on env vars, but until that happens (still a bug in neovim 0.10, gotta check on 0.11 yet) the workaround is to use a neovim wrapper that unsets the XTERM_VERSION variable before running neovim, with nvim-wrap just put unset XTERM_VERSION inside your config and it will work.