diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 15:03:54 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 15:03:54 -0700 |
commit | df8f1db2a0c771364865be79bf12656a40b7028b (patch) | |
tree | b6f6b9ec8dd46deed2a956249b0e82903c628492 /src/nvim/options.lua | |
parent | 7a7f497b483cd65e340064f23ed1c73425ecba0a (diff) | |
parent | c324271b99eee4c621463f368914d57cd729bd9c (diff) | |
download | rneovim-df8f1db2a0c771364865be79bf12656a40b7028b.tar.gz rneovim-df8f1db2a0c771364865be79bf12656a40b7028b.tar.bz2 rneovim-df8f1db2a0c771364865be79bf12656a40b7028b.zip |
Merge branch 'userreg' into mix_20240309
Diffstat (limited to 'src/nvim/options.lua')
-rw-r--r-- | src/nvim/options.lua | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 72f9ff849d..632732d7b7 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -9237,6 +9237,64 @@ return { varname = 'p_ut', }, { + abbreviation='urf', + full_name='userregfunc', + desc= [=[ + This option specifies a function to be used to handle any registers + that Neovim does not natively handle. This option unlocks all + characters to be used as registers by the user. + + The 'userregfunc' function is called each time a user register is read + from or written to. + + The 'userregfunc' function must take the following parameters: + + {action} The action being done on this register (either 'yank' + or 'put' + + {register} The string holding the name of the register. This + is always a single character, though multi-byte + characters are allowed. + + {content} If the action is 'yank' this is the content being + yanked into the register. The content is a dictionary + with the following items: + + {lines} The lines being yanked, as a list. + + {type} The type of yank, either "line", "char", or + "block" + + {width} The width in case of "block" mode. + + {additional_data} Additional data. (can be returned in + put mode). + + In case the action is 'put', the 'userregfunc' function should return + the content to place in that location. The content can either be a + string, in which case "char" mode is inferred, or it can return a + dictionary of the same template that populates 'content'. + + A very simple example of a 'userregfunc' function that behaves exactly + like traditional registers would look like: > + + let s:contents = {} + function! MyUserregFunction(action, register, content) abort + if a:action == "put" + return get(s:contents, a:register, "") + else + let s:contents[a:register] = a:content + endif + endfunction + set userregfunc=MyUserregFunction +< + ]=], + short_desc=N_("Function used to define behavior of user-defined registers."), + type='string', scope={'buffer'}, + varname='p_urf', + defaults={if_true=""} + }, + { abbreviation = 'vsts', cb = 'did_set_varsofttabstop', defaults = { if_true = '' }, |