mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
shada: Add generator key to the header
For use in viminfo→shada converters, plugins that allow editing ShaDa files or any other software which generates ShaDa files for whatever purpose.
This commit is contained in:
@@ -1182,14 +1182,19 @@ exactly four MessagePack objects:
|
|||||||
entry type:
|
entry type:
|
||||||
|
|
||||||
Entry type (name) Entry data ~
|
Entry type (name) Entry data ~
|
||||||
1 (Header) Map containing data that describes the NeoVim instance
|
1 (Header) Map containing data that describes the generator
|
||||||
that written this ShaDa file. It is ignored when
|
instance that wrote this ShaDa file. It is ignored
|
||||||
reading ShaDa files. Contains the following data:
|
when reading ShaDa files. Contains the following data:
|
||||||
Key Data ~
|
Key Data ~
|
||||||
version Binary, NeoVim version.
|
generator Binary, software used to generate ShaDa
|
||||||
|
file. Is equal to "nvim" when ShaDa file was
|
||||||
|
written by NeoVim.
|
||||||
|
version Binary, generator version.
|
||||||
encoding Binary, effective 'encoding' value.
|
encoding Binary, effective 'encoding' value.
|
||||||
max_kbyte Integer, effective |shada-s| limit value.
|
max_kbyte Integer, effective |shada-s| limit value.
|
||||||
pid Integer, instance process ID.
|
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
|
2 (SearchPattern) Map containing data describing last used search or
|
||||||
substitute pattern. Normally ShaDa file contains two
|
substitute pattern. Normally ShaDa file contains two
|
||||||
such entries: one with "ss" key set to true (describes
|
such entries: one with "ss" key set to true (describes
|
||||||
|
@@ -2418,9 +2418,11 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
|
|||||||
.timestamp = os_time(),
|
.timestamp = os_time(),
|
||||||
.data = {
|
.data = {
|
||||||
.header = {
|
.header = {
|
||||||
.size = 4,
|
.size = 5,
|
||||||
.capacity = 4,
|
.capacity = 5,
|
||||||
.items = ((KeyValuePair[]) {
|
.items = ((KeyValuePair[]) {
|
||||||
|
{ STATIC_CSTR_AS_STRING("generator"),
|
||||||
|
STRING_OBJ(STATIC_CSTR_AS_STRING("nvim")) },
|
||||||
{ STATIC_CSTR_AS_STRING("version"),
|
{ STATIC_CSTR_AS_STRING("version"),
|
||||||
STRING_OBJ(cstr_as_string(longVersion)) },
|
STRING_OBJ(cstr_as_string(longVersion)) },
|
||||||
{ STATIC_CSTR_AS_STRING("max_kbyte"),
|
{ STATIC_CSTR_AS_STRING("max_kbyte"),
|
||||||
@@ -2605,9 +2607,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const char *const fname = (char *) (fm.fmark.fnum == 0
|
const char *const fname = (char *) (fm.fmark.fnum == 0
|
||||||
? (fm.fname == NULL
|
? (fm.fname == NULL ? NULL : fm.fname)
|
||||||
? NULL
|
|
||||||
: fm.fname)
|
|
||||||
: buf->b_ffname);
|
: buf->b_ffname);
|
||||||
if (fname == NULL) {
|
if (fname == NULL) {
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user