Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open file in a running nvim-qt instance

Tags:

vim

neovim

I want to open new files from the command line on Windows in a single nvim-qt instance that is already open.

I know the existence of the --server option, but how do I know the IP or the socket name or path of the running instance?

like image 902
el_technic0 Avatar asked Aug 23 '17 09:08

el_technic0


1 Answers

As el_technic0 said, the neovim-remote utility is the easiest way to get remote file opening to work. I even added an alias to it in my .bashrc file (alongside the listen address definition) for easier invocation:

export NVIM_LISTEN_ADDRESS=/tmp/nvimsocket
alias vim='nvr --remote'

This way the first call will start a new neovim instance, and subsequent calls will be forwarded to that instance.

You may also want to add the set hidden option to your init.vim configuration file, otherwise subsequent calls may fail if the current buffer contains unsaved changes.

like image 178
xperroni Avatar answered Nov 15 '22 14:11

xperroni