3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

E382: Cannot write, 'buftype' option is setの対処法

Last updated at Posted at 2019-09-19

E382: Cannot write, 'buftype' option is set

vimでファイル編集していたら以下のアラートが出て保存できなくなった


E382: Cannot write, 'buftype' option is set

結論

buftypeをemptyに変更すれば治った


:set buftype=

なんでこうなった?

ドキュメントを読んだ
options - Vim日本語ドキュメント: https://vim-jp.org/vimdoc-ja/options.html#'buftype

'buftype' 'bt'          文字列 (既定では "")
                        バッファについてローカル
        このオプションはバッファの種類を指定する。
          <empty>       普通のバッファ
          nofile        ファイルと関連がなく、書き込まれる予定のないバッファ
          nowrite       書き込まれる予定のないバッファ
          acwrite       いつも自動コマンドBufWriteCmdで書き込まれる予定のバッ
                        ファ。
          quickfix      エラーリスト :cwindow またはlocationリスト :lwindow
                        を含んだquickfixバッファ。
          help          ヘルプバッファ (ユーザーが手動でこれに設定することはな
                        いはずである)
          terminal      terminal のためのバッファ (ユーザーが手動でこれを設
                        定することはないはずである)
          prompt        プラグインに使われることを意図した、最後の行だけを編集
                        できるバッファ、prompt-buffer を参照。
                        {+channel 機能付きでコンパイルされたときのみ有効}
          popup         ポップアップウィンドウで使われるバッファ
                        {+textprop 機能付きでコンパイルされたときのみ有効}

        このオプションはオプション 'bufhidden' や 'swapfile' と共に使われ、特
        殊な用途のバッファを指定する。special-buffers を参照。

        このオプションの変更には十分注意すること。多くの副作用が起こるかもしれ
        ない!

buftypeを確認


:set buftype?

-> buftype=nofile

なぜかnofileでファイルを開いてしまっていたらしい

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?