Usage of vim.keymap.set on visual mode multi-lines get selected

How to update this line please:

vim.api.nvim_set_keymap('v', '<M-?>', ':Commentary<CR>gv', NOREF_NOERR_TRUNC)

I want to exit the visual mode to normal mode and go back in again.

Just change vim.api.nvim_set_keymap to vim.keymap.set, nothing different. I’ve tried to convert each {rhs} to a lua function in my config, but found the marks “<” and “>” didn’t update even i fed <ESC> or <C-\><C-N> in vmap mode… So it is ok to use a string expression for {rhs}, in old style :joy: