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 a pipe (by default /tmp/nvim/nvim.PID.pipe), 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.
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/binNow 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 30have fun!!!
These scripts are a more general version from the nvim-colo-reload scripts found in the pywal-extra repo.
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
sgmlpandsgmrpsequences to be set when the environment variable of a true xtermXTERM_VERSIONexists within the environment, for xterm to have those specific scrolling sequences it has to use thedecTerminalIDvt420, but that is usually NOT the default terminal id configured for xterm as distributions usually set it tovt100for compatibility while users tend to set it tovt340for sixel graphics support, the real fix is for neovim to use theDECRQSScontrol 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 theXTERM_VERSIONvariable before running neovim, with nvim-wrap just putunset XTERM_VERSIONinside your config and it will work.