12

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 Answers 4

5

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.

6

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.
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

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.