I have the following setting in my .vimrc:

set listchars+=space:·

for formatting purposes (spaces vs tabs, extra spaces, etc) and thanks to a proper color scheme, these dots do not disturb much. So far, so good. The problem is that when I select some text with the mouse to copy it and paste it with the mouse wheel, the spaces are copied as '·' and not as ' '. That does not happen inside Vim with regular copy operations or even if I copy the same text to the * register (when possible). That does not suffice though, because Vim does not support the clipboard feature in all the machines I access remotely and in those cases I still need the "bloody" mouse :) Is there any way to avoid this apart from getting rid of my beloved setting in .vimrc? Highlighting the spaces or giving them a different color would be too annoying, by the way.

Example: original line on top and pasted one below. The grey dots are treated as spaces but the green ones are treated as proper dots.

enter image description here

Thanks a lot and best regards

  • I don't think you can solve this with vim: when you're copy/pasting with the mouse, you're just copying characters in your terminal window. The terminal doesn't know you're running vim or that the thing you are copying that is not a space should actually be a space.
    – larsks
    Sep 27, 2022 at 13:33
  • You can define a command or macro prior to copying (yanking) and pasting extrinsic of vim, to temporarily unset the setting(s) you have in place for visible whitespace, and reset it afterward. vim has no way of knowing what you're going to do to its terminal, nor does your terminal emulator have any way to know whether a · is something you want it to parse as a space when copied thenceforth.
    – DopeGhoti
    Sep 28, 2022 at 0:18

1 Answer 1


The easiest solution I found: set list! to unset all my fancy characters, then copy, then set list! again :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .