Last active
August 29, 2015 14:06
-
-
Save bfredl/19c13ba8014bb761528c to your computer and use it in GitHub Desktop.
This file contains hidden or 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, reg): | |
txt = xerox.paste() | |
# emulate vim behavior | |
if txt.endswith('\n'): | |
txt = txt[:-1] | |
regtype = 'V' | |
else: | |
regtype = 'v' | |
return txt.split('\n'), regtype | |
def clipboard_set(self, lines, regtype, reg): | |
txt = u'\n'.join([line.decode('utf-8') for line in lines]) | |
if regtype == 'V': | |
txt = txt + u'\n' | |
xerox.copy(txt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment