Problem with “vi” editor while pasting

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 🙂

LET US KNOW YOUR RATINGS ON THIS BLOG HERE. ALSO FEEL FREE TO CONTACT ME HERE.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s