1

When I SSH into a remote Ubuntu container on a particular system and open vim, I cannot paste consistently. Say I copy the string abcdefghijklmnopqrstuvwxyz to my clipboard. If I open vim, enter insert mode, and try pasting and hitting enter a few times, the result might look like:

abcdefabcdefghijklmnopqrstuvwxyz
abcdefabcdefghijklmnopqrstuvwxyz
abcdefabcdefghijklmnopqrstuvwxyz
abcdefabcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
ghijklmnopqrstuvwxyz
abcdefabcdefghijklmnopqrstuvwxyz
abcdefabcdefghijklmnopqrstuvwxyz

Note that only one line is correct; most lines repeat the first six characters of the sequence (abcdef), and in one instance, the first six characters are dropped. It is always six, regardless of what is on the clipboard.

A few things I have tried:

  • The behavior is the same if I :set paste or :set paste!.
  • I have reproduced the behavior using zsh and bash as my local shell. The remote shell is bash.
  • When I paste directly into the remote shell, paste works fine. No characters are repeated or dropped. The issue only occurs in vim.
  • When I run cat -v in the remote shell and paste, as suggested by this answer, I do not see control characters related to bracketed paste mode.
1
  • Note that :set paste! will toggle the paste option. The result depends on the previous value. As far as I can tell, you use it correctly. Just something to keep in mind. Might be safer to .set nopaste or verify through :set paste?.
    – Friedrich
    Feb 8 at 10:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.