Though there are other answers, I will try to give a complete answer so that you could understand it at every level, from the issue to solutions, and how they work.
Short answer
Highly depends on your editor, underlying software/drivers, storage.
What to do: If you want to delete permanently, for most users searching "secure delete file" solves the issue. If your case is not "most user's" case - there is no short answer ;)
Paranoiac's short answer
Is recoverable, unless you remove it permanently with a combination of specific tools on high settings.
Long answer
There is missing information in your question (software, hardware, etc), so instead of answering myself I will help you answer your question yourself.
It's not that easy and straightforward. The file may pass through multiple layers and it can remain anywhere for some time or for long time.
Editor <-> Memory <-> Backup/VCS/diff disk/etc if exists <-> OS <-> File System <-> Storage cache <-> Storage
Depending on your environment configuration, some layers above may be added or removed. So to give a complete answers I will give info about each of them, you may take the points which are relevant for your case.
- Editor:
- The editor may save the old (or new) version of the file temporarily on another place. Then after deleting the file, its old (or new) version may still remain somewhere. For example, MS Word creates such temporary files, so that it could recover the file after a crash.
- If the editor software replaces the bits of the same file when editing it, then the file can get rewritten when editing. So you may use such editor to fill up the file with random bits and make it harder to recover.
But this may also depend on editor settings and file types.
Note that the word may was in italic. Even if the editor rewrites the file, it still may remain untouched/recovered (read the next points).
- Underlying software/drivers/file system:
- File Systems may mark the deleted file's space as "free" without actually cleaning it up. They do it to save performance, since full cleanup of file requires more operations (by disk, CPU). So after removing the file it may still be recoverable.
The same applies to "formatting disk", especially for "fast formatting" options. You may have seen different file recovery tools which work after deleting the file or even formatting the disk - most of them can work for this reason.
- File will remain untouched if there are other software/drivers underneath that protect initial file from getting overwritten. Those types of software include Version Control Systems, virtual differential disks, some backup software. An example is Git, which will keep the original file blocks and will create new file that holds the modified blocks.
- Storage:
Storage itself can write changed blocks on a new sector, and mark old blocks as "free". Then the file will physically remain on the storage (and is recoverable), unless it gets overwritten by another file. Example is modern SSD storage, which may do it at hardware level.
There are ways to recover data from a typical mechanical HDD's magnetic discs even when the data was overwritten. And there are specialized companies in it.
- Memory: Yes, it can remain in memory too - RAM, video RAM, cache, etc. It depends on the editor/viewer you use. Most of the software don't cleanup memory securely after using it. And for some time the file may remain recoverable from memory before the memory gets reused by other applications. For example, a typical text file may remain in RAM after editing and deleting it. And an image (or the whole screen) may be recovered from video RAM after it has been closed and deleted.
Not only image, but for example a screen of your browser may remain in video memory even after an hour.
So, if you want to get a specific answer whether your file will be deleted or not, you should also tell what file, editor, backup/VCS software, file system, hardware, storage you use.
How to actually delete the file?
This is probably the next question that you will question yourself. Well there are many software/hardware solutions. Since SuperUser is not for promoting software/hardware, instead of telling names I will tell you how to find them.
- To remove from storage: search for keywords "securely delete file". For more exact matches add your OS, hard drive type, or other info you have into the query.
- To cleanup it from memory/cache: search for "securely cleanup RAM | video RAM | hard drive cache".
As you may have noticed, the main keyword here is "securely cleanup".
Next questions may be:
- How do these software work?
They overwrite the space of the file/memory with 0s, 1s, or random bits for few rounds, so that the old information could not be recovered.
- Can I trust them?
Depends. If you want it for secure applications (such as banking), in order to get security certifications (which is required for financial institutions) then you can trust official commercial tools that have passed certifications. Be sure to check the certifications of the tool. E.g. if you are an bank admin, and regulations require that files were deleted securely after usage - then this is the case.
If you want it for yourself, can read and understand the code and algorithms - you may go for open-source battle-tested solutions too.
Hope this helps.
If there is a missing point - feel free to comment!