W16: Warning: Mode of file has changed

33 views
Skip to first unread message

Eli the Bearded

unread,
Nov 10, 2020, 1:17:57 PM11/10/20
to vim...@googlegroups.com
Help has this to say:

*W16*
Warning: Mode of file "{filename}" has changed since editing started

When the timestamp for a buffer was changed and the contents are still the
same but the mode (permissions) have changed. This usually occurs when
checking out a file from a version control system, which causes the read-only
bit to be reset. It should be safe to reload the file. Set 'autoread' to
automatically reload the file.

Is there a fix besides set autoread? In my usage, 100% of the time I get
this warning when I run a command like

:! chmod 755 %

I get that it is helpful to detect for some usecases, but I'd like this
to just be silenced and ignored all of the time. I'm hoping there is
some vim setting I don't know about which will take a list of
warnings to not warn about.

Elijah

Bram Moolenaar

unread,
Nov 11, 2020, 3:40:34 PM11/11/20
to vim...@googlegroups.com, Eli the Bearded
You can use the FileChangedShell autocommand and check that v:fcs_reason
is equal to "mode". Set v:fcs_choice to "ask" if not.

--
hundred-and-one symptoms of being an internet addict:
235. You start naming your kids Pascal, COBOL, Algol and Fortran.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages