0

The default message displayed on the prompt when one saves a file is

"<file_name>" <nlines>L, <ncharacters>C written

and it remains in the prompt until another message is to be displayed.

I'd like to change this by using a custom message which should remain on the prompt for 1-2 seconds and then go away.

How can I do this?

-1

I believe one could do this with something like

augroup MyWriteMsg
  au!
  au BufWritePost echom 'my message'
augroup

Though you would want to use a timer to clear it. I’m not sure I see the value in doing that though, as it’s only more complexity for what (as far as I can see) is no benefit.

| improve this answer | |
  • No you're right, there's no concrete benefit, I just like it better. Could you post the complete answer including a timer to clear the prompt? – noibe Jan 13 at 1:06
  • @noibe from my phone, without vim docs, probably not. But you can read :help timer as a start – D. Ben Knoble Jan 13 at 1:07
  • I guess it is smth like: ``` func! ClearMessage(timer_id) abort echo '' endfunc func! CustomSaveMessage() abort echo 'my message' call timer_start(1000, 'ClearMessage') endfunc augroup MyWriteMsg au! au BufWritePost * call CustomSaveMessage() augroup END ``` But it wouldn't work as expected – Maxim Kim Jan 13 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.