Is there a way to give OS X the usual X-windows behavior where selecting text in any application automatically copies it to the clipboard, and the middle mouse button automatically pastes it?
-
3Well, it works as expected in X...don't know of a solution in quartz.– dmckee --- ex-moderator kittenDec 25, 2009 at 0:02
-
1Bumping the question, because I don't want to ask it again.– dag729May 6, 2010 at 20:05
-
1bump too for me... would be great to have this– CharlesBJun 24, 2010 at 15:17
-
3I just wanted to ask the same question. I recently started to work on MacOS X at my workplace and I am long time Linux user, this is one hell of a Linux feature I am missing on MacOS.– Patkos CsabaAug 9, 2010 at 19:01
-
5You mean you want to give up your ability to replace the selected text with what's on the clipboard?– SpiffSep 14, 2010 at 17:40
11 Answers
This has already been discussed (and answered) on apple.stackexchange.com. The accepted answer in that discussion was to use Better Touch Tool.
However, all those solutions that suggest using some tool to map a mouse click to Cmd-V do not completely mimic the behaviour of X, where you can have different content in the mouse-controlled buffer and the keyboard-controlled buffer (i.e., you can paste two different strings depending on whether you middle-click or press CTRL-V).
-
34And more problematic. It doesn't have the "highlight text to copy" feature.– NifleMay 11, 2012 at 11:52
Just for the archives: what you want does actually work in Terminal†, but only in the very same Terminal window:
Select some text (and release the mouse button), and use the middle mouse button to paste.
Alternatively, when using the trackpad or a two-button mouse: after selecting, click and drag the selection just a bit; you'll see the pointer change. Now, when you let go of the button, the selected text is pasted at your cursor. Hitting Esc while dragging cancels.
† Of course, Terminal is just one out of many programs. But for me, it is the only place I actually want this behaviour, if only because of Spiff's comment about being able to replace (mouse) selected text with what's on the clipboard.
-
Actually copy/drag text works great for me in any editor target (ie, Terminal, BBEdit, text input box on this page, etc)... you can combine a drag with Exposé and CMD-tab. Also, if you want to "copy to clipboard", you can just drag to desktop and it will create a text clipping that you can then drag to other locations repeatedly (it's like a visual clipboard in a way).– r00fusSep 22, 2010 at 5:04
If you just need it for Terminal then you can install iTerm2 which is a terminal which has the X windows cut and paste.
-
2How do I copy-on-select across Terminal <-> Browser <-> Email? Feb 5, 2012 at 21:39
-
-
-
3For the record, iTerm2 (iTerm's successor) can be found here: iterm2.com– deizel.Dec 21, 2012 at 13:09
I just tried Terminal (OS X El Capitan, Version 10.11.5). The process I used is this:
- Highlight text
- Holding 1 finger, drag a bit up (the highlighted text moves and green '+' appears)
- Release and the highlighted text appears in the command line
I don't have a mac so I can't check this out and the content was too long for just a comment so I'm posting it as an answer. Maybe it will prove helpful to others.
Solution1:
Go to X11 preferences - highlight "emulate 3 button mouse".
Now middle click = option+click.
Highlight/paste will work just like in Linux.
Solution2:
Another way is to install the better touch tool, this allows you to assign your own commands to different mouse/touchpad gestures.
- 1 finger right tap = cmd c (copy) and
- 2 finger tap = cmd v (paste)
It is one step more than the highlight = copy, but still preferable over the keyboard shortcuts.
From the macworld hintforums.
I know this isn't exactly the same, but if you select text and right click on it, you do have the option to copy. Once something is on the pasteboard, a right click can paste as well.
I fooled around with my Logitech multi-button mega mouse and couldn't make anything exactly like what you describe, even though one of the options is a "middle click" button.
Theo
DISCLAIMER: I have not tested this because I don't have a mac. But, the content was too large to post as a comment. So, I am posting it as an answer instead.
I am windows user and have implemented exact same function in windows using a script written for a program called Autohotkey.
Now, as per this question, IronAHK runs AHK scripts on Mac.
Here's the one I am using for windows (Ofcourse, you would have to tweak it a lot to make it work):
cos_mousedrag_treshold := 20 ; pixels
#IfWinNotActive ahk_class ConsoleWindowClass
~lButton::
MouseGetPos, cos_mousedrag_x, cos_mousedrag_y
keywait lbutton
mousegetpos, cos_mousedrag_x2, cos_mousedrag_y2
if (abs(cos_mousedrag_x2 - cos_mousedrag_x) > cos_mousedrag_treshold
or abs(cos_mousedrag_y2 - cos_mousedrag_y) > cos_mousedrag_treshold)
{
wingetclass cos_class, A
if (cos_class == "Emacs")
sendinput !w
else
sendinput ^c
}
return
~mbutton::
WinGetClass cos_class, A
if (cos_class == "Emacs")
SendInput ^y
else
SendInput ^v
return
#IfWinNotActive
;; clipx
^mbutton::
sendinput ^+{insert}
return
Script credit goes to this post. Try experimenting and comment if you get it to work. I'll try to help as much as possible.
Meanwhile, have a look at this as well. But, I don't think it is advanced enough for the function you desire.
As a long time linux user I've been desperatly searching for such functionality in osx. Mark is right - iTerm is the answer plus some settings in the X11 Preferences. Visit here for more info.
I didn't find a native way either. After trying different things I ended up using TotalTerminal.
It adds some additional functionality to the terminal app. Besides copy-on-select you can set a global key to bring up the terminal whenever you like.
I am using BetterTouchTool and have configured it to emulate a middle mouse button in Terminal application on three finger click.
You might try fiddling with your mouse settings to see if the driver lets you assign the paste function to middle-click. If it doesn't, try looking into USB Overdrive.
As for copy-on-select, I am unaware of any software that gives you this functionality, and judging from what I can find on Google, none probably exists.