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
    Nov 15 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.
    – D. Ben Knoble
    Nov 14 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.
    – D. Ben Knoble
    Nov 14 at 19:45
  • @D.BenKnoble, I have tried BufWritePost but I ended to have both messages instead of only the desired Saved. Nov 14 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.
    – D. Ben Knoble
    Nov 14 at 21:16
  • 1
    I have updated the solution to avoid that problem :-) Nov 20 at 10:52

Your Answer

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

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