155 Commits

Author SHA1 Message Date
Ingo Karkat e4d0ac1afb ENH: ingo#plugin#persistence#CanPersist() indicates the type(s) of persistence
Unfortunately, only via different positive numbers to remain compatible with the original truthy return values.

System-info: Ubuntu 20.04.6 LTS, x86_64
Platform-info: Vim 9.1.1401
2025-06-03 17:07:32 +02:00
Ingo Karkat fc1ad456b5 ENH: Also use s:CompatibilitySerialization() for session global variables
These still are limited to numbers and strings (as of Vim 9.1.1401), so List and Dict variables need to be serialized as strings.

System-info: Ubuntu 20.04.6 LTS, x86_64
Platform-info: Vim 9.1.1401
2025-06-03 17:07:32 +02:00
Ingo Karkat df7c8a2974 Refactoring: Minor: Extract s:GetPersistenceTypeFor()
We'll need this elsewhere soon, and it also fixes the separate check in ingo#plugin#persistence#Load().

System-info: Ubuntu 20.04.6 LTS, x86_64
Platform-info: Vim 9.1.1401
2025-06-03 17:07:32 +02:00
Ingo Karkat 5cedc8e7eb ingo#plugin#persistence#QueryYesNo(): ENH: Minor: Allow passing a:variableName
Since there's both viminfo and session persistence now, both of which can be configured independently, this depends on the name of variable.

System-info: Ubuntu 20.04.6 LTS, x86_64
Platform-info: Vim 9.1.1401
2025-06-03 17:07:32 +02:00
Ingo Karkat 1271efb705 ENH: ingo#plugin#persistence#CanPersist() also considers 'sessionoptions' containing "global"
This will persist global variables that start with an uppercase letter and contain at least one lowercase letter in a Vim session created by :mksession.
It's not as encompassing as the viminfo persistence, but good enough to be counted.

System-info: Ubuntu 20.04.6 LTS, x86_64
Platform-info: Vim 9.1.1401
2025-06-03 17:07:32 +02:00
Ingo Karkat 482f7d46f9 Refactoring: Minor: Extract l:isViminfoPersistence
System-info: Ubuntu 20.04.6 LTS, x86_64
Platform-info: Vim 9.1.1401
2025-06-03 17:07:27 +02:00
Ingo Karkat 592ec1d068 Documentation: Minor: Document ingo#plugin#persistence#CanPersist()
System-info: Ubuntu 20.04.6 LTS, x86_64
Platform-info: Vim 9.1.1401
2025-06-03 15:02:41 +02:00
Ingo Karkat 383183c91f ENH: Allow Funcref for a:parameters.wildignore, too 2023-05-15 16:59:45 +02:00
Ingo Karkat 1bb08b5061 ENH: Allow Funcref for a:parameters.browsefilter, too 2023-05-15 16:57:27 +02:00
Ingo Karkat 22e8d52bdb Also extract the bang, count, and mods when completing 2023-05-15 16:28:22 +02:00
Ingo Karkat 635e21759c ingo#plugin#cmdcomplete#dirforaction: ENH: Allow passing of 'commandAttributes': '-count' 2023-05-15 15:55:23 +02:00
Ingo Karkat 5d9c3c0649 ingo#plugin#register#Set(), ingo#plugin#register#PutContents(): ENH: Allow passing optional target register 2022-07-29 10:30:51 +02:00
Ingo Karkat 2b978dc05b ingo#plugin#historyrecall#RecallRepeat(): Also forward optional client arguments to ingo#plugin#historyrecall#Recall()
So that SubstituteRecall.vim can forward the range, depending on whether this is a normal or visual mode repeat.
2022-07-26 07:59:19 +02:00
Ingo Karkat 236f92d283 BUG: E722 in ingo#plugin#historyrecall#List() (after e4829ff)
Forgot a comma in the Dict definition.

