Run a script on save in textmate
up vote
3
down vote
favorite
I was wondering if it was possible to run a custom script on save based on certain file names in textmate. For example I'd like to auto compile a C program sometime on save.
textmate
add a comment |
up vote
3
down vote
favorite
I was wondering if it was possible to run a custom script on save based on certain file names in textmate. For example I'd like to auto compile a C program sometime on save.
textmate
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I was wondering if it was possible to run a custom script on save based on certain file names in textmate. For example I'd like to auto compile a C program sometime on save.
textmate
I was wondering if it was possible to run a custom script on save based on certain file names in textmate. For example I'd like to auto compile a C program sometime on save.
textmate
textmate
edited Aug 19 '11 at 9:40
studiohack♦
11.3k1880113
11.3k1880113
asked Dec 21 '09 at 8:19
Matt
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
4
down vote
It's actually fairly easy to do this using a custom command in a bundle.
Here's how to make a simple command:
- Open up the bundle editor, and find the bundle you want to add to.
- Create a "New Command" using the button on the bottom left of the editor. Name it appropriately, and set its scope to
source.c
. - Set the action dropdown to "Key Equivalent", and set the shortcut
Cmd + S
. - Change the "Save" dropdown to "Current File".
- Enter your command, and set the input and output dropdowns appropriately. Input will be piped to STDIN if I remember correctly.
- Reload TextMate's bundles.
That's it. You should now have a command which saves the file, and runs a command.
You can probably do something with TextMate commands by using a macro in a similar way.
add a comment |
up vote
1
down vote
As far as I know, there's no way to do this as you described, for all save situations (i.e., using Command-S, selecting File->Save, etc.).
You might be able to create a custom bundle item that saves the document and executes your script, and assign it Command-S, so that it runs when you use that keyboard shortcut.
add a comment |
up vote
0
down vote
you can trigger a command after save via callback.document.did-save
semantic class. This works on TextMate2+
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
It's actually fairly easy to do this using a custom command in a bundle.
Here's how to make a simple command:
- Open up the bundle editor, and find the bundle you want to add to.
- Create a "New Command" using the button on the bottom left of the editor. Name it appropriately, and set its scope to
source.c
. - Set the action dropdown to "Key Equivalent", and set the shortcut
Cmd + S
. - Change the "Save" dropdown to "Current File".
- Enter your command, and set the input and output dropdowns appropriately. Input will be piped to STDIN if I remember correctly.
- Reload TextMate's bundles.
That's it. You should now have a command which saves the file, and runs a command.
You can probably do something with TextMate commands by using a macro in a similar way.
add a comment |
up vote
4
down vote
It's actually fairly easy to do this using a custom command in a bundle.
Here's how to make a simple command:
- Open up the bundle editor, and find the bundle you want to add to.
- Create a "New Command" using the button on the bottom left of the editor. Name it appropriately, and set its scope to
source.c
. - Set the action dropdown to "Key Equivalent", and set the shortcut
Cmd + S
. - Change the "Save" dropdown to "Current File".
- Enter your command, and set the input and output dropdowns appropriately. Input will be piped to STDIN if I remember correctly.
- Reload TextMate's bundles.
That's it. You should now have a command which saves the file, and runs a command.
You can probably do something with TextMate commands by using a macro in a similar way.
add a comment |
up vote
4
down vote
up vote
4
down vote
It's actually fairly easy to do this using a custom command in a bundle.
Here's how to make a simple command:
- Open up the bundle editor, and find the bundle you want to add to.
- Create a "New Command" using the button on the bottom left of the editor. Name it appropriately, and set its scope to
source.c
. - Set the action dropdown to "Key Equivalent", and set the shortcut
Cmd + S
. - Change the "Save" dropdown to "Current File".
- Enter your command, and set the input and output dropdowns appropriately. Input will be piped to STDIN if I remember correctly.
- Reload TextMate's bundles.
That's it. You should now have a command which saves the file, and runs a command.
You can probably do something with TextMate commands by using a macro in a similar way.
It's actually fairly easy to do this using a custom command in a bundle.
Here's how to make a simple command:
- Open up the bundle editor, and find the bundle you want to add to.
- Create a "New Command" using the button on the bottom left of the editor. Name it appropriately, and set its scope to
source.c
. - Set the action dropdown to "Key Equivalent", and set the shortcut
Cmd + S
. - Change the "Save" dropdown to "Current File".
- Enter your command, and set the input and output dropdowns appropriately. Input will be piped to STDIN if I remember correctly.
- Reload TextMate's bundles.
That's it. You should now have a command which saves the file, and runs a command.
You can probably do something with TextMate commands by using a macro in a similar way.
answered Jan 28 '10 at 17:42
Matt
1915
1915
add a comment |
add a comment |
up vote
1
down vote
As far as I know, there's no way to do this as you described, for all save situations (i.e., using Command-S, selecting File->Save, etc.).
You might be able to create a custom bundle item that saves the document and executes your script, and assign it Command-S, so that it runs when you use that keyboard shortcut.
add a comment |
up vote
1
down vote
As far as I know, there's no way to do this as you described, for all save situations (i.e., using Command-S, selecting File->Save, etc.).
You might be able to create a custom bundle item that saves the document and executes your script, and assign it Command-S, so that it runs when you use that keyboard shortcut.
add a comment |
up vote
1
down vote
up vote
1
down vote
As far as I know, there's no way to do this as you described, for all save situations (i.e., using Command-S, selecting File->Save, etc.).
You might be able to create a custom bundle item that saves the document and executes your script, and assign it Command-S, so that it runs when you use that keyboard shortcut.
As far as I know, there's no way to do this as you described, for all save situations (i.e., using Command-S, selecting File->Save, etc.).
You might be able to create a custom bundle item that saves the document and executes your script, and assign it Command-S, so that it runs when you use that keyboard shortcut.
answered Dec 27 '09 at 5:43
Lawrence Velázquez
929412
929412
add a comment |
add a comment |
up vote
0
down vote
you can trigger a command after save via callback.document.did-save
semantic class. This works on TextMate2+
add a comment |
up vote
0
down vote
you can trigger a command after save via callback.document.did-save
semantic class. This works on TextMate2+
add a comment |
up vote
0
down vote
up vote
0
down vote
you can trigger a command after save via callback.document.did-save
semantic class. This works on TextMate2+
you can trigger a command after save via callback.document.did-save
semantic class. This works on TextMate2+
answered Nov 29 at 5:25
vigo
18126
18126
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f86002%2frun-a-script-on-save-in-textmate%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown