This project provides a way to launch a unique instance of the Nvim GUI for each workspace directory.
- When the Nvim window is launched multiple times for the same workspace, the open file and location jump instructions are executed in the existing window, and no new window is opened.
- When the previous window is reused, the window is called up and focused. (Currently, only
Windows Terminal
is supported) - When different workspaces are opened, the launcher launches a different window for each different workspace.
pip3 install neovim-remote
pip install pyinstaller
# or
conda install -c conda-forge pyinstaller
Install and get started setting up Windows Terminal
pyinstaller ./nvim_instance.py --nowindow
The nvim_instance
executable is then generated in the dist/
directory.
<path_to_nvim_instance exec> [-h] --project PROJECT --file FILE [--line LINE] [--column COLUMN]
-h, --help show this help message and exit
--project PROJECT, -p PROJECT
project path, open same path will reuse previous window, necessary argument
--file FILE, -f FILE file name, necessary argument
--line LINE, -l LINE line number to jump to
--column COLUMN, -c COLUMN
column number to jump to
The initiator uses paths to distinguish between different workspaces and assigns each path a unique named pipe. Named of the Pipe: nvim_instance_<path_basename>_<sha512 hex value for path>
.
At each startup, the initiator first attempts to connect to the existing instance using the generated pipe name. If the connection is successful, the file is opened in the existing instance and jumps to the specified location. If the connection fails, create a new instance and try again.
Tested on Windows 10
.