In Emacs, I can create functions in Lisp language and place them in .emacs file. Those function will become commands that can be called from the editor or bound
.emacs
There's Power Tools by e.GO:digital. It has support for custom commands and event triggers (ie. on file changed), among other things.