I want to replace a file with another file I have written in a text editor. I have cleared the current file in the vim editor, but when I try to paste my new code into the empty file, it does not let me do so. How can I paste into the vim editor?
It sounds like you're in the scratchpad of vim.. Make sure you get into the file first.
Starting from the command line:
vim path/to/my_file.txt
:set paste
i
<Paste your code here>
<Hit the escape key>
:w
:q
If vim is already open:
:e path/to/my_file.txt
:set paste
i
<Paste your code here>
<Hit the escape key>
:w
:q
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.