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/ex_getln.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/ex_getln.h') diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index 2b82f934d5..9c7a688e7e 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -35,6 +35,15 @@ typedef char_u *(*CompleteListItemGetter)(expand_T *, int); +/// History entry definition +typedef struct hist_entry { + int hisnum; ///< Entry identifier number. + bool viminfo; ///< If true, indicates that entry comes from viminfo. + char_u *hisstr; ///< Actual entry, separator char after the NUL. + Timestamp timestamp; ///< Time when entry was added. + Array *additional_elements; ///< Additional entries from ShaDa file. +} histentry_T; + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ex_getln.h.generated.h" #endif -- cgit From 0fe9679101037daa6f74deaa52900c077be9ab17 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 8 May 2015 20:05:34 +0300 Subject: shada: Initial support for merging history Currently only merges history when reading ShaDa file. No tests yet. --- src/nvim/ex_getln.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/ex_getln.h') diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index 9c7a688e7e..738e515f21 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -38,7 +38,6 @@ typedef char_u *(*CompleteListItemGetter)(expand_T *, int); /// History entry definition typedef struct hist_entry { int hisnum; ///< Entry identifier number. - bool viminfo; ///< If true, indicates that entry comes from viminfo. char_u *hisstr; ///< Actual entry, separator char after the NUL. Timestamp timestamp; ///< Time when entry was added. Array *additional_elements; ///< Additional entries from ShaDa file. -- cgit From 07d9ab26c6526c0d9af0435f1adeb614a1b88743 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Aug 2015 23:06:06 +0300 Subject: *: Make ShaDa code use VimL values for additional_\* data --- src/nvim/ex_getln.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/ex_getln.h') diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index 738e515f21..3bfd6a8aac 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -1,6 +1,7 @@ #ifndef NVIM_EX_GETLN_H #define NVIM_EX_GETLN_H +#include "nvim/eval_defs.h" #include "nvim/ex_cmds.h" /* Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. */ @@ -40,7 +41,7 @@ typedef struct hist_entry { int hisnum; ///< Entry identifier number. char_u *hisstr; ///< Actual entry, separator char after the NUL. Timestamp timestamp; ///< Time when entry was added. - Array *additional_elements; ///< Additional entries from ShaDa file. + list_T *additional_elements; ///< Additional entries from ShaDa file. } histentry_T; #ifdef INCLUDE_GENERATED_DECLARATIONS -- cgit From aea7f6aa723e1fca3cab1294731f1b828eb59f88 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Aug 2015 03:50:56 +0300 Subject: ex_getln: Refactor HIST_\* list of macros to enum --- src/nvim/ex_getln.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/nvim/ex_getln.h') diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index 3bfd6a8aac..c537d681c6 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -24,15 +24,17 @@ #define WILD_ESCAPE 128 #define WILD_ICASE 256 -/* - * There are four history tables: - */ -#define HIST_CMD 0 /* colon commands */ -#define HIST_SEARCH 1 /* search commands */ -#define HIST_EXPR 2 /* expressions (from entering = register) */ -#define HIST_INPUT 3 /* input() lines */ -#define HIST_DEBUG 4 /* debug commands */ -#define HIST_COUNT 5 /* number of history tables */ +/// Present history tables +typedef enum { + HIST_CMD, ///< Colon commands. + HIST_SEARCH, ///< Search commands. + HIST_EXPR, ///< Expressions (e.g. from entering = register). + HIST_INPUT, ///< input() lines. + HIST_DEBUG, ///< Debug commands. +} HistoryType; + +/// Number of history tables +#define HIST_COUNT (HIST_DEBUG + 1) typedef char_u *(*CompleteListItemGetter)(expand_T *, int); -- cgit