Is it possible to configure TextMate to launch the program I am currently writing (using the Command+R shortcut) with some command line parameters?
1 Answer
What language are you writing the program in? I'll use Python as an example.
Go to Bundles menu > Edit Bundles. Find and click on Python
in the lefthand column. Click on Menu Actions
in the middle column, then Run Script
in the righthand column.
At the bottom of the window you will see the script that is run each time you use ⌘+R. Look for the line that begins with TextMate::Executor.run
.
Right now, it appears for me as this:
TextMate::Executor.run(ENV["TM_PYTHON"] || "python", "-u", ENV["TM_FILEPATH"], :create_error_pipe => true, :use_hashbang => !ENV.has_key?('TM_PYTHON')) do |str, type|
Change it to this:
TextMate::Executor.run(ENV["TM_PYTHON"] || "python", "-u", ENV["TM_FILEPATH"], :create_error_pipe => true, :script_args => ["-arg1", "-arg2"], :use_hashbang => !ENV.has_key?('TM_PYTHON')) do |str, type|
Note the addition of :script_args => ["-arg1", "-arg2"]
. Change the arguments in the parentheses to the arguments you want passed.
You can find other options to be used with TextMate::Executor.run
in the source file on GitHub.