Home Explore Blog CI



neovim

21th chunk of `runtime/doc/vimfn.txt`
6954588686c236798da76e5f1c0177fbba9da235b9f9c2f80000000100000fbb
 before the "*".
		That means if "*" is not the last character of {pattern}, only
		keys that are exactly equal as {pattern} will be matched.

		The {callback} receives three arguments:

		- The dictionary being watched.
		- The key which changed.
		- A dictionary containing the new and old values for the key.

		The type of change can be determined by examining the keys
		present on the third argument:

		- If contains both `old` and `new`, the key was updated.
		- If it contains only `new`, the key was added.
		- If it contains only `old`, the key was deleted.

		This function can be used by plugins to implement options with
		validation and parsing logic.

                Parameters: ~
                  • {dict} (`table`)
                  • {pattern} (`string`)
                  • {callback} (`function`)

                Return: ~
                  (`any`)

dictwatcherdel({dict}, {pattern}, {callback})                 *dictwatcherdel()*
		Removes a watcher added  with |dictwatcheradd()|. All three
		arguments must match the ones passed to |dictwatcheradd()| in
		order for the watcher to be successfully deleted.

                Parameters: ~
                  • {dict} (`any`)
                  • {pattern} (`string`)
                  • {callback} (`function`)

                Return: ~
                  (`any`)

did_filetype()                                                  *did_filetype()*
		Returns |TRUE| when autocommands are being executed and the
		FileType event has been triggered at least once.  Can be used
		to avoid triggering the FileType event again in the scripts
		that detect the file type. |FileType|
		Returns |FALSE| when `:setf FALLBACK` was used.
		When editing another file, the counter is reset, thus this
		really checks if the FileType event has been triggered for the
		current buffer.  This allows an autocommand that starts
		editing another buffer to set 'filetype' and load a syntax
		file.

                Return: ~
                  (`integer`)

diff_filler({lnum})                                              *diff_filler()*
		Returns the number of filler lines above line {lnum}.
		These are the lines that were inserted at this point in
		another diff'ed window.  These filler lines are shown in the
		display but don't exist in the buffer.
		{lnum} is used like with |getline()|.  Thus "." is the current
		line, "'m" mark m, etc.
		Returns 0 if the current window is not in diff mode.

                Parameters: ~
                  • {lnum} (`integer|string`)

                Return: ~
                  (`integer`)

diff_hlID({lnum}, {col})                                           *diff_hlID()*
		Returns the highlight ID for diff mode at line {lnum} column
		{col} (byte index).  When the current line does not have a
		diff change zero is returned.
		{lnum} is used like with |getline()|.  Thus "." is the current
		line, "'m" mark m, etc.
		{col} is 1 for the leftmost column, {lnum} is 1 for the first
		line.
		The highlight ID can be used with |synIDattr()| to obtain
		syntax information about the highlighting.

                Parameters: ~
                  • {lnum} (`integer|string`)
                  • {col} (`integer`)

                Return: ~
                  (`any`)

digraph_get({chars})                                       *digraph_get()* *E1214*
		Return the digraph of {chars}.  This should be a string with
		exactly two characters.  If {chars} are not just two
		characters, or the digraph of {chars} does not exist, an error
		is given and an empty string is returned.

		Also see |digraph_getlist()|.

		Examples: >vim
		" Get a built-in digraph
		echo digraph_get('00')		" Returns '∞'

		" Get a user-defined digraph
		call digraph_set('aa', 'あ')
		echo digraph_get('aa')		" Returns 'あ'
<

                Parameters: ~
                  • {chars} (`string`)

                Return: ~
                  (`string`)

digraph_getlist([{listall}])                                 *digraph_getlist()*

Title: Vimscript Functions: Dictionary Watcher Removal, FileType Detection, Diff Information, and Digraph Handling
Summary
This section continues the description of Vimscript functions: It expands on dictwatcherdel(), explaining how to remove dictionary watchers. It details did_filetype(), which checks if the FileType event has been triggered. It also presents diff_filler(), which returns the number of filler lines above a given line in diff mode, and diff_hlID(), which returns the highlight ID for a specific location in diff mode. Finally, it defines digraph_get(), which retrieves the digraph representation of two characters, and introduces digraph_getlist() .