Home Explore Blog CI



neovim

20th chunk of `runtime/doc/editing.txt`
c9d3b6bef86affa508b12c594eee575715d563db050ad3f00000000100000fa4
 another window doesn't
change anything for the current directory.

When |:lcd| has been used for a window, the specified directory becomes the
current directory for that window.  Windows where the |:lcd| command has not
been used stick to the global or tab-local directory.  When jumping to another
window the current directory is changed to the last specified local current
directory.  If none was specified, the global or tab-local directory is used.
When creating a new window it inherits the local directory of the current window.

When changing tabs the same behaviour applies.  If the current tab has no
local working directory the global working directory is used.

When a |:cd| command is used, the current window and tab will lose their local
current directories and will use the global current directory from now on.
When a |:tcd| command is used, only the current window will lose its local
working directory.

After using |:cd| the full path name will be used for reading and writing
files.  On some networked file systems this may cause problems.  The result of
using the full path name is that the file names currently in use will remain
referring to the same file.  Example: If you have a file a:test and a
directory a:vim the commands ":e test" ":cd vim" ":w" will overwrite the file
a:test and not write a:vim/test.  But if you do ":w test" the file a:vim/test
will be written, because you gave a new file name and did not refer to a
filename before the ":cd".

==============================================================================
8. Editing binary files					*edit-binary*

Although Vim was made to edit text files, it is possible to edit binary
files.  The |-b| Vim argument (b for binary) makes Vim do file I/O in binary
mode, and sets some options for editing binary files ('binary' on, 'textwidth'
to 0, 'modeline' off, 'expandtab' off).  Setting the 'binary' option has the
same effect.  Don't forget to do this before reading the file.

There are a few things to remember when editing binary files:
- When editing executable files the number of bytes must not change.
  Use only the "R" or "r" command to change text.  Do not delete characters
  with "x" or by backspacing.
- Set the 'textwidth' option to 0.  Otherwise lines will unexpectedly be
  split in two.
- When there are not many <EOL>s, the lines will become very long.  If you
  want to edit a line that does not fit on the screen reset the 'wrap' option.
  Horizontal scrolling is used then.  If a line becomes too long (see |limits|)
  you cannot edit that line.  The line will be split when reading the file.
  It is also possible that you get an "out of memory" error when reading the
  file.
- Make sure the 'binary' option is set BEFORE loading the
  file.  Otherwise both <CR><NL> and <NL> are considered to end a line
  and when the file is written the <NL> will be replaced with <CR><NL>.
- <Nul> characters are shown on the screen as ^@.  You can enter them with
  "CTRL-V CTRL-@" or "CTRL-V 000".
- 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

Title: Vim: Local Directory Behavior and Binary File Editing
Summary
This section explains how Vim handles local directories when using `:cd`, `:lcd`, and `:tcd` commands, and explains how it uses full path names when reading and writing files after changing the current directory. This section also goes on to describe how to edit binary files in Vim, and mentions some important considerations like using 'binary' mode, setting 'textwidth', and handling special characters like <Nul> and <NL>.