from:http://blog.csdn.net/commshare/article/details/6215088 Thanks to the cattle people for their articles. Solved me in vim use, A headache. When Vim creates a new file, the sticky code is automatically indented, resulting in a very confusing format. According to the experience of bloggers, in/etc/vim, modify VIMRC, add set pastetoggle=<f9> before pasting code, enter insert mode, press F9, you can turn off auto indent. When you need to write your own code, into the insert mode, the default is automatically indented. =====vim Copy code contains comments when formatting is lost
Each time you copy the code, if the code has//such comments are easy to let the format out of the way, the following settings can be avoided this situation.
Cancel Auto indent when pasting codeVim in the paste code will be automatically indented, the code to make a mess, and maybe even because of a line of comments caused by the subsequent code is all commented out, I know that a classmate this time will use VI to open the file and paste it up (I was like this before), in fact, need to set up the first Set paste Then paste into insert mode, and the code will not be automatically indented. But the code needs to be automatically indented, but also to change back: Set Nopaste The most convenient way is to add a sentence in the. VIMRC: Set pastetoggle=<f9>Later in insert mode, you can toggle auto indent by pressing the F9 key. |
Http://hi.baidu.com/hellosim/blog/item/a7b165151089fae8c3ce798b.html
Vim Paste Code Format confusion Solution