• 追加された行はこの色です。
  • 削除された行はこの色です。
#author("2020-04-20T11:36:02+09:00","default:ryuichi","ryuichi")
#author("2020-04-20T11:40:02+09:00","default:ryuichi","ryuichi")
* スクラッチバッファを導入する [#rdab4858]

** スクラッチバッファとは? [#mdad8cc2]

- 作業用のバッファ。一時的なファイル(バッファ)上で編集し、終了時に保存しない
- 通常のバッファでは編集後にファイル保存が促され、いちいちキャンセルする必要があり、使い勝手が悪い

** 標準入力を読み込んでVimを起動する時にスクラッチバッファを導入する [#n90ba218]

 command! ScratchBuffer setlocal buftype=nofile bufhidden=hide noswapfile
 autocmd StdinReadPre * :ScratchBuffer


- 無名バッファに '''setlocal buftype=nofile bufhidden=hide noswapfile''' を指定する
- 無名バッファに '''setlocal buftype=nofile bufhidden=hide noswapfile''' を指定するコマンドを作り、スクラッチバッファを実現する
- '''autocmd StdinReadPre''' でVim起動時にスクラッチバッファを有効にする

** 参考 [#n01abe07]

** 参考 [#n01abe07]
- https://nanasi.jp/articles/howto/file/workingfile.html 
- https://vi.stackexchange.com/questions/22314/saving-a-scratch-buffer
― https://vi.stackexchange.com/questions/2725/how-to-force-quit-if-input-was-stdin



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS