Last active
April 28, 2023 05:39
-
-
Save tarruda/42f5236449857278f911 to your computer and use it in GitHub Desktop.
Neovim clipboard plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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])) |
@jwmou Unless you configured differently, nvim should store strings as utf-8 internally so there should be no need for chardet(if needed a plugin can use vim.options['encoding']
to know the encoding beforehand)
Could you try the new version again to see if it works(requires this branch)? An alternative is to change xerox.copy('\n'.join([line.decode('utf-8') for line in lines]))
to `xerox.copy(u'\n'.join([line.decode('utf-8') for line in lines]))
You are right.It works
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jwmou thanks!