Home Explore Blog CI



neovim

18th chunk of `runtime/doc/starting.txt`
51989ea57403b5b64e084effaeadf17fa3671e046c20d9aa0000000100000fa3

- Use |:wshada| with bang.  Does not help in case of permission error.  If
  target file was actually the ShaDa file some information may be lost in this
  case.  To make the matters slightly better use |:rshada| prior to writing,
  but this still will loose buffer-local marks and change list entries for any
  file which is not opened in the current Nvim instance.
- Remove the target file from shell and use |:wshada|.  Consequences are not
  different from using |:wshada| with bang, but "rm -f" works in some cases
  when you don't have write permissions.

						    *:rsh* *:rshada* *E886*
:rsh[ada][!] [file]	Read from ShaDa file [file] (default: see above).
			If [!] is given, then any information that is
			already set (registers, marks, |v:oldfiles|, etc.)
			will be overwritten.

						    *:wsh* *:wshada* *E137*
:wsh[ada][!] [file]	Write to ShaDa file [file] (default: see above).
			The information in the file is first read in to make
			a merge between old and new info.  When [!] is used,
			the old information is not read first, only the
			internal info is written (also disables safety checks
			described in |shada-error-handling|).  If 'shada' is
			empty, marks for up to 100 files will be written.
			When you get error "E929: All .tmp.X files exist,
			cannot write ShaDa file!", check that no old temp
			files were left behind (e.g.
			~/.local/state/nvim/shada/main.shada.tmp*).

			Note: Executing :wshada will reset all |'quote| marks.

						*:o* *:ol* *:oldfiles*
:o[ldfiles]		List the files that have marks stored in the ShaDa
			file.  This list is read on startup and only changes
			afterwards with `:rshada!`.  Also see |v:oldfiles|.
			The number can be used with |c_#<|.
			The output can be filtered with |:filter|, e.g.: >
				filter /\.vim/ oldfiles
<			The filtering happens on the file name.

:bro[wse] o[ldfiles][!]
			List file names as with |:oldfiles|, and then prompt
			for a number.  When the number is valid that file from
			the list is edited.
			If you get the |press-enter| prompt you can press "q"
			and still get the prompt to enter a file number.
			Use [!] to abandon a modified buffer. |abandon|

SHADA FILE FORMAT						*shada-format*

ShaDa files are concats of MessagePack entries.  Each entry is a concat of
exactly four MessagePack objects:

1. First goes type of the entry.  Object type must be an unsigned integer.
   Object type must not be equal to zero.
2. Second goes entry timestamp.  It must also be an unsigned integer.
3. Third goes the length of the fourth entry.  Unsigned integer as well, used
   for fast skipping without parsing.
4. Fourth is actual entry data.  All currently used ShaDa entries use
   containers to hold data: either map or array.  All string values in those
   containers are either binary (applies to filenames) or UTF-8, yet parser
   needs to expect that invalid bytes may be present in a UTF-8 string.

   Exact format depends on the entry type:

   Entry type (name)   Entry data ~
   1 (Header)          Map containing data that describes the generator
                       instance that wrote this ShaDa file.  It is ignored
                       when reading ShaDa files.  Contains the following data:
                       Key        Data ~
                       generator  Binary, software used to generate ShaDa
                                  file. Is equal to "nvim" when ShaDa file was
                                  written by Nvim.
                       version    Binary, generator version.
                       encoding   Binary, effective 'encoding' value.
                       max_kbyte  Integer, effective |shada-s| limit value.
                       pid        Integer, instance process ID.
                       `*`          It is allowed to have any number of
                                  additional keys with any data.
   2 (SearchPattern)   Map containing data describing last used search or
                       substitute pattern.  Normally ShaDa

Title: ShaDa File Commands, Oldfiles, and Format
Summary
This section details the `:rshada` and `:wshada` commands, explaining their options and potential data loss when using the bang (!) modifier. It describes how to manage old temporary files and lists the `:'quote'` marks reset by `:wshada`. The `:'o[ldfiles]'` command lists files with marks in the ShaDa file, with browsing and filtering options. The `:'bro[wse] o[ldfiles]'`command allows to select a file from the list of oldfiles and open it. It provides an overview of the ShaDa file format, which uses MessagePack entries containing type, timestamp, length, and data.