clipboard

Vim: Use + as default register only for yank command

限于喜欢 提交于 2019-12-20 20:17:14
问题 I'd like to use + register (system clipboard) only for yank command (that is, don't overwrite this register on dd or other commands). :set clipboard+=unnamed won't work, because it introduces dd overwriting described above. 回答1: You can overwrite the default yank commands so that they default to the system clipboard, unless another register is explicitly given: :nnoremap <expr> y (v:register ==# '"' ? '"+' : '') . 'y' :nnoremap <expr> yy (v:register ==# '"' ? '"+' : '') . 'yy' :nnoremap <expr

Accessing alternate clipboard formats from python

时光毁灭记忆、已成空白 提交于 2019-12-20 19:31:50
问题 Copying to the clipboard from an application that supports rich text will typically add the text in several formats. I need to find out the available formats, and then retrieve the clipboard contents in a selected format. In case it matters, I'm interested in rich text formats (from Word, Acrobat, browsers, ...), not in image data or other exotica. I've looked and looked, but the solutions I've found are limited to plain text, super outdated, specific to Windows (I'm on OS X), reliant on the

AngularJS copy to clipboard

点点圈 提交于 2019-12-20 11:35:44
问题 Is there a way to make a copy button with a copy function that will copy all the contents of a modal and you can paste it to notepad 回答1: I needed this functionality in my Controller , as the text to be copied is dynamic, here's my simple function based on the code in the ngClipboard module: function share() { var text_to_share = "hello world"; // create temp element var copyElement = document.createElement("span"); copyElement.appendChild(document.createTextNode(text_to_share)); copyElement

Will there ever be an HTML5 Clipboard API? [closed]

北城余情 提交于 2019-12-20 10:25:10
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm frustrated with how far behind other standard web APIs we are with clipboard access. I'm working on a webapp that lets you draw

Python get mac clipboard contents

别等时光非礼了梦想. 提交于 2019-12-20 09:57:38
问题 How can I, using Python (2.7) get the contents of the Mac clipboard. Is there a better way than making a wrapper around pbpaste? Thanks! 回答1: PyObjC is the way to go: #!/usr/bin/python from AppKit import NSPasteboard, NSStringPboardType pb = NSPasteboard.generalPasteboard() pbstring = pb.stringForType_(NSStringPboardType) print u"Pastboard string: %s".encode("utf-8") % repr(pbstring) This only supports text and will return None otherwise. You can extend it to support other data types as well,

Piping output from Git Bash to clipboard

坚强是说给别人听的谎言 提交于 2019-12-20 08:39:52
问题 I often need to relay my Git output to my ever-friendly code buddies. The best way I know how is by doing this: Right-click Git Bash title bar > Edit > Mark > Select lines > Enter Bam - everything I selected is in my clipboard, and I am filled with joy. Problem is, that's the boring way, and I like my relationship with Git to be full of excitement and glamour . In Windows, you can pipe console output to your clipboard like-a so: C:\> dir | clip Amazing, right? Well, when you try to do

select & copy to clipboard in TextView in Android

混江龙づ霸主 提交于 2019-12-20 07:22:02
问题 Is it possible to allow the user to select and then copy text in the clipboard in a TextView? I found this but there isn't an answer. I have also tried to set android:textIsSelectable="true" but it didn't work. 回答1: I fixed it by using an EditText but to avoid the problems I described in my answer to "imran khan" I found a comment about setKeyListener in the android code: * Be warned that if you want a TextView with a key listener or movement * method not to be focusable, or if you want a

Image copied to clipboard doesn't persist on Linux

懵懂的女人 提交于 2019-12-20 04:48:14
问题 I'm trying to save an image to the system clipboard, so I wrote some code like this: #!/usr/bin/python3 from PyQt5.Qt import QApplication from PyQt5.QtWidgets import QWidget, QPushButton from PyQt5.Qt import QImage import sys class MyWidget(QWidget): def __init__(self): super(MyWidget, self).__init__() self.button = QPushButton(self) self.button.clicked.connect(self.copyPicToClip) def copyPicToClip(self): image = QImage('./test.jpg') QApplication.clipboard().setImage(image) self.close() if _

Is there some way to predict png size?

China☆狼群 提交于 2019-12-20 04:23:10
问题 I am implementing clipboard, and I want to allocate memory for png image one time. Is there some way to predict maximum size of png file? 回答1: A PNG image includes several things: Signature and basic metadata (image size and type) Palette (only if the image is indexed) Raw pixel data Optional metadata (ancillary chunks) End of image chunk Size of item 1 is fixed: 8 + 12 + 11 = 31 bytes Size of item 2 (if required) is at most 12 + 3 * 256 = 780 bytes Size of item 5 is fixed: 12 bytes Item 3,

How do you handle column names having spaces in them when using pd.read_clipboard?

醉酒当歌 提交于 2019-12-20 02:15:53
问题 This is a real problem I've faced for a long time. Take this dataframe: A B THRESHOLD NaN NaN NaN -0.041158 -0.161571 0.329038 0.238156 0.525878 0.110370 0.606738 0.854177 -0.095147 0.200166 0.385453 0.166235 It is easy enough to copy using pd.read_clipboard . However, if one of the column names has a space: A B Col #3 NaN NaN NaN -0.041158 -0.161571 0.329038 0.238156 0.525878 0.110370 0.606738 0.854177 -0.095147 0.200166 0.385453 0.166235 Then, it is read like this: A B Col #3 0 NaN NaN NaN