Saturday, December 8, 2007

Copy and paste in Linux

This week, I observed someone working on Linux struggling with copying and pasting SQL code from Emacs to a Firefox textarea. The Ctrl+C/Ctrl+V way of doing things (which I first saw on Windows, don't know who "invented" it) is nice, but once you tried the X11 way of copy and paste (using the X selection), you will never want to live without it. Being a happy user of X11 copy/paste for some years now, here's a short note for all who have not yet tried this great feature :)

To copy some text, simply select it with the mouse (no, really - just select it, no keystrokes). To paste the text you just selected, middle-click with your mouse directly where you want to paste the text - the text will be copied! As clipboard handling in Linux/X11 was (is?) a bit inconsistent, there might be some things to watch out for. For example you can only paste the selected text if the window in which you selected the text is still open.

Once you get used to that, it's really useful and you can work more productively. Nice side-effect: You can middle-click inside an open tab in firefox and have the URL in the X selection get loaded in this tab. So, to open a URL from a text file (or similiar), just select the URL, open a new tab in Firefox (or use an existing one) and middle-click inside the content area of the tab. Firefox will load the URL you just "pasted". Simple.

No comments: