@ftonneau Thanks so much. It’s valuable for me to see these kinds of examples.
Btw 2: If you want word counts to be available only in markdown documents, you should probably move
set-option -add global modelinefmtintohook global WinSetOption ...EDIT: in that case,globalshould be replaced bybuffer.
Yeah, this is so much nicer than conditionally setting an empty string via an option declared as a string ![]()
declare-option -hidden int modeline_buf_word_count 0
-set-option -add global modelinefmt ' - W:%opt{modeline_buf_word_count}'
# ...
hook global WinSetOption filetype=markdown %{
+ set-option -add buffer modelinefmt ' - W:%opt{modeline_buf_word_count}'
hook buffer InsertIdle .* update-modeline-buf-word-count
hook buffer NormalIdle .* update-modeline-buf-word-count
}