The command you want is just gq. In normal mode it accepts a motion, eg gqip or gq}. And it works in visual mode as well. The gqq command is a special case for the current line. Personally I use https://github.com/kana/vim-textobj-line which defines a text object for the current line and maps it to _, so gq_ also formats the current line.
See here for relevant documentation: https://neovim.io/doc/user/change.html#formatting