Home Explore Blog CI



neovim

86th chunk of `runtime/doc/vimfn.txt`
423e0f63b8cba17729500cb89d94f226ddf88d3419c707400000000100000fa7
 |terminal-emulator| (insert goes to
				Terminal mode)
		   ntT	    Normal using |t_CTRL-\_CTRL-O| in |Terminal-mode|
		   v	    Visual by character
		   vs	    Visual by character using |v_CTRL-O| in Select mode
		   V	    Visual by line
		   Vs	    Visual by line using |v_CTRL-O| in Select mode
		   CTRL-V   Visual blockwise
		   CTRL-Vs  Visual blockwise using |v_CTRL-O| in Select mode
		   s	    Select by character
		   S	    Select by line
		   CTRL-S   Select blockwise
		   i	    Insert
		   ic	    Insert mode completion |compl-generic|
		   ix	    Insert mode |i_CTRL-X| completion
		   R	    Replace |R|
		   Rc	    Replace mode completion |compl-generic|
		   Rx	    Replace mode |i_CTRL-X| completion
		   Rv	    Virtual Replace |gR|
		   Rvc	    Virtual Replace mode completion |compl-generic|
		   Rvx	    Virtual Replace mode |i_CTRL-X| completion
		   c	    Command-line editing
		   cr	    Command-line editing overstrike mode |c_<Insert>|
		   cv	    Vim Ex mode |gQ|
		   cvr	    Vim Ex mode while in overstrike mode |c_<Insert>|
		   r	    Hit-enter prompt
		   rm	    The -- more -- prompt
		   r?	    A |:confirm| query of some sort
		   !	    Shell or external command is executing
		   t	    Terminal mode: keys go to the job

		This is useful in the 'statusline' option or RPC calls. In
		most other places it always returns "c" or "n".
		Note that in the future more modes and more specific modes may
		be added. It's better not to compare the whole string but only
		the leading character(s).
		Also see |visualmode()|.

                Parameters: ~
                  • {expr} (`any?`)

                Return: ~
                  (`any`)

msgpackdump({list} [, {type}])                                   *msgpackdump()*
		Convert a list of Vimscript objects to msgpack. Returned value is a
		|readfile()|-style list. When {type} contains "B", a |Blob| is
		returned instead. Example: >vim
			call writefile(msgpackdump([{}]), 'fname.mpack', 'b')
<		or, using a |Blob|: >vim
			call writefile(msgpackdump([{}], 'B'), 'fname.mpack')
<
		This will write the single 0x80 byte to a `fname.mpack` file
		(dictionary with zero items is represented by 0x80 byte in
		messagepack).

		Limitations:				*E5004* *E5005*
		1. |Funcref|s cannot be dumped.
		2. Containers that reference themselves cannot be dumped.
		3. Dictionary keys are always dumped as STR strings.
		4. Other strings and |Blob|s are always dumped as BIN strings.
		5. Points 3. and 4. do not apply to |msgpack-special-dict|s.

                Parameters: ~
                  • {list} (`any`)
                  • {type} (`any?`)

                Return: ~
                  (`any`)

msgpackparse({data})                                            *msgpackparse()*
		Convert a |readfile()|-style list or a |Blob| to a list of
		Vimscript objects.
		Example: >vim
			let fname = expand('~/.config/nvim/shada/main.shada')
			let mpack = readfile(fname, 'b')
			let shada_objects = msgpackparse(mpack)
<		This will read ~/.config/nvim/shada/main.shada file to
		`shada_objects` list.

		Limitations:
		1. Mapping ordering is not preserved unless messagepack
		   mapping is dumped using generic mapping
		   (|msgpack-special-map|).
		2. Since the parser aims to preserve all data untouched
		   (except for 1.) some strings are parsed to
		   |msgpack-special-dict| format which is not convenient to
		   use.
							*msgpack-special-dict*
		Some messagepack strings may be parsed to special
		dictionaries. Special dictionaries are dictionaries which

		1. Contain exactly two keys: `_TYPE` and `_VAL`.
		2. `_TYPE` key is one of the types found in |v:msgpack_types|
		   variable.
		3. Value for `_VAL` has the following format (Key column
		   contains name of the key from |v:msgpack_types|):

		Key	Value ~
		nil	Zero, ignored when dumping.  Not returned by
			|msgpackparse()| since |v:null| was introduced.
		boolean	One or zero.  When dumping it is only checked that
			value is a |Number|.  Not returned

Title: Vim Mode Details, msgpackdump, and msgpackparse
Summary
This section elaborates on the different modes available in Vim, as reported by the `mode()` function, specifying the meanings of different characters returned. It also describes `msgpackdump()`, which converts Vimscript objects to msgpack format, returning a list or Blob suitable for `readfile()`, and outlines limitations. Finally, it explains `msgpackparse()`, used for converting msgpack data (from a file or Blob) back into Vimscript objects, highlighting limitations and the handling of special dictionaries for preserving data types.