From 5b0e381a261b1450735f4eddac55aeb956c13713 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Sun, 21 Aug 2022 22:01:00 -0600 Subject: feat(userreg): Add user-defined registers to Neovim. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change unlocks additional registers for Neovim by allowing a user to define their own behavior for non-builtin registers. This is accopmlished through a new option 'userregfunc' The 'userregfunc' defines the function to call when handling a register for which there is no builtin functionality. The 'userregfunc' function should take 3 arguments: action - Either "yank" or "put" register - The character corresponding to the register content - In the case of action == "yank", the dictionary describing the yanked content, with the following keys: {type} - Either "char", "line" or "block" {lines} - The lines being yanked as a list {width} - The width in case of "block" mode. {additional_data} - Additional data (can be returned in "put" mode) In case of "put" this function should return the content to put. This content can be either: * A dictionary in the same template as content above. * A list of strings. This will be assumed to be "line" mode. * A string. This will be assumed to be "char" mode. An example of a "null" 'userregfunc' that provides an implementation identical to traditional vim registers would be: 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 userregfun=MyUserregFunction It is important to note that any valid unicode character can now be a register, including something like @☺. This change also addresses the multibyte parsing issues surrounding let @a = 'xyz' let @🔨 = 'hammer' --- src/nvim/po/da.po | 2 +- src/nvim/po/fr.po | 2 +- src/nvim/po/tr.po | 2 +- src/nvim/po/uk.po | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/po') diff --git a/src/nvim/po/da.po b/src/nvim/po/da.po index dfcc052288..f2b28ccc90 100644 --- a/src/nvim/po/da.po +++ b/src/nvim/po/da.po @@ -4142,7 +4142,7 @@ msgid "freeing %ld lines" msgstr "frigør %ld linjer" #, c-format -msgid " into \"%c" +msgid " into \"%s" msgstr " i \"%c" #, c-format diff --git a/src/nvim/po/fr.po b/src/nvim/po/fr.po index 614ba013e6..239d6da211 100644 --- a/src/nvim/po/fr.po +++ b/src/nvim/po/fr.po @@ -4410,7 +4410,7 @@ msgid "freeing %ld lines" msgstr "libration de %ld lignes" #, c-format -msgid " into \"%c" +msgid " into \"%s" msgstr " dans \"%c" #, c-format diff --git a/src/nvim/po/tr.po b/src/nvim/po/tr.po index fae2fd4967..d534666bbb 100644 --- a/src/nvim/po/tr.po +++ b/src/nvim/po/tr.po @@ -4149,7 +4149,7 @@ msgid "E748: No previously used register" msgstr "E748: Daha önce kullanılan bir yazmaç yok" #, c-format -msgid " into \"%c" +msgid " into \"%s" msgstr " \"%c" #, c-format diff --git a/src/nvim/po/uk.po b/src/nvim/po/uk.po index da87d50683..1b514ad7c3 100644 --- a/src/nvim/po/uk.po +++ b/src/nvim/po/uk.po @@ -4132,7 +4132,7 @@ msgid "E748: No previously used register" msgstr "E748: Регістри перед цим не вживались" #, c-format -msgid " into \"%c" +msgid " into \"%s" msgstr " у \"%c" #, c-format -- cgit