5 ms·
Useful when copy/pasting things to share with other people in email and such: $ pbpaste | pbcopy takes the current contents of the copy/paste buffer and r
by natch 13y ago
Useful when copy/pasting things to share with other people in email and such:
$ pbpaste | pbcopy
takes the current contents of the copy/paste buffer and removes color/font/background color rich formatting and puts just plain text back into the paste buffer.
And of course pbcopy and pbpaste are also very useful on their own.
- Janteh 13y agoYou can also use shift-option-cmd-v to directly paste without markup :)
- natch 13y agoI can never remember which combination that is, but thanks.
- jmreid 13y agoYou can override any key combination using the Keyboard preferences. Just make a new shortcut under the All Applications group named exactly the same as the one you want to replace. http://i.imgur.com/JqBncTy.png http://i.imgur.com/JqBncTy.png I've also had to add an entry for "Paste as Quotation" because that's Mail's default use of Command-V.
- revscat 13y agoBe warned, though, that these do not work inside of a tmux session without special steps being taken. I believe that they work in screen, but tmux requires some additional work.
- bwilliams 13y agoYou have to install "reattach-to-user-namespace" which you can do with homebrew. Then you need to add the following to .tmux.conf set-option -g default-command "reattach-to-user-namespace -l zsh" There's a good writeup on what and why here, https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/...
- yanokwa 13y agoI use Plain Clip (http://www.bluem.net/en/mac/plain-clip/ http://www.bluem.net/en/mac/plain-clip/) for this. It also gives you optional text processing steps (e.g., remove all trailing whitespace) which are super useful.
- mikeflynn 13y agoThis command has immediately become an alias in my .profile.
- dergachev 13y agoSweet! To take it to the next level: pbpaste |sed 's/FIND/REPLACE/g' | pbcopy Maybe make this into a script you can run from alfred. ;) Also if you want to have access to pbcopy remotely, try this: http://evolvingweb.ca/blog/exposing-your-clipboard-over-ssh http://evolvingweb.ca/blog/exposing-your-clipboard-over-ssh
- admp 13y agoQuite a lot of OS X applications support pasting with matching style (Cmd+Shift+V), which does exactly the same thing.
- cynwoody 13y agoActually, natch's trick does just the opposite. It strips out any formatting information that may accompany the text on the clipboard. I've used the same trick on occasion when copying text from web pages into Gmail. When you paste such text into a Gmail draft, Gmail tries to duplicate the format of the original, which is often not what you want. pbpaste | pbcopy solves the problem nicely. Edit: But Shift-Option-Cmd-V is easier. Thanks, Janteh!