diff options
author | ZyX <kp-pav@yandex.ru> | 2015-07-12 17:31:55 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2015-08-02 19:32:41 +0300 |
commit | 5a7135fa1c31290711b194c33e86e538ce8e131c (patch) | |
tree | f7da399856b037bc1287f96aa430c48b95a811d8 /runtime | |
parent | 4d79edccdc0243a02a20ef46184b8f87f2bda290 (diff) | |
download | rneovim-5a7135fa1c31290711b194c33e86e538ce8e131c.tar.gz rneovim-5a7135fa1c31290711b194c33e86e538ce8e131c.tar.bz2 rneovim-5a7135fa1c31290711b194c33e86e538ce8e131c.zip |
eval: Add msgpackparse and msgpackdump functions
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index e80ab2c714..f465cafb8e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1904,6 +1904,8 @@ min( {list}) Number minimum value of items in {list} mkdir( {name} [, {path} [, {prot}]]) Number create directory {name} mode( [expr]) String current editing mode +msgpackdump( {list}) List dump a list of objects to msgpack +msgpackparse( {list}) List parse msgpack to a list of objects nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum} nr2char( {expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} or( {expr}, {expr}) Number bitwise OR @@ -4613,6 +4615,40 @@ mode([expr]) Return a string that indicates the current mode. "c" or "n". Also see |visualmode()|. +msgpackdump({list}) *msgpackdump()* + Convert a list of VimL objects to msgpack. Returned value is + |readfile()|-style list. Example: > + call writefile(msgpackdump([{}]), 'fname.mpack', 'b') +< This will write the single 0x80 byte to `fname.mpack` file + (dictionary with zero items is represented by 0x80 byte in + messagepack). + + Limitations: + 1. |Funcref|s cannot be dumped as funcrefs, they are dumped as + NIL objects instead. + 2. NIL and BOOL objects are never dumped, as well as objects + from EXT family. + 3. Strings are always dumped as BIN strings. + +msgpackparse({list}) *msgpackparse()* + Convert a |readfile()|-style list to a list of VimL objects. + Example: > + let fname = expand('~/.nvim/shada/main.shada') + let mpack = readfile(fname, 'b') + let shada_objects = msgpackparse(mpack) +< This will read |shada-file| to `shada_objects` list. + + Limitations: + 1. Strings that contain one of EXT format family objects + cannot be parsed by msgpackparse(). + 2. It may appear that parsed integers do not fit in |Number| + range. Even if your NeoVim installation uses 64-bit + Numbers, it may appear that string contain 64-bit unsigned + number above INT64_MAX. + 3. NIL objects are parsed as zeroes. BOOL objects are parsed + as either 1 (true) or 0 (false). + 4. BIN and STR strings cannot be distinguished after parsing. + nextnonblank({lnum}) *nextnonblank()* Return the line number of the first line at or below {lnum} that is not blank. Example: > |