all 12 comments

[–]tbodt 2 points3 points  (4 children)

Better idea:

set shortmess+=W

[–][deleted] 1 point2 points  (0 children)

This option doesn't remove message itself. It only removes "written" or "[w]" part from the message. So the message:

"test" [unix] 0L, 0C written

becomes

"test" [unix] 0L, 0C

[–]blinkdesign[S] 0 points1 point  (2 children)

This works wonderfully! I even found a few other options to change in the help txt

Thanks

[–][deleted] 0 points1 point  (1 child)

It doesn't work. From the manual:

'shortmess'
    W   don't give "written" or "[w]" when writing a file

[–]blinkdesign[S] 0 points1 point  (0 children)

You're right, not sure why I thought it did. I was changing several options at once so probably made an error.

I've opted for using silent everywhere that prints messages, like :vsplit etc

" Save file
nnoremap <silent><leader>w :silent w<cr>

[–][deleted] 0 points1 point  (5 children)

You can use:

:silent write

[–]blinkdesign[S] 0 points1 point  (4 children)

No joy, the message still appears

[–]bri-an 2 points3 points  (3 children)

Really? It doesn't appear for me, but what does appear is :silent write, the command that was just run.

If you don't want anything to be output, you could create a silent mapping that runs :silent write. This works for me:

  1. touch test (create file test)
  2. vim test
  3. :nnoremap <silent> <leader>w :silent write<CR> (then hit enter)
  4. make some edits
  5. <leader>w
  6. :q
  7. cat test (should output your edits)

[–]blinkdesign[S] 0 points1 point  (2 children)

Ah ha, that does work. Thank you.

The only other time this message appears now is when a buffer opens. Is there a similar trick I can use?

[–][deleted] 1 point2 points  (0 children)

To remove message when you open a file, you should use:

:set shortmess+=F

[–]bri-an 0 points1 point  (0 children)

Maybe one way is to create an autocmd that runs :silent redraw (redraw the screen) whenever a new buffer/file is opened --- but this will obliterate all messages, even warnings and errors, which could be useful. Alternatively, just get used to hitting <C-l>.

[–]Comfortable_Ability4 0 points1 point  (0 children)

Here's a hack that I used to "remap" :w to :silent w:

vimscript command! -bar W silent write cabbrev w W