From bc0affc8329d3698ae7bb2fdaa7d737adeddc60f Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Sun, 16 Oct 2022 02:01:25 +0200 Subject: [PATCH] vim:autocmd: Do not mark stdin as modified Set `nomodified` after reading from standard input. This way the buffer can be closed without error message. This will **not** disable modified warnings completely. If the input is modified after read, vim will reset `modified` (As it should). --- .config/vim/vimrc.d/80-autocommands.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index e2aead5..7111a48 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -62,3 +62,9 @@ augroup highlight_current_word au CursorHold * call HighlightCurrentWord() au CursorMoved * match augroup END + +" Do not mark input from stdin as modified +augroup stdin_not_modified + au! + au StdinReadPost * set nomodified +augroup END