Can't open file for writing
2012-02-25 12:04
651 查看
Steven Occhipinti: Can't open file for writing
If you use vim, you have probably come across this error before.
It normally happens when you don't have permission to write to your chosen destination.
The temporary solution has traditionally been to save your changes to somewhere where you do have permissions (such as /tmp or ~), then use sudo to cp it across, or re-open the file in vim with sudo.
A collegue at work showed me a great trick to get around this when it happens (Thanks Rich). All you have to do is add this to your .vimrc file:
Works brilliantly!
If you use vim, you have probably come across this error before.
It normally happens when you don't have permission to write to your chosen destination.
The temporary solution has traditionally been to save your changes to somewhere where you do have permissions (such as /tmp or ~), then use sudo to cp it across, or re-open the file in vim with sudo.
A collegue at work showed me a great trick to get around this when it happens (Thanks Rich). All you have to do is add this to your .vimrc file:
command! W w !sudo tee % > /dev/null
Then when you come across this error again, instead of of using :w you can use :W and it will prompt you for your sudo password before saving.Works brilliantly!
相关文章推荐
- can't open output file for writing: outfield, errno = 21 for architecture x86_64
- vi 新建文件保存文件时遇到的问题:E212: Can't open file for writing
- vim E212:Can't open file for writing 报错
- vi E212:Can't open file for writing 报错
- vi 新建文件保存文件时遇到的问题:E212: Can't open file for writing
- vi / vim保存文件时遇到的问题:E212: Can't open file for writing
- vi 新建编辑文件时报错 E212 can’t open file for writing
- linux操作提示:“Can't open file for writing”或“operation not permitted”的解决办法
- "ifcfg-eth0" E212: Can't open file for writing Press ENTER or type command to continue
- Linux :: vi E212: Can't open file for writing
- vi编辑文件保存后,提示“Can't open file for writing Press ENTER or type command to continue”
- Linux操作提示:“Cant open file for writing”或“operation not permitted”的解决办法
- Doxygen: Could not open file xxx for writing - error 0x80070052
- PCL错误提示: what()::[pcl::PCDWriter::writeASCII] Could not open file for writing!
- Python IOError: File not open for writing
- Fatal error LNK1168: cannot open *.exe file for writing
- updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
- HBase中RegionServers报异常: No lease on /apps/hbase/data/oldWALs... File is not open for writing
- updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db
- linux --updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'