Lurker News
OSX Terminal: hold option and click a position in the current line to move your cursor to that position. #yearslost

Comments (395) 107 threads

Show all comments

Showing thread 4 of 107

natch6 replies#
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.

Janteh1 reply#
You can also use shift-option-cmd-v to directly paste without markup :)
natch1 reply#
I can never remember which combination that is, but thanks.
jmreid#
You 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
I've also had to add an entry for "Paste as Quotation" because that's Mail's default use of Command-V.

revscat1 reply#
Be 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#
You 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/...
yanokwa#
I use 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#
This command has immediately become an alias in my .profile.
admp1 reply#
Quite a lot of OS X applications support pasting with matching style (Cmd+Shift+V), which does exactly the same thing.
cynwoody#
Actually, 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!