5

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.

3

I believe the relevant .Xresources settings are:

URxvt.perl-ext-common: default,selection-autotransform
URxvt.selection-autotransform.0: s/ +$//gm

Which I got from http://www.reddit.com/r/emacs/comments/1ox5pf/why_fill_the_empty_space_with_spaces/

2

Perhaps not surprisingly, the terminal decides what to select. More precisely, different terminals handle text selection in different ways. On some terminals, such as rxvt-unicode, this can be controlled to some degree.

The relevant xresources (settings) are:

URxvt.cutchars: string           -- where to split words on double-clicks
URXvt.tripleclickwords: boolean  -- prevent copying of the whole line

I think The last one is exactly what you are looking for. If you give more details about your setup, people familiar with your terminal might give you a more appropriate answer. In the mean time, you could try urxvt.

  • 1
    Thanks. My setup is pretty common i think: I use the standard terminal (GNOME-Terminal 3.6.0) on a Ubuntu 12.10 with no extra configuration. From there i open a SSH session to a webserver which also runs Ubuntu and open a vim session there. – Michael Härtl Mar 17 '13 at 10:18

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.