DEV Community

Waylon Walker
Waylon Walker

Posted on โ€ข Originally published at waylonwalker.com

4 1

Open Files with Nvim Remote

I recently found a really great plugin by mhinz to open files in neovim from a different tmux split, without touching neovim at all.

Installation

neovim-remote is not a neovim plugin at all, it's a python cli that you can install with pip. Unlike the repo suggests, I use pipx to install nvr.

pipx install neovim-remote
Enter fullscreen mode Exit fullscreen mode

How I use it

I have this added to my .envrc that is in every one of my projects. This will tie a neovim session to that directory, and all directories under it.

export NVIM_LISTEN_ADDRESS=/tmp/nvim-$(basename $PWD)
Enter fullscreen mode Exit fullscreen mode

In my workflow I open a tmux session for each project, so this
essentially ties a neovim session to a tmux session.

Open neovim

First open neovim, but with the nvr command. This will open neovim, and look pretty much the same as always.

nvr
Enter fullscreen mode Exit fullscreen mode

If you try to run nvr again in another shell nothing will happen as its already runnin under that address, but if you give it a filename it will open the file in the first instance of neovim that you opened.

nvr readme.md
Enter fullscreen mode Exit fullscreen mode


`

Links

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay