用VIM打开一个文件时,出现一下错误信息提示:
E303: Unableto open swap file for "[No Name]", recoveryimpossible
在命令行模式下执行:
:help E303
输出相关信息如下:
Unable to open swap file for"{filename}", recovery impossible
Vim was not able to create a swapfile. You can still edit the file, butif
Vim unexpected exits the changeswill be lost. And Vim may consume a lotof
memory when editing a bigfile. You may want to change the 'directory'option
to avoid thiserror. See |swap-file|.
继续在命令行模式下执行:
:set directory?
输出相关信息如下:
directory=~/.data/swap
在相应的.data目录下如果不存在该swap目录则创建
解决办法:mkdir ~/.data/swap/
详情请见:http://blog.sina.com.cn/s/blog_53c2fa210100ki1c.html
可是在相应目录下我已经存在该目录,但是又出现了这个错误,怎么办呢?
后来发现使用sudo打开,则不会有该问题,则猜测原因是:相应目录权限不对
解决办法:sudo chmod -R 777~/.data/swap