Home Explore Blog CI



neovim

21th chunk of `runtime/doc/editing.txt`
4786512e6abf6ade64478a9c3505c515455c83305f27afdb0000000100000fa2
 To insert a <NL> character in the file split a line.  When writing the
  buffer to a file a <NL> will be written for the <EOL>.
- Vim normally appends an <EOL> at the end of the file if there is none.
  Setting the 'binary' option prevents this.  If you want to add the final
  <EOL>, set the 'endofline' option.  You can also read the value of this
  option to see if there was an <EOL> for the last line (you cannot see this
  in the text).

==============================================================================
9. Encryption						*encryption*

					                *:X* *E817* *E818* *E819* *E820*
Support for editing encrypted files has been removed.
	https://github.com/neovim/neovim/issues/694
	https://github.com/neovim/neovim/issues/701

==============================================================================
10. Timestamps					*timestamp* *timestamps*

Vim remembers the modification timestamp, mode and size of a file when you
begin editing it.  This is used to avoid that you have two different versions
of the same file (without you knowing this).

After a shell command is run (|:!cmd| |suspend| |:read!| |K|) timestamps,
file modes and file sizes are compared for all buffers in a window.   Vim will
run any associated |FileChangedShell| autocommands or display a warning for
any files that have changed.  In the GUI this happens when Vim regains input
focus.

							*E321* *E462*
If you want to automatically reload a file when it has been changed outside of
Vim, set the 'autoread' option.  This doesn't work at the moment you write the
file though, only when the file wasn't changed inside of Vim.
							*ignore-timestamp*
If you do not want to be asked or automatically reload the file, you can use
this: >
	set buftype=nofile

Or, when starting gvim from a shell: >
	gvim file.log -c "set buftype=nofile"

Note that if a FileChangedShell autocommand is defined you will not get a
warning message or prompt.  The autocommand is expected to handle this.

There is no warning for a directory.  But you do get warned if you started
editing a new file and it was created as a directory later.

When Vim notices the timestamp of a file has changed, and the file is being
edited in a buffer but has not changed, Vim checks if the contents of the file
is equal.  This is done by reading the file again (into a hidden buffer, which
is immediately deleted again) and comparing the text.  If the text is equal,
you will get no warning.

If you don't get warned often enough you can use the following command.

							*:checkt* *:checktime*
:checkt[ime]		Check if any buffers were changed outside of Vim.
			This checks and warns you if you would end up with two
			versions of a file.
			If this is called from an autocommand, a ":global"
			command or is not typed the actual check is postponed
			until a moment the side effects (reloading the file)
			would be harmless.
			Each loaded buffer is checked for its associated file
			being changed.  If the file was changed 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

Title: Vim: Binary File Editing, Encryption Removal, and Timestamp Handling
Summary
This section discusses the completion of the binary file editing discussion, mentioning how the 'binary' option prevents Vim from appending an <EOL> at the end of a file, and how to add the final <EOL> using the 'endofline' option. It then notes that encryption support has been removed from Vim. Lastly, this section describes how Vim manages timestamps to prevent editing different versions of the same file. It explains the 'autoread' option for automatic reloading, the `:checktime` command for manually checking timestamps, and how Vim handles file changes and potential conflicts, including scenarios where files are modified externally or become directories.