While doing some of the basic tasks in Linux (being a fresher 🙂 in Linux), I found an issue while pasting the content to a file. I had some contents in another file and I tried copy-pasting the contents to a newly created file (created using vi command). Once the content is pasted, I could see that all the lines in that content is appended with a hash string in the beginning (string turning into comments). I tried copy pasting several times which failed with the same issue. If you face such an issue, this post is absolutely for you 🙂 .
vim has got a great mode for copy pasting kind of tasks. And that is called set paste.
- After opening the file, before you press i (for insert), make sure that you type :set paste and then press i.
- Now enjoy pasting the contents in your file.
- Once you’re done with pasting the contents make sure that you set the mode back to no paste by typing :set nopaste.
- Now save your file by typing :wq
Happy copy pasting 🙂