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).
This commit is contained in:
ZyX
2015-04-25 18:47:31 +03:00
parent 0fdaab995e
commit 244dbe3a77
38 changed files with 4511 additions and 1848 deletions

View File

@@ -2,25 +2,41 @@
#define NVIM_MARK_DEFS_H
#include "nvim/pos.h"
#include "nvim/os/time.h"
#include "nvim/api/private/defs.h"
/*
* marks: positions in a file
* (a normal mark is a lnum/col pair, the same as a file position)
*/
#define NMARKS ('z' - 'a' + 1) /* max. # of named marks */
#define JUMPLISTSIZE 100 /* max. # of marks in jump list */
#define TAGSTACKSIZE 20 /* max. # of tags in tag stack */
/// Number of possible numbered global marks
#define EXTRA_MARKS ('9' - '0' + 1)
/// Maximum possible number of letter marks
#define NMARKS ('z' - 'a' + 1)
/// Total possible number of global marks
#define NGLOBALMARKS (NMARKS + EXTRA_MARKS)
/// Maximum number of marks in jump list
#define JUMPLISTSIZE 100
/// Maximum number of tags in tag stack
#define TAGSTACKSIZE 20
/// Structure defining single local mark
typedef struct filemark {
pos_T mark; /* cursor position */
int fnum; /* file number */
pos_T mark; ///< Cursor position.
int fnum; ///< File number.
Timestamp timestamp; ///< Time when this mark was last set.
Dictionary *additional_data; ///< Additional data from ShaDa file.
} fmark_T;
/* Xtended file mark: also has a file name */
/// Structure defining extended mark (mark with file name attached)
typedef struct xfilemark {
fmark_T fmark;
char_u *fname; /* file name, used when fnum == 0 */
fmark_T fmark; ///< Actual mark.
char_u *fname; ///< File name, used when fnum == 0.
} xfmark_T;
#endif // NVIM_MARK_DEFS_H