Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is there extra whitespace after newline when pasting using Screen?

I am using screen to copy code that I am viewing using Vim from one window to another window currently editing a file with Vim. Unfortunately, when pasting onto the second window I get increasingly more white space to the left of my input after every newline. How is this whitespace finding its way onto my buffer?

I've attempted to turn off auto indenting in case Vim was adding the extra whitespace, but the problem persists.

Here is information that might be pertinent:

  • OSx 10.6.8
  • Both files are Unix style.
  • Screen version: 4.00.03
  • Vim version: 7.3
  • Underlying terminal type is: xterm-color
like image 715
Daeden Avatar asked Feb 07 '13 20:02

Daeden


1 Answers

Are you copying using the mouse or some other non-vim ways? If yes you must do :set paste before pasting and :set nopaste after. See :h pastetoggle for a quick mapping.

If all your vim sessions are local and Vim supports it (:echo has('clipboard')<CR> should echo 1), you should use your system clipboard: "+y to yank and "+p to paste without that pesky indenting.

Or, better, open your files in the same Vim session.

like image 178
romainl Avatar answered Oct 19 '22 13:10

romainl