Closed mrjones2014 closed 1 year ago
@notEvil mind giving it a test?
It works. There is one problem though: the item could be invalid because the context changed (buffer, filter, ...).
What do you mean? The context gets rebuilt when the item is re-executed. It will operate on the new context. Is that not what you were expecting?
Sorry, I should pay more attention to terminology. With context I meant the state the repeat is initiated in. For instance, the last item could be available only for specific buffers or modes, or item filters could return false where they returned true previously.
Ah, I see. I'll keep thinking on it.
We'll probably need to keep track of the filters used on the last select and see if the item matches the filters as well.
@notEvil I've pushed an update so that it only executes the item if it still matches the previous set of filters used.
You can escape this behavior by running the command with a bang, or passing true
to the Lua function:
:LegendaryRepeat
" ignore filters like
:LegendaryRepeat!
or in Lua
require('legendary').repeat_previous()
require('legendary').repeat_previous(--[[ ignore_filters: ]] true)
I just tested it and it works as expected. Thanks!
Thanks for helping me test!
Resolves: #384
How to Test
legendary.nvim
's finder UI and select a command:LegendaryRepeat
or:lua require('legendary').repeat_previous()
Testing for Regressions
I have tested the following:
legendary.nvim
in all modes (normal, insert, visual)legendary.nvim
, then triggering via the keymap in all modes (normal, insert, visual)legendary.nvim
in all modes (normal, insert, visual)legendary.nvim
, then running the command manually from the command lineaugroup
/autocmd
s created throughlegendary.nvim
work correctly