This is from "Reformat with JS Beautifier" command:
Command(s):
cat > /tmp/reformat_this_file.js cd "$TM_BUNDLE_SUPPORT/bin/js-beautify/" java -jar ../js.jar beautify-cl.js -n -i 1 /tmp/reformat_this_file.js 2>&1
Input: Selected Text or Scope Output: Replace Selected Text
HTH
-- Alexey
On Wed, May 5, 2010 at 15:27, Marius Hofert m_hofert@web.de wrote:
Dear TextMate experts,
I would like to execute the shell script myscript.sh from within TextMate. The script myscript.sh takes a file name as argument and does something with the file (it indents the file correctly; for this, it calls emacs in batch mode). So if I use sh myscript.sh myfile.R the script works perfectly fine, i.e., it indents the source code contained in myfile.R. I would like to have textmate do this for me on the file I am working on when I use a certain key combination.
Using the Bundle Editor, I created a new command "tidy" with key equivalent "shift+command+T". As the actual command, I put in: sh /path_to_my_script/myscript.sh "$TM_FILENAME"
Unfortunately, this does not work. I set "Input" to "Entire Document" and "Output" to "Replace Document" (currently I obtain an empty document after "shift+command+T").
How can I trigger the shell script, such that the current content of myfile.R is replaced by the (quietly generated) output of myscript.sh?
Below is the script
Many thanks in advance,
Marius
#!/bin/sh function usage () { printf "Indent R file with Emacs ESS package.\n" printf "Usage: $0 FILE\n" exit 1 } f=$1 shift if test "x$f" = x -o "x$f" = "x-h"; then usage fi emacs -batch \ -eval '(load "/usr/local/share/emacs/site-lisp/ess-5.8/lisp/ess-site")' \ -f R-mode \ -eval '(untabify (point-min) (point-max))' \ -eval '(insert-file "'${f}'")' \ -eval '(set-visited-file-name "'"${f}"'")' \ -eval '(indent-region (point-min) (point-max) nil)' \ -f save-buffer \ 2>/dev/null
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate