Whichim
Whichim

Reputation: 3

How can I open a new document without saving the current document by using a single command in Vim

In Vim

:w saves the document document1

:wq or :x quits the document document1 after saving

wq! quits the document document1 without saving

:sav document2 or :w + :e document2 saves the document document1 and opens the document document2

What I want is that I want to open a a new document document2 without saving the document document1, and I want to do so using a single command.

Is it possible?

Upvotes: 0

Views: 25

Answers (1)

glenn jackman
glenn jackman

Reputation: 247210

You want

:e! document2

to edit document2, discarding all changes to the current buffer.

Upvotes: 1

Related Questions