dressing.nvim icon indicating copy to clipboard operation
dressing.nvim copied to clipboard

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

Open chrisgrieser opened this issue 2 years ago • 2 comments
trafficstars

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?)

chrisgrieser avatar Sep 22 '23 14:09 chrisgrieser

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?

stevearc avatar Sep 29 '23 00:09 stevearc

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"

chrisgrieser avatar Sep 29 '23 09:09 chrisgrieser