This package allow you to bind javascript functions to commands (Ctrl-Shift-P
) and key bindings just by writing those in a file.
In the root of a specific the desired project, create a file named scripts.js
. In this file, you will code the functions related to the this very project root, thus not binding them to stranger files.
Each scripts file must be a node module exporting an array of objects with the following properties:
'^index\\.js$'
; This will filter the files allowed to run the script.'ctrl-f9'
; This will be the registered key binding for the script.data
argument whose members provide a few utilities:
file
: A string containing the active file path.project
: A string containing the active project root path.exec
: The child_process
function for executing shell commands.So we end up with the following file scripts.js
.
module.exports = [{name: 'build',match: '^index\\.js$',hotkey: 'ctrl-f9',script: (data) => {// Your code here...}},{name: 'debug',match: '^.*\\.js$',hotkey: 'ctrl-f8',script: (data) => {// Your code here.}}]
For bug reporting, feature requesting and any issues, please refer to our active GitLab repo. Enjoy scripting!
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.