Home  >  Q&A  >  body text

After configuring Vim, Vim cannot indent normally when copying and pasting code.

Describe the problem

After configuring Vim, the pasted code cannot be indented normally
I think there is something wrong with the configuration

But I can’t find which configuration it is (I checked the configuration about indent, it’s still the same)

Context

  1. Vim all platforms all versions

Reappearance

  1. Use my vimrc

  2. Try copying and pasting a piece of JavaScript code, etc. (others are also acceptable)

Related codes

  1. My vimrc configuration: https://www.jianguoyun.com/p/... (Access Password:GjLkcY)

Error message

Related screenshots

What methods have been tried but still have no solution (relevant links attached)

Problem simplification

过去多啦不再A梦过去多啦不再A梦2712 days ago563

reply all(5)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 16:37:29

    :set paste

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 16:37:29

    How did you paste it? Mouse or shortcut keys? I have never encountered this kind of problem. This is my vim configuration file. You can refer to it
    https://github.com/HmyBmny/vi...

    reply
    0
  • 为情所困

    为情所困2017-05-16 16:37:29

    Can be set in .vimrc

    set pastetoggle=<F9>

    When pasting code in the future, you can solve this problem by using <F9>. After pasting, you need to switch back through <F9>, otherwise an error will occur in the automatic indentation.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 16:37:29

    In the past, I always had problems by right-clicking paste when pasting, and I couldn’t figure it out. Until later, someone told me that I must first enter I to enter the input mode, and then I can right-click paste.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 16:37:29

    There are two ways to paste using the keyboard:
    In N mode, enter "+p to paste the contents of the clipboard. This mode will not modify the indentation
    In I mode, enter <Ctrl+R>+ You can also paste the contents of the clipboard, but in this way, the indentation will be affected

    reply
    0
  • Cancelreply