From cac4489fb51348ae828564389ddbf621693997e9 Mon Sep 17 00:00:00 2001 From: rrueger Date: Wed, 5 Jun 2024 15:08:54 +0200 Subject: Add g:statusryne_word_char_count option Decides whether/character count statistics are shown --- plugin/statusryne.vim | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'plugin/statusryne.vim') diff --git a/plugin/statusryne.vim b/plugin/statusryne.vim index f5a28fe..4b48024 100644 --- a/plugin/statusryne.vim +++ b/plugin/statusryne.vim @@ -135,19 +135,23 @@ function! FileStats() let bytes = bytes / 1000 endfor - " Word count - let old_status = v:statusmsg - exe ":silent normal g\" - if v:statusmsg == '--No lines in buffer--' - let word_count = '0(w)' - let char_count = '0(c)' + if exists("g:statusryne_word_char_count") && g:statusryne_word_char_count == "0" + return size else - let word_count = str2nr(split(v:statusmsg)[11]) . '(w)' - let char_count = str2nr(split(v:statusmsg)[15]) . '(c)' - endif - let v:statusmsg = old_status + " Word count + let old_status = v:statusmsg + exe ":silent normal g\" + if v:statusmsg == '--No lines in buffer--' + let word_count = '0(w)' + let char_count = '0(c)' + else + let word_count = str2nr(split(v:statusmsg)[11]) . '(w)' + let char_count = str2nr(split(v:statusmsg)[15]) . '(c)' + endif + let v:statusmsg = old_status - return word_count . ' ' . char_count . ' ' . size + return word_count . ' ' . char_count . ' ' . size + endif else return '' -- cgit v1.2.3-70-g09d2