1

I have a script with which I toggle between a dark and a light colorscheme. The terminal emulator I use (termite) rereads its configuration when receiving the signal USR1, so when toggling my colorscheme I send USR1 to all termite instances so that the colorscheme is updated immediatly.

Does there exist some possibility to convince neovim to reread its configuration (from outside of neovim)?

I couldn't really find a list of what neovim makes of unix signals. It also doesn't need to be a signal, as far as I understand neovim has some concepts of "server" and "frontend", so I guess something like connecting to each server and issuing to reload the configuration would also work.

0

I suspect that most of the solutions here should also work with neovim.

Since you are on *nix the first one to try is probably: :so ~/.vimrc

  • The problem is that (as far as I understand) I have to manually issue that command in every (n)vim instance I'm currently running. I'm looking for a solution to automate that, e.g. something that "logs into each nvim instance" and issues the command. – syntonym May 6 at 17:42
0

One can remotely control vim via the remote feature. For neovim I found the neovim-remote which makes it easy to send a command to an already running nvim process. The following snippet iterates through every nvim process (discovered by neovim-remote) and sends a command to source the config file:

for path in $(nvr --nostart --serverlist)
do
  nvr --nostart --servername $path -cc 'so ~/.config/nvim/init.vim'
done

This assumes that the config is present in ~/.config/nvim/init.vim. If your config is in a different file it should be replaced there. If there are different nvims with different configurations loaded (e.g. via the -u <configfile> flag which loads a different config file) this script will ignore that and command each instance to load the same config. I would think nvr --c 'so $MYVIMRC' should work, but it didn't for me.

The first --nostart is probably superfluous, but it shouldn't hurt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.