Run a script when I do "Ctrl + S" on any file?


I’ve found the keymap.cson and added:


_ ‘ctrl-s’: ‘core:save’_

But I also want it to run a batch file in an absolute/relative directory. Is there any way to do this?


I didn’t add the underscores… Idk how to remove those from main post


It’s possible to create an event listener in that runs the script whenever a file is saved. However, I want to make sure that you want what you say you want. Do you really want the script to run when any file is saved?

This a sample of what you might write if you want to run it when you save any file and you’re using process-palette to run the script.

atom.workspace.observeTextEditors (editor) ->
  editor.onDidSave (saved) ->
    atom.commands.dispatch editor.element, "process-palette:run-my-script"


Perfect, this is exactly what I need.

I’ll figure out the “run-my-script” part