stevearc / dressing.nvim

Neovim plugin to improve the default vim.ui interfaces
MIT License
1.69k stars 32 forks source link

FR: history of `vim.ui.input` when aborting & across sessions #118

Open chrisgrieser opened 9 months ago

chrisgrieser commented 9 months ago

A minor QoL thing, but I noticed that when I abort an input, and then call the same command again, the text I previously typed is gone and also not available in the history.

So when I want to do sth, remember that I have to do something beforehand, I have to <Esc>yy<Esc>, do the thing I forgot, call the input field again, and then <Esc>pA. All that hassle could be avoided by saving the text of an aborted input in the history. Maybe as an opt-in, if it is not desirable for all users?

Somewhat related, it seems the history only persists during a session, after restarting nvim, I cannot find previous entries anymore with <Up>. I'd definitely find a persistent history useful. (Maybe with a max-history size or something?)

stevearc commented 9 months ago

I think it would be reasonable to save and restore the last value if the user cancels out of an input window, provided that the default value is empty. Does that match your use case?

chrisgrieser commented 9 months ago

Kind of. But restoring the last value of a cancelled input in general could also be annoying, because you do not always want to re-use that text. Thus, the idea of prepending the item to the history.

Alternatively, there could also be some sort of timeout maybe? For example, "if an input is re-opened within 5 minutes, restore the value, otherwise, start empty"