How set user-defined values in the `vim.bo` namespace?

Viewed 64

Introduction

Migrating little by little from vimscript to lua, I wanted to create a usermessage variable that I could set in a function call. For instance:

fun! ShowHiGroup()
  " set statusline+=%{HiGroup()}
  lua vim.bo["usermessage"] = '%{HiGroup()}'
  echom  "Activated show highlight group"
endfun

It would be read by my status line rendering function when the value is set (so it's a "maybe usermessage").

I tried naively to set vim.bo["usermessage"] and received "invalid option value".

Question

Is there a buffer namespace I can use to set user-defined values?

0 Answers
Related