Get command definition

Is it possible to get a definition of specific command? I know that there is a command “:command {cmd}” that either lists all commands or a specific one and there I can check the command definition. But how can I do so programmatically?

Currently I’m working on a script that intercepts commands to run smth before their execution. In my case this is needed for opening floating window so the buffer would be insterted into a floating window instead of creating a separate one. It will be useful just to intercept commands of plugins like vim-fugitive that don’t support floating windows.

1 Like