used. If you want to save the marks for a file that you are
about to abandon with ":bdel", use ":wsh". The '[' and ']' marks are not
stored, but the '"' mark is. The '"' mark is very useful for jumping to the
cursor position when the file was last exited. No marks are saved for files
that start with any string given with the "r" flag in 'shada'. This can be
used to avoid saving marks for files on removable media (for MS-Windows you
would use "ra:,rb:").
The |v:oldfiles| variable is filled with the file names that the ShaDa file
has marks for.
*shada-file-marks*
Uppercase marks ('A to 'Z) are stored when writing the ShaDa file. The
numbered marks ('0 to '9) are a bit special. When the ShaDa file is written
(when exiting or with the |:wshada| command), '0 is set to the current cursor
position and file. The old '0 is moved to '1, '1 to '2, etc. This
resembles what happens with the "1 to "9 delete registers. If the current
cursor position is already present in '0 to '9, it is moved to '0, to avoid
having the same position twice. The result is that with "'0", you can jump
back to the file and line where you exited Vim. To do that right away, try
using this command: >
vim -c "normal '0"
In a C shell descendant, you could make an alias for it: >
alias lvim vim -c '"'normal "'"0'"'
For a Bash-like shell: >
alias lvim='vim -c "normal '\''0"'
Use the "r" flag in 'shada' to specify for which files no marks should be
remembered.
MERGING *shada-merging*
When writing ShaDa files with |:wshada| without bang or at regular exit
information in the existing ShaDa file is merged with information from current
Nvim instance. For this purpose ShaDa files store timestamps associated
with ShaDa entries. Specifically the following is being done:
1. History lines are merged, ordered by timestamp. Maximum amount of items in
ShaDa file is defined by 'shada' option (|shada-/|, |shada-:|, |shada-@|,
etc: one suboption for each character that represents history name
(|:history|)).
2. Local marks and changes for files that were not opened by Nvim are copied
to new ShaDa file. Marks for files that were opened by Nvim are merged,
changes to files opened by Nvim are ignored. |shada-'|
3. Jump list is merged: jumps are ordered by timestamp, identical jumps
(identical position AND timestamp) are squashed.
4. Search patterns and substitute strings are not merged: search pattern or
substitute string which has greatest timestamp will be the only one copied
to ShaDa file.
5. For each register entity with greatest timestamp is the only saved.
|shada-<|
6. All saved variables are saved from current Nvim instance. Additionally
existing variable values are copied, meaning that the only way to remove
variable from a ShaDa file is either removing it by hand or disabling
writing variables completely. |shada-!|
7. For each global mark entity with greatest timestamp is the only saved.
8. Buffer list and header are the 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-'|