Reputation: 128
When I copy some text from one opened window (browser and text editor) to vim by pressing Shift + Insert, The text is inserted in a way that each consecutive line is shifted right with progressive amount of tabs. Meaning that second line is shifted by 1 tab, 3rd line is shifted by 2 tabs, 4th line is shifted by 3 tabs, etc. How to prevent this weird insertion and have text look in vim the same way as in the source window?
while True:
reads = [p.stdout.fileno(), p.stderr.fileno()]
ret = select.select(reads, [], [])
for fd in ret[0]:
if fd == p.stdout.fileno():
read = p.stdout.readline()
Upvotes: 5
Views: 1151
Reputation: 3105
before you paste anything, try using
:set paste
For completeness purposes, when you are done, you can go back to previous/default mode with:
:set nopaste
otherwise things like autoindent would not work. (Thanks to Anurag Peshne for pointing this out.)
Upvotes: 6
Reputation: 1178
:set paste
will disable auto-indent in vim. After paste, use :set nopaste
to re-enable your auto indent feature in vim
But if you found it annoying to toggle between paste
and nopaste
, just simply use the +
register to paste:
"+p
This will ignore any paste options in vim, just paste as-it.
more info on system clipboard register: http://vim.wikia.com/wiki/Accessing_the_system_clipboard
Upvotes: 3