Say, there is a file first.txt and I want to make a new file second.txt with the same content of first.txt, is there a direct command in Vim to do that?
I don't want to first create second.txt and then copy the content of first.txt.
43 Answers
Just open first.txt and run the command:
:w second.txt 2 Although the straightforward simple answer has already been posted, I offer a fun and instructive alternative:
:!cp "%" second.txt 1 Alternatively, open the first file, then do :saveas second.txt.