mhinz / neovim-remote

:ok_hand: Support for --remote and friends.
MIT License
1.75k stars 83 forks source link

Send a command to all nvim istances #188

Open Spo0on opened 1 year ago

Spo0on commented 1 year ago

I would like to be able to simultaneously send a command to each open nvim instance under a same dir. E.g. when i open nvim it spawns an instance within a folder under /var/folders/8d/l1qvyhds0c57j9shgl2412_00000gn/T/nvim.(my username)/. So what i want to do is to send the command nvr --nostart --remote-send ':set background=light<CR>' (or :set background dark) to all nvim istances under these dirs to change nvim appearance in all windows simultaneously. I managed to solve by using a small script:

for file in /var/folders/8d/l1qvyhds0c57j9shgl2412_00000gn/T/nvim.giuliocorona/*/*
do
    /Library/Frameworks/Python.framework/Versions/3.11/bin/nvr --nostart --remote-send ':set background=dark<CR>' --servername "$file"
done

but would be easier having a dedicated option.