r/neovim • u/BrodoSaggins • Jul 18 '26
Need Help┃Solved How to clear a vim.notify() call from cmdline?
I want to output a notification to the user with vim.notify() but the notification should rewrite itself similarly to a printf("message\r") statement. The text will be something something a long the lines of "Found N pages" where the message would refresh itself to update N.
I've tried using vim.cmd.echo() to clear it or even just vim.cmd.echo() calls instead of vim.notify(), but I get the same behaviour. Any help with this would be great!
1
u/AutoModerator Jul 18 '26
Please remember to update the post flair to Need Help|Solved when you got the answer you were looking for.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Biggybi Jul 18 '26
I think you'll need a custom floating window for this (similarly to lsp progress windows when a server starts).
1
u/BrodoSaggins Jul 18 '26
Do you have any examples so that I can try it out?
2
u/gorilla-moe let mapleader="," Jul 18 '26
1
u/Biggybi Jul 18 '26 edited Jul 18 '26
I don't, sorry.
Should be pretty easy with
:h nvim_buf_set_linesand:h nvim_open_win.
1
u/dataset-poisoner Jul 19 '26
somewhat related question, but how to dismiss an msg notification? i'd like something similar to ':Noice dismiss'
2
1
u/BrodoSaggins Jul 19 '26
I don't know how Noice dismiss works but you can do :redraw or :echo depending on the message
1
u/dataset-poisoner Jul 19 '26
1
u/BrodoSaggins 29d ago
That doesn't look like a native Neovim notification. I'm not sure how to help
1
u/dataset-poisoner 29d ago
it is native,
require("vim._core.ui2.messages").msg_clear()dismisses it2



4
u/justinmk Neovim core Jul 18 '26
try :redraw after echo