28

I'm running Ubuntu 10.04 and I find it annoying that by default the copy/paste functionality also pastes the text format. Most of the time when I copy/paste text I only want to paste the ascii text without any formatting. Is there a way to configure that behavior?

2
  • 1
    Again a feature designed without UX. I am willing to bet style copying is useful to less than 5% of the users in less than 20% of cases. This should have never made it up to the default feature! – Augustin Riedinger Dec 2 '19 at 14:11
  • should be the other way around: right click "paste with formatting" for the rare cases when you want format as well – Leevi L Feb 3 at 11:44
4

I use parcellite Install parcellite. It keeps a history of the clipboard.

5
  • I tried Parcellite and it seems to almost do what I want. The thing is that the Parcellite history saves the information in text only but the First copy I do stills contains the formatting. So I need to copy a string and before to paste it I have to click the Parcellite panel icon, then click the text I just copied, then I can paste it in text only. – jmbouffard Jun 3 '11 at 14:25
  • I accepted this as "accepted answer" since there was nothing better. And it is A LOT faster than pasting to gedit first and then in my document. – jmbouffard Jun 3 '11 at 14:28
  • @jmbouffard "since there was nothing better" Now there is, see the answer of teehoo, since using Parcellite.It sounds overcomplicated… – feeela Sep 7 '11 at 15:10
  • 1
    CTRL-SHIF-V will do it without having to install anything... – Max L. Feb 18 '14 at 13:33
  • Parcellite does copy the style. – Augustin Riedinger Dec 2 '19 at 14:09
43

In fairly recent Ubuntus you can use Ctrl-Shift-v to paste plain text.

5
  • 12
    Anyone know if there's a way to make this the default behaviour? – Brandon Bertelsen Oct 22 '13 at 19:24
  • Seams not to work whit kubuntu. – Den May 9 '18 at 9:12
  • Works great on my Ubuntu 14.04 - what a relief to find such an easy solution! – robocat Nov 16 '18 at 23:06
  • Works on Manjaro though – Andra Jan 7 '20 at 14:37
  • how to swap the behaviours of Ctrl-Shift-V and Ctrl-V ? – Leevi L Feb 3 at 11:46
3

I've found a way to achieve this after some searching online and experimenting with my environment.

You can create a custom shell script which you can then bind to a key shortcut in your desktop environment. I'm using Xfce on Linux Mint (which is based on Ubuntu). Xfce allows me to override Ctrl-C by simply defining that as the shortcut in Settings -> Keyboard -> Application Shortcuts, but I prefer using a different shortcut, Ctrl-Alt-C, so that I'm still able to copy with formatting in the rare cases I need to.

Here's how I did it.

Install xclip:

apt-get -y install xclip

I don't know about other desktop environments, but Xfce didn't like me using a pipe in the custom keyboard command, so I had to make a script with the xclip-line, which is then bound to my keyboard shortcut (Ctrl-Alt-C).

My personal habit is putting custom commands in ~/.bin and then adding that directory to the PATH variable.

Here's how you do that, if so inclined:

mkdir ~/.bin
echo 'export PATH=~/.bin:$PATH' >> ~/.bashrc

(Note that you will need to re-initialize your session for that change to take effect, meaning you'll have to log out of your desktop environment and back in again. See if it worked by typing echo $PATH in a terminal after having logged in again.)

I've then created the script ~/.bin/copy-without-formatting with the following content:

#!/bin/bash
xclip -o | xclip -selection clipboard

Remember to make it executable with the following line:

chmod +x ~/.bin/copy-without-formatting

Then, since I'm using Xfce, I've gone to Settings -> Keyboard -> Application Shortcuts and added a shortcut with the full path to the script, without variables or a tilde. So if my username were mrgaga, the string would be /home/mrgaga/.bin/copy-without-formatting. Then I've configured the shortcut.

Xfce activates the changes immediately when I've closed the window so you should be able to check if it works right away, without logging out and in again, at least if your environment is similar enough to mine.

I hope it helps.

2

I don't know of a way to do it automatically. A workaround of course is to paste it into gedit Install gedit and copy it from there.

5
  • 4
    I've been using this workaround for a while but now I'd like to find a real solution. Thanks for the suggestion. – jmbouffard May 30 '11 at 18:09
  • Another way (likely not secure) is to use your URL bar as a deformat tool. Most of the time it is easier to get to than launching another application. – Elijah Lynn May 19 '17 at 21:16
  • I don't usually down vote since I find this counter productive, but definitely this is not a solution. At the best an awful workaround. – Augustin Riedinger Dec 2 '19 at 14:05
  • @AugustinRiedinger I agree this this only a workaround, but to say that it is not a solution implies that it doesn't work. Does it not work? Let me know if there is something broken. – Flimm Dec 2 '19 at 15:25
  • You are correct, apologies because you received my anger toward this wrongly designed feature and your solution, though painful is perfectly acceptable. – Augustin Riedinger Dec 2 '19 at 16:29
0

In my Ubuntu 19 you can use Shift-Insert to paste text without formatting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.