How can I delete from the disk the current open file from within vim? Would be nice to also close the buffer.
I see you can use NERDTree for that, but I don\'t use this
Sometimes a plugin can be an attractive solution even for a simple problem. In this case we're lucky as there is eunuch.vim by the almighty Tim Pope.
In its own words eunuch.vim provides
Vim sugar for the UNIX shell commands that need it the most. Delete or rename a buffer and the underlying file at the same time. Load a
find
or alocate
into the quickfix list. And so on.
Perfect. It has what we need, plus some additional tools if we're on a UNIX system.
The command you are looking for is
:Remove!
Again, remap it if you need it a lot, e.g. :nnoremap
.