Is it possible to run a keybinding inside a snippet?


I’d like to create a snippet for a new PHP class file which includes the automatically generated namespace of the PHP class, and the name of the class.

I already have a package that adds the ctrl-alt-n keybinding, which adds the namespace to the current file, but haven’t figured out a way to trigger that keybinding from inside of a snippet. Also, I’d like to be able to add the name of the current file, minus the “.php”.

The resulting app/Services/SomeFolder/SomeService.php file would look like


namespace App\Services\SomeFolder;

class SomeService



There’s this pull request with a proposal for adding similar things to what you want:

You may also want to take a look at some of the other enhancement suggestions for the snippets package.


Thanks for your prompt reply.

I’ve mentioned my added interest on that thread, and requested keybinding and/or package function calling from inside the snippets.