[TxMt] Re: rmate custom commands?
mailinglist at textmate.org
Sun May 12 14:51:51 UTC 2013
On May 12, 2013, at 10:17, Allan Odgaard <mailinglist at textmate.org> wrote:
> On May 9, 2013, at 9:59, Jose Luis Canciani <textmate at jluis.com.ar> wrote:
>> […] I'm interested in sending commands to execute: for example I would want to be over a class name and with a key combination send something like "run\r\n"+ "/find/and/send/to/rmate MyClass", so rmate will run this as an OS command. […]
> […] it might be easier to create new commands that use ‘ssh «server» «command»’ to execute «command» on «server».
Come to think of it, many of the standard bundle items will optionally read the command from an environment variable and we can set these for the (virtual) server path in ~/.tm_properties, for example if we add this:
[ /home/** ]
TM_RUBY = 'cat'
Then opening a file on your server under /home (via rmate) will have TM_RUBY set to ‘cat’ meaning the ruby bundle will use ‘cat’ instead of ‘ruby’ for the various actions like Validate Syntax, Run, etc.
Presently though we mostly treat variables as a single command, meaning if we set TM_RUBY to ‘ssh «server» ruby’ then it will not be shell-expanded but instead treated as a single executable name.
This is something I think should be changed, as I ran into same issue with the C/C++ bundle, where I changed the default TM_GCC variable to ‘xcrun clang’. Escaping the variables was so the user wouldn’t care about special characters, but in retrospect, it limits the possibilities.
I should add that in the current build it might not work to set variables for the virtual server path (in ~/.tm_properties). It will however work in next build.
If this is a viable solution though then it might be better to introduce a custom scope for files opened via rmate, that’s more robust to target.
More information about the textmate