Skip to content
Advertisement

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

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement