0

After I write a file with :w! I see in the ruler the following output message text in the ruler or status line:

"FILE_NAME" 192L, 9357C written
  1. What is this output message text called in the help system?
  2. How do I edit it to show word count?

The output of the wc command shows line, word and character counts.

wc ./FILE_NAME
192 1695 9357 ./FILE_NAME

When I write a file I would like to add 1695W to the output message text shown.

2

I am not sure, what that message is called like and did not find anything in the help currently. However what the message looks like can be influenced with the 'shm' (shortmessage) option and the flag l, see link.

If you want to change it, I would suggest to create a BufWritePost` autocommand, that outputs the required information, e.g. like this:

function! WordCount()
  let wc=wordcount()
  return  '"'.
    \ expand("<afile>"). '" '.
    \ line('$'). 'L, '.
    \ wc['chars']. 'C '.
    \ wc['words']. 'W written'
endfunction

augroup MyBufWritePost
  au!
  au BufWritePost * echom WordCount()
augroup END

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.