Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    The way you suggested is the way it should be done. I.e., put some prepopulated content in a file, in some way, shape or form then open it with $EDITOR filename command. Do you need something different ? If you are inquiring if the OS or the editor of your choice supports such an arrangement, without requiring creating the file somehow, it all depends the editor of your choice and capabilities of that editor. It is not something that OS could provide for you. Commented Feb 22, 2016 at 22:04
  • I just want to put the editor in the state it would be in if you typed a few lines after opening it. If at that point you quit the editor, It should throw the file away. That's the behaviour of every editor I have used, so I thought this might be possible somehow. Commented Feb 22, 2016 at 22:13
  • If it's doable, it's not doable in a generic way such that you can use $EDITOR. Commented Feb 22, 2016 at 22:20
  • I had imagined something like what git does when you commit, though I guess that uses some trickery with git hooks below the hood to move the file from <repo>/.git/COMMIT_EDITMSG to a useful location after you save it. Commented Feb 22, 2016 at 22:23
  • The behavior of ANY editor, depends on the editor's capabilities. And in most part, every editor, who opens a document upon invocation, do not throw the document away. If you made a change it asks you if you want to save it. If you haven't made any change, no-harm, no-fault it keeps the file as it for the next invocation. Your expectancies are not based on an EDITOR's capability, it is the way you configure it to act the way you want it to. Commented Feb 22, 2016 at 22:32