码迷,mamicode.com
首页 > 系统相关 > 详细

vi is failed with error "E382: Cannot write, 'buftype' option is set" in Linux

时间:2017-12-08 16:40:22      阅读:408      评论:0      收藏:0      [点我收藏+]

标签:local   inux   file   lin   遇到   erro   命名   option   bsp   

在linux下生成jar文件遇到了编码问题,于是想vi t.jar,在保存是报错:E382: Cannot write, ‘buftype‘ option is set

解决方法:

可以用下面的命名查看buftype的设置,当buftype=nofile时,不能保存文件,只有当buftype=空时,才可以保存

>> vi t.jar

>> :verbose set buftype

在文件的最下方可以看到

  buftype=nofile

    Last set from /usr/share/vim/vim74/autoload/zip.vim

  Press ENTER or type command to continue

 

修改buftype的方法:

>> vi t.jar

>> :setlocal buftype=

>> :verbose set buftype

在文件的最下方可以看到

  buftype=

然后就可以修改想要修改的内容,然后保存了

比如

>> :set fileencoding=latin1

>> :wq!

这样就会修改成功

 

如果想在保存前改回原设置,可用下面的命令:

>> :setlocal buftype=nofile

默认保存完,也是改回了nofile

vi is failed with error "E382: Cannot write, 'buftype' option is set" in Linux

标签:local   inux   file   lin   遇到   erro   命名   option   bsp   

原文地址:http://www.cnblogs.com/z1500592/p/8005136.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!