Home Explore Blog CI



neovim

22th chunk of `runtime/doc/editing.txt`
6ab5a3880c4dcfa34a1de0e5baa1e188417a3f822088dcec0000000100000f56
 Vim will take
			action.  If there are no changes in the buffer and
			'autoread' is set, the buffer is reloaded.  Otherwise,
			you are offered the choice of reloading the file.  If
			the file was deleted you get an error message.
			If the file previously didn't exist you get a warning
			if it exists now.
			Once a file has been checked the timestamp is reset,
			you will not be warned again.
			Syntax highlighting, marks, diff status,
			'fileencoding', 'fileformat' and 'binary' options
			are not changed.  See |v:fcs_choice| to reload these
			too (for example, if a code formatting tools has
			changed the file).

:[N]checkt[ime] {filename}
:[N]checkt[ime] [N]
			Check the timestamp of a specific buffer.  The buffer
			may be specified by name, number or with a pattern.


							*E813* *E814*
Vim will reload the buffer if you chose to.  If a window is visible that
contains this buffer, the reloading will happen in the context of this window.
Otherwise a special window is used, so that most autocommands will work.  You
can't close this window.  A few other restrictions apply.  Best is to make
sure nothing happens outside of the current buffer.  E.g., setting
window-local options may end up in the wrong window.  Splitting the window,
doing something there and closing it should be OK (if there are no side
effects from other autocommands).  Closing unrelated windows and buffers will
get you into trouble.

Before writing a file, the timestamp is checked (unless "!" was used).
If it has changed, Vim will ask if you really want to overwrite the file:

	WARNING: The file has been changed since reading it!!!
	Do you really want to write to it (y/n)?

If you hit 'y' Vim will continue writing the file.  If you hit 'n' the write is
aborted.  If you used ":wq" or "ZZ" Vim will not exit, you will get another
chance to write the file.

The message would normally mean that somebody has written to the file after
the edit session started.  This could be another person, in which case you
probably want to check if your changes to the file and the changes from the
other person should be merged.  Write the file under another name and check for
differences (the "diff" program can be used for this).

It is also possible that you modified the file yourself, from another edit
session or with another command (e.g., a filter command).  Then you will know
which version of the file you want to keep.

The accuracy of the time check depends on the filesystem.  On Unix it is
usually sub-second.  With old file systems and on MS-Windows it is normally one
second.  Use `has('nanotime')` to check if sub-second time stamp checks are
available.

There is one situation where you get the message while there is nothing wrong:
On a Win32 system on the day daylight saving time starts.  There is something
in the Win32 libraries that confuses Vim about the hour time difference.  The
problem goes away the next day.

==============================================================================
11. File Searching					*file-searching*

The file searching is currently used for the 'path', 'cdpath' and 'tags'
options, for |finddir()| and |findfile()|.  Other commands use |wildcards|
which is slightly different.

There are three different types of searching:

1) Downward search:					*starstar*
   Downward search uses the wildcards "*", "**" and possibly others
   supported by your operating system.  "*" and "**" are handled inside Vim,
   so they work on all operating systems.  Note that "**" only acts as a
   special wildcard when it is at the start of a name.

   The usage of "*" is quite simple: It matches 0 or more characters.  In a
   search pattern this would be ".*".  Note that the "." is not used for file
   searching.

   "**" is more sophisticated:
      - It ONLY matches directories.
      - It matches up to 30 directories deep by default, so you can use it to
	search an entire directory

Title: Vim: Timestamp Checks, File Overwrite Warnings, and File Searching
Summary
This section continues explaining timestamp checks in Vim, detailing how the `:checktime` command handles different scenarios, such as when a file is reloaded, deleted, or newly created. It covers the behavior of reloading buffers in visible or special windows, noting restrictions and potential issues with autocommands. It then explains the warning Vim gives when attempting to overwrite a file that has been changed since it was read, discussing possible causes and suggesting solutions like merging changes. The section also touches on the accuracy of time checks and a specific Win32 issue related to daylight saving time. Finally, the section introduces Vim's file searching capabilities, specifically downward searching with wildcards like "*" and "**", detailing their usage and limitations in matching directories.