How to return a list of all text editors via terminal?
No, there's no such command or list available in the Terminal.
The command you've found for Ubuntu is part of the so called alternatives system that is found mostly in Debian-based Linux distributions. It's not available on all Linux systems, it's not available on BSD based systems and definitely not available on macOS.
Also the update-alternatives command does not necessarily list all text editors on the system (you see your own list is pretty small). It is only lists those that are registered with the alternatives system, which is not all of them. Commonly GUI-based editors are not listed here for example.
Instead of alternatives, macOS has the concept of file associations or &quot;preferred applications&quot;. As far as I recall, this predates alternatives. Application bundles on macOS contain information about the file types that the application is willing to support. The user can choose which application is by default used to open a specific file type - this means that you can associate for example JPEG files with the photo editing software of your own choice. However, this is for GUI programs - not command line utilities as such.
An easy way to list and manipulate file associations via the command line is to use the third party utility SwiftDefaultApps. It can be installed from HomeBrew Casks using this command:
brew cask install swiftdefaultappsprefpane

After installation you'll have a command available named swda. You can run it like this to get a list of file associations:
swda getUTIs