Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Inserting text in vim causes each line to be shifted right




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()
like image 585
user3610796 Avatar asked Mar 15 '23 06:03


1 Answers

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.)

like image 152
Alp Avatar answered Mar 24 '23 00:03