1. 程式人生 > >vi is failed with error "E382: Cannot write, 'buftype' option is set" in Linux

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

rom set ror ast style led not file ati

在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