11

I know that vim had the client/server divide that allowed register sharing between different vim clients, but how do you achieve the same thing in neovim? It doesn't support the client/server flags. I saw this question, but my goal is specifically sharing registers, not imitating the rest of client/server. Is something like neovim remote the only way, or is there something simpler I can do?

4 Answers4

7

No idea about the clientserver feature, the simplest way I can think of would be to use the system clipboard by default when yanking or pasting which can be done with:

set clipboard=unnamedplus

Depending on your OS and environment, you might need other tweaks for it to work seamlessly.


Also, you may be able to leverage the viminfo file (or :h shada on neovim):

The ShaDa file is used to store:

  • The command line history.
  • The search string history.
  • The input-line history.
  • Contents of non-empty registers.
  • Marks for several files.
  • File marks, pointing to locations in files.
  • Last search/substitute pattern (for 'n' and '&').
  • The buffer list.
  • Global variables.
LEI
  • 1,626
  • 9
  • 18
6

LEI is right; and the neovim help instructions give this as a specific use case for that feature:

Two commands can be used to read and write the ShaDa file manually. This can be used to exchange registers between two running Vim programs: First type ":wsh" in one and then ":rsh" in the other.

kdannyob
  • 76
  • 1
  • 1
1

use tmux,tmux buffer to unname register, uname register to tmux buffer

https://github.com/tracyone/t-vim/blob/master/autoload/te/tmux.vim

tracyone
  • 345
  • 1
  • 6
0

Sorry, because I dont know anymore where I found this:

" share data between nvim instances (registers etc)
augroup SHADA
    autocmd!
    autocmd CursorHold,TextYankPost,FocusGained,FocusLost *
                \ if exists(':rshada') | rshada | wshada | endif
augroup END
SergioAraujo
  • 1,165
  • 11
  • 12