aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/nvim_clipboard.txt
blob: 3dd5fb5fcb8e3fd67a73ba622d8f1e40ad742d4c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
*nvim_clipboard.txt*    For Nvim.					{Nvim}


		 NVIM REFERENCE MANUAL    by Thiago de Arruda


Clipboard integration for Nvim			       *nvim-clipboard*

By default, Nvim has no connection to the system clipboard. Eventually that
will be implemented by UI programs, which connect to Nvim via |msgpack-rpc|.

Even though externalized UIs are not available yet, there's a workaround that
enables clipboard usage through the python interface(which also uses
|msgpack-rpc| and consequently can implement the clipboard methods required
by Nvim): 

- Make sure you follow the setup instructions in |nvim-python-quickstart|.
- Install the `xerox` python module:
  >
      $ pip install xerox
<
- Create a ~/.vim/pythonx/nvim_clipboard.py file with the following contents:
  >
    import xerox
     
    class NvimClipboard(object):
        def __init__(self, vim):
            self.provides = ['clipboard']
     
        def clipboard_get(self):
            return xerox.paste().split('\n')
        
        def clipboard_set(self, lines):
            xerox.copy(u'\n'.join([line.decode('utf-8') for line in lines]))
<
This should enable the '+' and '*' registers. As an optional step, set the
'unnamedclip' option to transparently access clipboard using the unnamed
register. If you use the same |vimrc| for both Vim and Nvim, make sure you
only set the option when `has('nvim')` is true:
>
    if has('nvim')
      set unnamedclip
    endif
<

==============================================================================
 vim:tw=78:ts=8:noet:ft=help:norl: