How can I delete the current file in vim?

后端 未结 6 2003
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 01:35

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

6条回答
  •  自闭症患者
    2021-01-30 01:54

    Take a look at Delete files with a Vim command. The Comments section should have what you're looking for:

    Basically, Rm will delete the current file; RM will delete the current file and quit the buffer (without saving) in one go.

    Alternatively, you could just issue a shell command to remove the current file:

    :!rm %
    

提交回复
热议问题