我不小心用NerdTree的菜单系统删除了一个重要的文件。如何恢复?
我试着查看我的回收站,并关闭了vim选项来保存swp文件。
发布于 2017-10-17 04:16:00
不是对这个问题的直接回答,但与这个主题相关。以下是我实现的一个解决方法,用于避免意外删除Vim/Neovim中的文件。
~/.vim/bundle/nerdtree/nerdtree_plugin/fs_menu.vim
取消对此行的注释:
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
并注释掉这一行(在前面加上一个双引号):
"call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
这有助于防止您通过删除(d)elete ...菜单项而意外删除NerdTREE中的文件等。
~/.Trash
现在,当您想要删除一个文件时,使用常用的NerdTREE m菜单命令,通过编辑显示的路径,将文件(m)ove到您的回收站文件夹;例如,
NERDTree Menu. Use j/k/enter and the shortcuts indicated ==========================================================
(a)dd a childnode
> (m)ove the current node
(c)opy the current node
(l)ist the current node
Rename the current node
.==========================================================
Enter the new path for the node:
/home/victoria/new3
将该路径(在我的示例中为我的用户名/主目录)更改为:
/home/victoria/.Trash/new3
然后按Enter键将该文件移动到该回收站目录。
发布于 2018-03-16 22:48:15
在Linux上我会使用extundelete工具-它对我来说非常好,所以如果是这样的话,它是ext* FS:
extundelete --restore-file=path_relative_to_fs_root /dev/sdxx请注意,您必须卸载分区,因此如果它在根分区上,则必须使用liveCD。
在windows上也有很多这样的工具。我不是Windows迷,但它可能会对你有所帮助:https://datarecovery.wondershare.com/deleted-recovery/ntfs-undelete-alternatives.html
不管怎样,快点!使用文件系统的时间越长,恢复文件的机会就越少。
https://stackoverflow.com/questions/33206366
复制相似问题