Pasting text in vim makes each line shift to the right

When I copy text from one open window (browser and text editor) into vim by pressing Shift + Insert, the text is inserted in such a way that each consecutive line is shifted to the right with a progressive number of tabs. This means the second row is shifted 1 tab, the 3rd row is shifted 2 tabs, the 4th row is shifted 3 tabs, etc. How can I prevent this strange insertion and view the text in vim the same way as in the original 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()

      

+3


source to share


2 answers


before inserting anything try using

:set paste

      

For the sake of completeness, when you're done, you can revert to the previous / default with:



:set nopaste

      

otherwise things like autoindent won't work. (Thanks to Anurag Peshna for pointing this out.)

+5


source


: install paste

will disable automatic indentation in vim. After pasting, use :set nopaste

to re-enable the auto indent feature in vim

But if you find it annoying to switch between paste

and nopaste

, just use case +

to insert:



"+ p

This will ignore any insert options in vim, just insert them like. it.

More information about the system clipboard register: http://vim.wikia.com/wiki/Accessing_the_system_clipboard

+2


source







All Articles