Home Explore Blog CI



neovim

16th chunk of `runtime/doc/starting.txt`
04c027ece8089975e9fdceb070d6042a7f1db6039542c0100000000100000fa6
 only entries which are not merged in any
   fashion: the only header and buffer list present are the ones from the
   Nvim instance which was last writing the file. |shada-%|

COMPATIBILITY						*shada-compatibility*

ShaDa files are forward and backward compatible.  This means that

1. Entries which have unknown type (i.e. that hold unidentified data) are
   ignored when reading and blindly copied when writing.
2. Register entries with unknown register name are ignored when reading and
   blindly copied when writing. Limitation: only registers that use name with
   code in interval [1, 255] are supported. |registers|
3. Register entries with unknown register type are ignored when reading and
   merged as usual when writing. |getregtype()|
4. Local and global mark entries with unknown mark names are ignored when
   reading. When writing global mark entries are blindly copied and local mark
   entries are also blindly copied, but only if file they are attached to fits
   in the |shada-'| limit. Unknown local mark entry's timestamp is also taken
   into account when calculating which files exactly should fit into this
   limit. Limitation: only marks that use name with code in interval [1, 255]
   are supported. |mark-motions|
5. History entries with unknown history type are ignored when reading and
   blindly copied when writing. Limitation: there can be only up to 256
   history types. |history|
6. Unknown keys found in register, local mark, global mark, change, jump and
   search pattern entries are saved internally and dumped when writing.
   Entries created during Nvim session never have such additions.
7. Additional elements found in replacement string and history entries are
   saved internally and dumped. Entries created during Nvim session never
   have such additions.
8. Additional elements found in variable entries are simply ignored when
   reading. When writing new variables they will be preserved during merging,
   but that's all. Variable values dumped from current Nvim session never
   have additional elements, even if variables themselves were obtained by
   reading ShaDa files.

"Blindly" here means that there will be no attempts to somehow merge them,
even if other entries (with known name/type/etc) are merged. |shada-merging|

SHADA FILE NAME						*shada-file-name*

- Default name of the |shada| file is:
      Unix:     "$XDG_STATE_HOME/nvim/shada/main.shada"
      Windows:  "$XDG_STATE_HOME/nvim-data/shada/main.shada"
  See also |base-directories|.
- To choose a different file name you can use:
    - The "n" flag in the 'shada' option.
    - The |-i| startup argument.  "NONE" means no shada file is ever read or
      written.  Also not for the commands below!
    - The 'shadafile' option.  The value from the "-i" argument (if any) is
      stored in the 'shadafile' option.
- For the commands below, another file name can be given, overriding the
  default and the name given with 'shada' or "-i" (unless it's NONE).


MANUALLY READING AND WRITING				*shada-read-write*

Two commands can be used to read and write the ShaDa file manually.  This
can be used to exchange registers between two running Vim programs: First
type ":wsh" in one and then ":rsh" in the other.  Note that if the register
already contained something, then ":rsh!" would be required.  Also note,
however, that this means everything will be overwritten with information from
the first Vim, including the command line history, etc.

The ShaDa file itself can be edited by hand too, although we suggest you
start with an existing one to get the format right.  You need to understand
MessagePack (or, more likely, find software that is able to use it) format to
do this.  This can be useful in order to create a second file, say
"~/.my.shada", which could contain certain settings that you always want when
you first start Nvim.  For example, you can preload registers with
particular data, or put certain commands in the command line history.  A line
in your |config|

Title: ShaDa Files: Compatibility, File Name, and Manual Read/Write
Summary
This section continues the discussion on ShaDa file compatibility, focusing on how unknown data types, register names, mark names, and history types are handled. It explains that 'blindly' copying ensures data preservation without attempting to merge unknown entries. The default ShaDa file name is defined and discusses the option to modify the location of the ShaDa file. It also covers how to manually read and write ShaDa files using commands, providing insights into exchanging registers between Vim instances. Finally, it touches upon the possibility of manually editing ShaDa files.