-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): Add command + API to repeat last selected item #385
Conversation
@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 :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