When using a custom keymap in visual mode:
vim.keymap.set("v", "gaU", ":lua require('textcase').current_word('to_upper_case')<CR>")
it enters insert mode and leaves an additional w when done
fooBa*r <-- * is cursor in normal mode
viw to select the inner word
gaU to convert to uppercase
Fw*OOBAR <-- * is cursor in insert mode