2

In Vim, at the the bottom. There is statusline.

And below it there is, I think, the command line.

When I press save, this command line, displays something like:

"index" 160 lines, 2097 characters written

But I don't want it to display this.

I would only like it to display something like:

Saved.

How do I do that?

1
  • So far, relying on the [+] marker in the statusline to show unsaved modifications has served me well.
    – Friedrich
    Commented Nov 15, 2023 at 12:32

1 Answer 1

4

You could use the BufWriteCmd to override the write operation:

augroup OverrideWrite
autocmd!
autocmd! BufWriteCmd * silent w | echo 'Saved'
augroup END
6
  • I would much prefer to see w written out as write, especially in example code. Commented Nov 14, 2023 at 19:44
  • 2
    Also, you're missing handling all the stuff in :help Cmd-event. Probably just using BufWritePost to echo a message suffices. Commented Nov 14, 2023 at 19:45
  • @D.BenKnoble, I have tried BufWritePost but I ended to have both messages instead of only the desired Saved.
    – Vivian De Smedt
    Commented Nov 14, 2023 at 19:59
  • 2
    I still think you're missing a lot of details for BufWriteCmd to work correctly, and this probably breaks plugins that use it. Commented Nov 14, 2023 at 21:16
  • 1
    I have updated the solution to avoid that problem :-)
    – Vivian De Smedt
    Commented Nov 20, 2023 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.