(This corrects commit e4829ffa0a)
2022-03-11 20:15:04 +01:00
Ingo Karkat e4829ffa0a ENH: ingo#query#get#[Valid]Char() takes digraphs by default
This can be disabled via a:options.isAllowDigraphs = 0. The query functions for register, mark, substitute confirm, history recall, and confirmed filter disallow that as it's not needed.
2022-02-21 11:34:00 +01:00
Ingo Karkat abeb9494d0 CHG: ingo#query#get#[Writable]Register(): Turn a:errorRegister and a:invalidRegisterExpr into option Dict values and add a:options.additionalValidExpr
And then reuse in ingo#plugin#rendered#ListJoinedOrBraceExpression().
2022-02-21 08:41:26 +01:00
Ingo Karkat 2603063a77 ingo#plugin#rendered#ListJoinedOrBraceExpression(): FIX: Misplaced :continue
Left-over from when the function was part of an outer loop. Instead, return the special "Quit" value to the client.
2022-02-21 08:20:35 +01:00
Ingo Karkat 0f4a6ec342 ingo#plugin#rendered#ListJoinedOrBraceExpression(): Minor: Reuse ingo#register#Writable() 2022-02-21 08:20:25 +01:00
Ingo Karkat e7f80500b1 ENH: Also add the register contents to the search history when the target register is "/"
To facilitate easier recall, and for consistency.
2022-02-17 11:21:21 +01:00
Ingo Karkat abbe8e6ce2 ENH: The Callback can override the history item that gets put into the list of recalls
In case the Callback modifies the history item and wants that persisted.
2022-02-13 20:50:32 +01:00
Ingo Karkat 9a55aca9df Documentation: Mention who provides and who consumes each of the three sources 2022-02-13 20:49:46 +01:00
Ingo Karkat 329eb3ae11 Refactoring: Minor: Extract l:historyItem 2022-02-13 20:41:31 +01:00
Ingo Karkat b73c0d8ffe Only add the history item to the recalls if the Callback indicates success
By moving the Callback invocation above the recall stack manipulation, and evaluating its return value (accounting for all the different variable types) instead of just passing it through.
2022-02-13 18:51:26 +01:00
Ingo Karkat 615c5bbefe Echo the intermediate characters when querying a multi-character sequence
With a leading " for named or recalls, and now also with additionalListCommands. This provides better feedback to the user.
2022-02-13 18:02:36 +01:00
Ingo Karkat 1b3d160ef7 ENH: Implement choosing a different callback in the list via a:options.additionalListCommands 2022-02-13 17:53:44 +01:00
Ingo Karkat 9a8fd5c5fa Refactoring: Minor: Pass a:Callback into s:Recall() 2022-02-13 12:00:04 +01:00
Ingo Karkat 2cbe9eef5a Cosmetics: Move lines around 2022-02-13 11:25:51 +01:00
Ingo Karkat 104a5ffedf FIX: s:namedSources still accessed directly
Use s:GetSource() to consistently handle a Funcref everywhere.
Define l:named at the top to avoid duplicate re-initialization.
2022-02-13 11:21:41 +01:00
Ingo Karkat 1a23e16bbc Cleanup: Unnecessary re-assignment of l:recalls 2022-02-13 11:11:07 +01:00
Ingo Karkat e71ea5cef9 ENH: Allow additional client arguments on ...#Recall() and ...#List() and forward those to a:Callback
This allows customization of the recall, e.g. different behavior for normal vs. visual mode mappings.
2022-02-12 19:47:31 +01:00
Ingo Karkat 8010e545bf Clear the query output before executing the recall
The recall itself may print information, so it's better if the (done and uninteresting) query UI gets cleared first.
2022-02-12 10:35:54 +01:00
Ingo Karkat 184f4d4a46 Pass the maxItemNum to a Funcref for s:GetSource(s:historySources)
For a List, we need a maximum of 9, and for a direct recall, we just need the count'th one. I don't want to introduce two separate APIs for the list and the indexed get; I think a combination that just asks for a List slice is a good compromise. Clients can completely ignore this and return the full List. Other clients may have to iterate over a source and for those the opportunity to stop early when enough is produced is valuable, though.
2022-02-12 10:32:07 +01:00
Ingo Karkat 1cea833dd4 Renaming: hasName -> hasRegister 2022-02-11 21:34:41 +01:00
Ingo Karkat 0236a9788b ENH: Allow deletion of all named / recalled via <Del> / <BS> 2022-02-11 21:33:50 +01:00
Ingo Karkat 75eac8ee87 ENH: Allow deletion of named or recalled via <Del> 2022-02-11 21:33:30 +01:00
Ingo Karkat fac1aa51c7 Minor: Do not accept 0 as a number
This would result in index -1, i.e. remove the last element, which would be unexpected.
2022-02-11 21:15:49 +01:00
Ingo Karkat 3535dedc54 Minor: Add missing cpo 2022-02-11 21:15:29 +01:00
Ingo Karkat 36815172c8 Documentation: Mention new module, add usage documentation, include in manifest 2022-02-10 21:32:28 +01:00
Ingo Karkat 7782c0fead BUG: Duplicate recalls when mixing previous history recalls from list and directly
The direct recall mistakenly uses the index (a:count - 1), whereas the list uses the 1-based choice. So the last history gets a recalled identity of "1 when selected from the list but one of "0 when recalled directly. Despite identical contents, the number mismatch causes an unexpected push to the top.
Correct the former to consistently use 1-based counts.
2022-02-10 21:22:45 +01:00
Ingo Karkat 1cacbd6b78 FIX: Cycling of recalled items breaks if two consecutive recalls are identical
The recalled number and the first recalled item become identical, and then the check finds no differences, so the current recall is not put back on top. This breaks an A-B-B cycling when the recall history becomes B-A-B; the second B is not put on top to B-B-A, and (second) B will repeat indefinitely.
Adapt the position of recalled things (e.g. on "3 from 3 to 1), then on a repeat ("3 again), the recall number is different (though the contents are not), and the cycling continues.
2022-02-10 21:22:45 +01:00
Ingo Karkat 30ebcc9eb1 Use the named recall identity when assigning from the recall hist to it
The named slot likely has the greatest stability and will likely be used soon, so to avoid recording duplicates in the recall history, this should be used.
2022-02-10 21:22:45 +01:00
Ingo Karkat ddd0bf10d6 ENH: Add a:options.isUniqueRecalls
Most clients likely want a deduplicated history (just like Vim's built-in histories for commands, searches, etc.). However, my PrevInsertComplete.vim can employ duplicate entries with the cycling effect to repeatedly insert A-A-B by pushing (via named recalls) A into two different named registers (and then recalling via "3).
2022-02-10 21:22:45 +01:00
Ingo Karkat 4e7c84fa86 Take return value from a:Callback and return it to the client
This way, recall errors can be channeled back (e.g. via ingo#err#Set() / ingo#err#Get()) to the client mapping.
2022-02-10 21:22:45 +01:00
Ingo Karkat bbbce455e3 Refactoring: Allow Funcref sources, too 2022-02-10 21:22:41 +01:00
Ingo Karkat 2fa3c808f9 CHG: Minor: Pass whatPlural via a:what List instead of optional argument
It's closer to the original value and allows for future extensions.
2022-02-10 21:22:07 +01:00
Ingo Karkat a4c6c4bae5 BUG: Wrong invocation order for Callback; need to initialize s:recalledIdentities and s:lastHistories, too 2022-02-10 21:22:07 +01:00
Ingo Karkat 0bb9d59231 ENH: Allow passing a custom what plural form for messages
During registration; for "what"s that do not have a regular plural form.
2022-02-10 21:22:02 +01:00
Ingo Karkat c00fd88a0d Refactoring: Replace forwarding of a:source and a:Callback arguments with add one-time registration
As this is static data; it makes it easier from the client perspective, too.
2022-02-09 19:40:43 +01:00
Ingo Karkat 7996f272b6 Add generalized implementation from PrevInsertComplete.vim 2022-02-09 19:33:23 +01:00
Ingo Karkat 39b0592b8d dirforaction: ENH: Add a:parameters.completeFunctionHook 2021-03-16 13:50:11 +01:00