From 244dbe3a77bf548f73d8781da7327f30e818b08a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 25 Apr 2015 18:47:31 +0300 Subject: viminfo: First version of ShaDa file dumping What works: 1. ShaDa file dumping: header, registers, jump list, history, search patterns, substitute strings, variables. 2. ShaDa file reading: registers, global marks, variables. Most was not tested. TODO: 1. Merging. 2. Reading history, local marks, jump and buffer lists. 3. Documentation update. 4. Converting some data from &encoding. 5. Safer variant of dumping viminfo (dump to temporary file then rename). 6. Removing old viminfo code (currently masked with `#if 0` in a ShaDa file for reference). --- src/nvim/shada.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/nvim/shada.h (limited to 'src/nvim/shada.h') diff --git a/src/nvim/shada.h b/src/nvim/shada.h new file mode 100644 index 0000000000..f0935796d7 --- /dev/null +++ b/src/nvim/shada.h @@ -0,0 +1,18 @@ +#ifndef NVIM_SHADA_H +#define NVIM_SHADA_H + +typedef long ShadaPosition; + +/// Flags for shada_read_file and children +enum { + kShaDaWantInfo = 1, ///< Load non-mark information + kShaDaWantMarks = 2, ///< Load file marks + kShaDaForceit = 4, ///< Overwrite info already read + kShaDaGetOldfiles = 8, ///< Load v:oldfiles. +}; + +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "shada.h.generated.h" +#endif + +#endif // NVIM_SHADA_H -- cgit From 94ed7ba03b39a9d047fdb809af081e13ec32ddd5 Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 29 Apr 2015 23:40:20 +0300 Subject: shada: Skip reading some items if needed Avoids unneeded malloc()s/free()s and lots of code for parsing. --- src/nvim/shada.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/shada.h') diff --git a/src/nvim/shada.h b/src/nvim/shada.h index f0935796d7..ef7527677e 100644 --- a/src/nvim/shada.h +++ b/src/nvim/shada.h @@ -9,6 +9,7 @@ enum { kShaDaWantMarks = 2, ///< Load file marks kShaDaForceit = 4, ///< Overwrite info already read kShaDaGetOldfiles = 8, ///< Load v:oldfiles. + kShaDaWantHeader = 16, ///< Do not skip header (shada_read_next_item). }; #ifdef INCLUDE_GENERATED_DECLARATIONS -- cgit From 941ec54aa1183be41df9bee426bd97ecd4d1a0d7 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 5 Jul 2015 02:37:37 +0300 Subject: shada: Reassign some entry types to WantInfo and WantMarks kShaDaWantMarks now loads only local file change list and file-local marks. kShaDaWantInfo now loads global marks and jump list. --- src/nvim/shada.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/shada.h') diff --git a/src/nvim/shada.h b/src/nvim/shada.h index ef7527677e..8033cbe116 100644 --- a/src/nvim/shada.h +++ b/src/nvim/shada.h @@ -6,7 +6,7 @@ typedef long ShadaPosition; /// Flags for shada_read_file and children enum { kShaDaWantInfo = 1, ///< Load non-mark information - kShaDaWantMarks = 2, ///< Load file marks + kShaDaWantMarks = 2, ///< Load local file marks and change list kShaDaForceit = 4, ///< Overwrite info already read kShaDaGetOldfiles = 8, ///< Load v:oldfiles. kShaDaWantHeader = 16, ///< Do not skip header (shada_read_next_item). -- cgit From 8dafa533dbd505a6a2cf2e009bf440e2bde342f4 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 25 Jul 2015 19:42:04 +0300 Subject: shada: Translate errors and add error codes Notes: - E136 code greatly changed its meaning: now it is write error and not read error. - E195 was removed because shada_read_everything will already do all the necessary error reporting. - E886 can be reported by both :rshada and :wshada, but :rshada comes first and AFAIR it is the only error which is not E575 and can be reported by :rshada. --- src/nvim/shada.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/nvim/shada.h') diff --git a/src/nvim/shada.h b/src/nvim/shada.h index 8033cbe116..438eb9c07f 100644 --- a/src/nvim/shada.h +++ b/src/nvim/shada.h @@ -5,11 +5,11 @@ typedef long ShadaPosition; /// Flags for shada_read_file and children enum { - kShaDaWantInfo = 1, ///< Load non-mark information - kShaDaWantMarks = 2, ///< Load local file marks and change list - kShaDaForceit = 4, ///< Overwrite info already read - kShaDaGetOldfiles = 8, ///< Load v:oldfiles. - kShaDaWantHeader = 16, ///< Do not skip header (shada_read_next_item). + kShaDaWantInfo = 1, ///< Load non-mark information + kShaDaWantMarks = 2, ///< Load local file marks and change list + kShaDaForceit = 4, ///< Overwrite info already read + kShaDaGetOldfiles = 8, ///< Load v:oldfiles. + kShaDaMissingError = 16, ///< Error out when os_open returns -ENOENT. }; #ifdef INCLUDE_GENERATED_DECLARATIONS -- cgit From 931539d108d397b88da618585861dce854018af2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 26 Jul 2015 01:20:13 +0300 Subject: shada: Do not export shada_read_file Unlike some wrapper functions it is not used actually, so no need to export it. Also removed ShadaPosition typedef which was not used. --- src/nvim/shada.h | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/nvim/shada.h') diff --git a/src/nvim/shada.h b/src/nvim/shada.h index 438eb9c07f..2b0a6ff6be 100644 --- a/src/nvim/shada.h +++ b/src/nvim/shada.h @@ -1,17 +1,6 @@ #ifndef NVIM_SHADA_H #define NVIM_SHADA_H -typedef long ShadaPosition; - -/// Flags for shada_read_file and children -enum { - kShaDaWantInfo = 1, ///< Load non-mark information - kShaDaWantMarks = 2, ///< Load local file marks and change list - kShaDaForceit = 4, ///< Overwrite info already read - kShaDaGetOldfiles = 8, ///< Load v:oldfiles. - kShaDaMissingError = 16, ///< Error out when os_open returns -ENOENT. -}; - #ifdef INCLUDE_GENERATED_DECLARATIONS # include "shada.h.generated.h" #endif -- cgit From 5d47fe124a6a6038975006a306b451d65d267e80 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 17 Aug 2015 01:09:00 +0300 Subject: shada.h: Remove newline after INCLUDE_GENERATED_DECLARATIONS section --- src/nvim/shada.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/shada.h') diff --git a/src/nvim/shada.h b/src/nvim/shada.h index 2b0a6ff6be..49986ac1c1 100644 --- a/src/nvim/shada.h +++ b/src/nvim/shada.h @@ -4,5 +4,4 @@ #ifdef INCLUDE_GENERATED_DECLARATIONS # include "shada.h.generated.h" #endif - #endif // NVIM_SHADA_H -- cgit