How to avoid trailing spaces when you copy something from terminal?

Posted by Michael Härtl on Super User See other posts from Super User or by Michael Härtl
Published on 2013-03-16T11:35:41Z Indexed on 2013/11/10 4:00 UTC
Read the original article Hit count: 197

Filed under:
|
|

I often copy a code snippet from a SSH terminal session where i'm logged in to some remote server and have a file opened in vim, for example to paste it here into an answer at SO. It frequently happens, that the code is padded with trailing spaces to match the terminal width.

Whereas i've seen this on both, my Ubuntu and Windows machines (using putty) i think, it doesn't happen always. I was not able to figure out when it happens, though.

So i wonder how i can avoid those trailing spaces which i have to remove manually all the time in the textarea, where i copy it to.

Note, that the files do not have trailing spaces on the server! It only happens if i select and copy some text.

© Super User or respective owner

Related posts about terminal

Related posts about copy-paste