Vim replace entire file content

If you want to replace/overwrite the entire file content by pasting the command then you need to followin these steps:

Type ESC to come out of insert mode.

Type the following command and hit the enter key:

:%d

The above command will delete all the lines/content in that file.

Type i to enter into INS mode.

Press CMD + V to paste the new content.

Hit ESC and then type :wq and hit enter key.

You are done with replacing/overwriting the entire file content with Vim.