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

Posted lily_z

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vi is failed with error "E382: Cannot write, 'buftype' option is set" in Linux(示例代相关的知识,希望对你有一定的参考价值。

在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(示例代的主要内容,如果未能解决你的问题,请参考以下文章

Installation failed with message...It is possible that this issue is resolved by uninstalling an exi

iOS 开发问题总结 PAC Fetch failed with cached error [NSURLErrorDomain:-1004]

Recover With Until Time fails With RMAN-20207 When Time Is Before Last RESETLOGS (Doc ID 159405.1)(示

Windows UDP sockets: recvfrom() fails with error 10054

ERROR: child process failed, exited with error number 51

解决『Manifest merger failed with multiple errors, see 』