mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
documentation/functests: Replace NeoVim with Neovim
This commit is contained in:
@@ -991,16 +991,16 @@ MERGING *shada-merging*
|
|||||||
{Nvim}
|
{Nvim}
|
||||||
When writing ShaDa files with |:wshada| without bang or at regular exit
|
When writing ShaDa files with |:wshada| without bang or at regular exit
|
||||||
information in the existing ShaDa file is merged with information from current
|
information in the existing ShaDa file is merged with information from current
|
||||||
NeoVim instance. For this purpose ShaDa files store timestamps associated
|
Neovim instance. For this purpose ShaDa files store timestamps associated
|
||||||
with ShaDa entries. Specifically the following is being done:
|
with ShaDa entries. Specifically the following is being done:
|
||||||
|
|
||||||
1. History lines are merged, ordered by timestamp. Maximum amount of items in
|
1. History lines are merged, ordered by timestamp. Maximum amount of items in
|
||||||
ShaDa file is defined by 'shada' option (|shada-/|, |shada-:|, |shada-@|,
|
ShaDa file is defined by 'shada' option (|shada-/|, |shada-:|, |shada-@|,
|
||||||
etc: one suboption for each character that represents history name
|
etc: one suboption for each character that represents history name
|
||||||
(|:history|)).
|
(|:history|)).
|
||||||
2. Local marks and changes for files that were not opened by NeoVim are copied
|
2. Local marks and changes for files that were not opened by Neovim are copied
|
||||||
to new ShaDa file. Marks for files that were opened by NeoVim are merged,
|
to new ShaDa file. Marks for files that were opened by Neovim are merged,
|
||||||
changes to files opened by NeoVim are ignored. |shada-'|
|
changes to files opened by Neovim are ignored. |shada-'|
|
||||||
3. Jump list is merged: jumps are ordered by timestamp, identical jumps
|
3. Jump list is merged: jumps are ordered by timestamp, identical jumps
|
||||||
(identical position AND timestamp) are squashed.
|
(identical position AND timestamp) are squashed.
|
||||||
4. Search patterns and substitute strings are not merged: search pattern or
|
4. Search patterns and substitute strings are not merged: search pattern or
|
||||||
@@ -1008,14 +1008,14 @@ with ShaDa entries. Specifically the following is being done:
|
|||||||
to ShaDa file.
|
to ShaDa file.
|
||||||
5. For each register entity with greatest timestamp is the only saved.
|
5. For each register entity with greatest timestamp is the only saved.
|
||||||
|shada-<|
|
|shada-<|
|
||||||
6. All saved variables are saved from current NeoVim instance. Additionally
|
6. All saved variables are saved from current Neovim instance. Additionally
|
||||||
existing variable values are copied, meaning that the only way to remove
|
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
|
variable from a ShaDa file is either removing it by hand or disabling
|
||||||
writing variables completely. |shada-!|
|
writing variables completely. |shada-!|
|
||||||
7. For each global mark entity with greatest timestamp is the only saved.
|
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
|
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
|
fashion: the only header and buffer list present are the ones from the
|
||||||
NeoVim instance which was last writing the file. |shada-%|
|
Neovim instance which was last writing the file. |shada-%|
|
||||||
|
|
||||||
COMPATIBILITY *shada-compatibility*
|
COMPATIBILITY *shada-compatibility*
|
||||||
{Nvim}
|
{Nvim}
|
||||||
@@ -1040,13 +1040,13 @@ ShaDa files are forward and backward compatible. This means that
|
|||||||
history types. |history|
|
history types. |history|
|
||||||
6. Unknown keys found in register, local mark, global mark, change, jump and
|
6. Unknown keys found in register, local mark, global mark, change, jump and
|
||||||
search pattern entries are saved internally and dumped when writing.
|
search pattern entries are saved internally and dumped when writing.
|
||||||
Entries created during NeoVim session never have such additions.
|
Entries created during Neovim session never have such additions.
|
||||||
7. Additional elements found in replacement string and history entries are
|
7. Additional elements found in replacement string and history entries are
|
||||||
saved internally and dumped. Entries created during NeoVim session never
|
saved internally and dumped. Entries created during Neovim session never
|
||||||
have such additions.
|
have such additions.
|
||||||
8. Additional elements found in variable entries are simply ignored when
|
8. Additional elements found in variable entries are simply ignored when
|
||||||
reading. When writing new variables they will be preserved during merging,
|
reading. When writing new variables they will be preserved during merging,
|
||||||
but that's all. Variable values dumped from current NeoVim session never
|
but that's all. Variable values dumped from current Neovim session never
|
||||||
have additional elements, even if variables themselves were obtained by
|
have additional elements, even if variables themselves were obtained by
|
||||||
reading ShaDa files.
|
reading ShaDa files.
|
||||||
|
|
||||||
@@ -1074,7 +1074,7 @@ The text in the ShaDa file is UTF-8-encoded. Normally you will always work
|
|||||||
with the same 'encoding' value, and this works just fine. However, if you
|
with the same 'encoding' value, and this works just fine. However, if you
|
||||||
read the ShaDa file with value for 'encoding' different from utf-8 and
|
read the ShaDa file with value for 'encoding' different from utf-8 and
|
||||||
'encoding' used when writing ShaDa file, some of the text (non-ASCII
|
'encoding' used when writing ShaDa file, some of the text (non-ASCII
|
||||||
characters) may be invalid as NeoVim always attempts to convert the text in
|
characters) may be invalid as Neovim always attempts to convert the text in
|
||||||
the ShaDa file from the UTF-8 to the current 'encoding' value. Filenames are
|
the ShaDa file from the UTF-8 to the current 'encoding' value. Filenames are
|
||||||
never converted, affected elements are:
|
never converted, affected elements are:
|
||||||
|
|
||||||
@@ -1099,7 +1099,7 @@ 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
|
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
|
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
|
"~/.my.shada" which could contain certain settings that you always want when
|
||||||
you first start NeoVim. For example, you can preload registers with
|
you first start Neovim. For example, you can preload registers with
|
||||||
particular data, or put certain commands in the command line history. A line
|
particular data, or put certain commands in the command line history. A line
|
||||||
in your .nvimrc file like >
|
in your .nvimrc file like >
|
||||||
:rshada! ~/.my.shada
|
:rshada! ~/.my.shada
|
||||||
@@ -1114,18 +1114,18 @@ that file. This was done to avoid accidentally destroying a file when the
|
|||||||
file name of the ShaDa file is wrong. This could happen when accidentally
|
file name of the ShaDa file is wrong. This could happen when accidentally
|
||||||
typing "nvim -i file" when you wanted "nvim -R file" (yes, somebody
|
typing "nvim -i file" when you wanted "nvim -R file" (yes, somebody
|
||||||
accidentally did that!). If you want to overwrite a ShaDa file with an error
|
accidentally did that!). If you want to overwrite a ShaDa file with an error
|
||||||
in it, you will either have to fix the error, delete the file (while NeoVim is
|
in it, you will either have to fix the error, delete the file (while Neovim is
|
||||||
running, so most of the information will be restored) or write it explicitly
|
running, so most of the information will be restored) or write it explicitly
|
||||||
with |:wshada| and a bang.
|
with |:wshada| and a bang.
|
||||||
*E136* *E138* *shada-error-handling*
|
*E136* *E138* *shada-error-handling*
|
||||||
Note: when NeoVim finds out that it failed to write part of the ShaDa file
|
Note: when Neovim finds out that it failed to write part of the ShaDa file
|
||||||
(e.g. because there is no space left to write the file) or when it appears
|
(e.g. because there is no space left to write the file) or when it appears
|
||||||
that already present ShaDa file contains errors that indicate that this file
|
that already present ShaDa file contains errors that indicate that this file
|
||||||
is likely not a ShaDa file then ShaDa file with `.tmp.X` suffix is left on the
|
is likely not a ShaDa file then ShaDa file with `.tmp.X` suffix is left on the
|
||||||
file system (where X is any latin small letter: from U+0061 to U+007A). You
|
file system (where X is any latin small letter: from U+0061 to U+007A). You
|
||||||
may use such file to recover the data if you want, but in any case it needs to
|
may use such file to recover the data if you want, but in any case it needs to
|
||||||
be cleaned up after you resolve the issue that prevented old ShaDa file from
|
be cleaned up after you resolve the issue that prevented old ShaDa file from
|
||||||
being overwritten. If NeoVim fails to find unexisting `.tmp.X` file it will
|
being overwritten. If Neovim fails to find unexisting `.tmp.X` file it will
|
||||||
not write ShaDa file at all. Errors which trigger this behaviour are listed
|
not write ShaDa file at all. Errors which trigger this behaviour are listed
|
||||||
at |shada-keeping-tmpfile|.
|
at |shada-keeping-tmpfile|.
|
||||||
|
|
||||||
@@ -1188,7 +1188,7 @@ exactly four MessagePack objects:
|
|||||||
Key Data ~
|
Key Data ~
|
||||||
generator Binary, software used to generate ShaDa
|
generator Binary, software used to generate ShaDa
|
||||||
file. Is equal to "nvim" when ShaDa file was
|
file. Is equal to "nvim" when ShaDa file was
|
||||||
written by NeoVim.
|
written by Neovim.
|
||||||
version Binary, generator version.
|
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.
|
||||||
|
@@ -1016,14 +1016,14 @@ static const void *shada_hist_iter(const void *const iter,
|
|||||||
/// according to the timestamp). If entry was already in the ring buffer
|
/// according to the timestamp). If entry was already in the ring buffer
|
||||||
/// existing entry will be removed unless it has greater timestamp.
|
/// existing entry will be removed unless it has greater timestamp.
|
||||||
///
|
///
|
||||||
/// Before the new entry entries from the current NeoVim history will be
|
/// Before the new entry entries from the current Neovim history will be
|
||||||
/// inserted unless `do_iter` argument is false.
|
/// inserted unless `do_iter` argument is false.
|
||||||
///
|
///
|
||||||
/// @param[in,out] hms_p Ring buffer and associated structures.
|
/// @param[in,out] hms_p Ring buffer and associated structures.
|
||||||
/// @param[in] entry Inserted entry.
|
/// @param[in] entry Inserted entry.
|
||||||
/// @param[in] do_iter Determines whether NeoVim own history should
|
/// @param[in] do_iter Determines whether Neovim own history should
|
||||||
/// be used. Must be true only if inserting
|
/// be used. Must be true only if inserting
|
||||||
/// entry from current NeoVim history.
|
/// entry from current Neovim history.
|
||||||
/// @param[in] can_free_entry True if entry can be freed.
|
/// @param[in] can_free_entry True if entry can be freed.
|
||||||
static void hms_insert(HistoryMergerState *const hms_p, const ShadaEntry entry,
|
static void hms_insert(HistoryMergerState *const hms_p, const ShadaEntry entry,
|
||||||
const bool do_iter, const bool can_free_entry)
|
const bool do_iter, const bool can_free_entry)
|
||||||
@@ -1054,7 +1054,7 @@ static void hms_insert(HistoryMergerState *const hms_p, const ShadaEntry entry,
|
|||||||
if (entry.timestamp > existing_entry->data.timestamp) {
|
if (entry.timestamp > existing_entry->data.timestamp) {
|
||||||
hmll_remove(hmll, existing_entry);
|
hmll_remove(hmll, existing_entry);
|
||||||
} else if (!do_iter && entry.timestamp == existing_entry->data.timestamp) {
|
} else if (!do_iter && entry.timestamp == existing_entry->data.timestamp) {
|
||||||
// Prefer entry from the current NeoVim instance.
|
// Prefer entry from the current Neovim instance.
|
||||||
if (existing_entry->can_free_entry) {
|
if (existing_entry->can_free_entry) {
|
||||||
shada_free_shada_entry(&existing_entry->data);
|
shada_free_shada_entry(&existing_entry->data);
|
||||||
}
|
}
|
||||||
@@ -1083,7 +1083,7 @@ static void hms_insert(HistoryMergerState *const hms_p, const ShadaEntry entry,
|
|||||||
/// @param[in] num_elements Number of elements in the result.
|
/// @param[in] num_elements Number of elements in the result.
|
||||||
/// @param[in] do_merge Prepare structure for merging elements.
|
/// @param[in] do_merge Prepare structure for merging elements.
|
||||||
/// @param[in] reading If true, then merger is reading history for use
|
/// @param[in] reading If true, then merger is reading history for use
|
||||||
/// in NeoVim.
|
/// in Neovim.
|
||||||
static inline void hms_init(HistoryMergerState *const hms_p,
|
static inline void hms_init(HistoryMergerState *const hms_p,
|
||||||
const uint8_t history_type,
|
const uint8_t history_type,
|
||||||
const size_t num_elements,
|
const size_t num_elements,
|
||||||
@@ -1099,7 +1099,7 @@ static inline void hms_init(HistoryMergerState *const hms_p,
|
|||||||
hms_p->history_type = history_type;
|
hms_p->history_type = history_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Merge in all remaining NeoVim own history entries
|
/// Merge in all remaining Neovim own history entries
|
||||||
///
|
///
|
||||||
/// @param[in,out] hms_p Merger structure into which history should be
|
/// @param[in,out] hms_p Merger structure into which history should be
|
||||||
/// inserted.
|
/// inserted.
|
||||||
@@ -1119,7 +1119,7 @@ static inline void hms_insert_whole_neovim_history(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert merger structure to NeoVim internal structure for history
|
/// Convert merger structure to Neovim internal structure for history
|
||||||
///
|
///
|
||||||
/// @param[in] hms_p Converted merger structure.
|
/// @param[in] hms_p Converted merger structure.
|
||||||
/// @param[out] hist_array Array with the results.
|
/// @param[out] hist_array Array with the results.
|
||||||
@@ -1548,7 +1548,7 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
|
|||||||
shada_read_main_cycle_end:
|
shada_read_main_cycle_end:
|
||||||
// Warning: shada_hist_iter returns ShadaEntry elements which use strings from
|
// Warning: shada_hist_iter returns ShadaEntry elements which use strings from
|
||||||
// original history list. This means that once such entry is removed
|
// original history list. This means that once such entry is removed
|
||||||
// from the history NeoVim array will no longer be valid. To reduce
|
// from the history Neovim array will no longer be valid. To reduce
|
||||||
// amount of memory allocations ShaDa file reader allocates enough
|
// amount of memory allocations ShaDa file reader allocates enough
|
||||||
// memory for the history string itself and separator character which
|
// memory for the history string itself and separator character which
|
||||||
// may be assigned right away.
|
// may be assigned right away.
|
||||||
@@ -2349,7 +2349,7 @@ static inline ShaDaWriteResult shada_read_when_writing(
|
|||||||
/// @param[in] sd_writer Structure containing file writer definition.
|
/// @param[in] sd_writer Structure containing file writer definition.
|
||||||
/// @param[in] sd_reader Structure containing file reader definition. If it is
|
/// @param[in] sd_reader Structure containing file reader definition. If it is
|
||||||
/// not NULL then contents of this file will be merged
|
/// not NULL then contents of this file will be merged
|
||||||
/// with current NeoVim runtime.
|
/// with current Neovim runtime.
|
||||||
static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
|
static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
|
||||||
ShaDaReadDef *const sd_reader)
|
ShaDaReadDef *const sd_reader)
|
||||||
FUNC_ATTR_NONNULL_ARG(1)
|
FUNC_ATTR_NONNULL_ARG(1)
|
||||||
@@ -3063,7 +3063,7 @@ int shada_read_marks(void)
|
|||||||
///
|
///
|
||||||
/// @param[in] fname File to write to. If it is NULL or empty then default
|
/// @param[in] fname File to write to. If it is NULL or empty then default
|
||||||
/// @param[in] forceit If true, use forced reading (prioritize file contents
|
/// @param[in] forceit If true, use forced reading (prioritize file contents
|
||||||
/// over current NeoVim state).
|
/// over current Neovim state).
|
||||||
/// @param[in] missing_ok If true, do not error out when file is missing.
|
/// @param[in] missing_ok If true, do not error out when file is missing.
|
||||||
///
|
///
|
||||||
/// @return OK in case of success, FAIL otherwise.
|
/// @return OK in case of success, FAIL otherwise.
|
||||||
|
@@ -21,7 +21,7 @@ describe('ShaDa history merging code', function()
|
|||||||
os.remove(shada_fname)
|
os.remove(shada_fname)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('takes item with greater timestamp from NeoVim instance when reading',
|
it('takes item with greater timestamp from Neovim instance when reading',
|
||||||
function()
|
function()
|
||||||
wshada('\004\001\009\147\000\196\002ab\196\001a')
|
wshada('\004\001\009\147\000\196\002ab\196\001a')
|
||||||
eq(0, exc_exec(sdrcmd()))
|
eq(0, exc_exec(sdrcmd()))
|
||||||
@@ -40,7 +40,7 @@ describe('ShaDa history merging code', function()
|
|||||||
eq(1, found)
|
eq(1, found)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('takes item with equal timestamp from NeoVim instance when reading',
|
it('takes item with equal timestamp from Neovim instance when reading',
|
||||||
function()
|
function()
|
||||||
wshada('\004\000\009\147\000\196\002ab\196\001a')
|
wshada('\004\000\009\147\000\196\002ab\196\001a')
|
||||||
eq(0, exc_exec(sdrcmd()))
|
eq(0, exc_exec(sdrcmd()))
|
||||||
@@ -78,7 +78,7 @@ describe('ShaDa history merging code', function()
|
|||||||
eq(1, found)
|
eq(1, found)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('takes item with greater timestamp from NeoVim instance when writing',
|
it('takes item with greater timestamp from Neovim instance when writing',
|
||||||
function()
|
function()
|
||||||
wshada('\004\001\009\147\000\196\002ab\196\001a')
|
wshada('\004\001\009\147\000\196\002ab\196\001a')
|
||||||
eq(0, exc_exec(sdrcmd()))
|
eq(0, exc_exec(sdrcmd()))
|
||||||
@@ -95,7 +95,7 @@ describe('ShaDa history merging code', function()
|
|||||||
eq(1, found)
|
eq(1, found)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('takes item with equal timestamp from NeoVim instance when writing',
|
it('takes item with equal timestamp from Neovim instance when writing',
|
||||||
function()
|
function()
|
||||||
wshada('\004\000\009\147\000\196\002ab\196\001a')
|
wshada('\004\000\009\147\000\196\002ab\196\001a')
|
||||||
eq(0, exc_exec(sdrcmd()))
|
eq(0, exc_exec(sdrcmd()))
|
||||||
|
Reference in New Issue
Block a user