# Encoding: UTF-8

[{beforeRunningCommand: "nop",
  command: 
   "ERR=$(osascript -e 'tell application \"System Events\" to set frontmost of process \"R\" to true' 2>&1)\n\n#[[ ! -z $ERR ]] && echo \"Sorry, no success to call CarbonEL\"",
  input: "none",
  keyEquivalent: "~@g",
  name: "Bring All Quartz Windows to Front",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "E0880424-74E2-49FF-B8BE-99496443A5C7"},
 {beforeRunningCommand: "nop",
  command: 
   "echo -n > \"$HOME/Library/Application Support/Rdaemon/history/Rhistory.txt\"\necho -n 0 > \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistcounter.txt",
  input: "none",
  keyEquivalent: "~@t",
  name: "Clear History",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "73281DA3-A3F5-4103-B94F-303B32498440"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\n\nANS=$(\"$DIALOG\" -e -p '{messageTitle=\"Rdaemon\";alertStyle=\"critical\";informativeText=\"Do you really want to clear the entire workspace?\";buttonTitles=(\"Clear\",\"Cancel\");}')\nif [ \"$ANS\" == \"0\" ]; then\n\techo \"@|rm(list=ls());gc(reset=TRUE)\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in\n\techo \"Workspace is empty.\"\nelse\n\techo \"Task was cancelled.\"\nfi",
  input: "none",
  keyEquivalent: "~@w",
  name: "Clear Workspace",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "E17C7056-8C4F-4738-A9B9-891D30E635DF"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\n\necho -e \"@|graphics.off()\\n\" > \"$HOME/Library/Application Support/Rdaemon/r_in\"",
  input: "none",
  keyEquivalent: "~@g",
  name: "Close all Graphic Devices",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "C52208F6-DC46-4F56-AFBA-BA69F7C0F89E"},
 {beforeRunningCommand: "nop",
  command: 
   "\nRDHOME=\"$HOME/Library/Application Support/Rdaemon\"\nif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$RDHOME\"\nfi\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\n\nfunction getSig {\n\t[[ -e \"$RDRAMDISK\"/r_tmp ]] && rm \"$RDRAMDISK\"/r_tmp\n\n\t#get R's PID\n\tRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\t#check whether Rdaemon runs\n\ttest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\n\tWORD=$1\n\tTASK=\"@|sink('$RDRAMDISK/r_tmp')\"\n\techo \"$TASK\" > \"$RDHOME\"/r_in\n\tTASK=\"@|cat(paste(.getSig(if ('${WORD}' %in% (ary0815 <- sort(apropos('${WORD}', mode='function')))) '${WORD}' else ary0815), collapse='\\\\n'))\"\n\techo \"$TASK\" > \"$RDHOME\"/r_in\n\tTASK=\"@|rm(ary0815); sink(file=NULL)\"\n\techo \"$TASK\" > \"$RDHOME\"/r_in\n\n\twhile [ 1 ]\n\tdo\n\t\tRES=$(tail -c 2 \"$RDRAMDISK\"/r_out)\n\t\t#expect these things from R\n\t\t[[ \"$RES\" == \"> \" ]] && break\n\t\t[[ \"$RES\" == \"+ \" ]] && break\n\t\t[[ \"$RES\" == \": \" ]] && break\n\t\tsleep 0.05\n\tdone\n\texport RES=$(cat \"$RDRAMDISK\"/r_tmp)\n\n}\n\nWORD=$(ruby -- <<-SCR1 \nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\nword = Word.current_word('\\w\\.')\\w./)\nprint word\nSCR1\n)\n\nWORDORG=\"$WORD\"\n\ngetSig \"^$WORDORG\"\n\nif [ \"${#RES}\" -eq 0 ]; then\n\techo \"No signatur found for '$WORDORG'\"\n\texit_show_tool_tip\nfi\n\nruby -- <<-SCRIPT 2> /dev/null\nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/exit_codes.rb\")\nrequire \"\#{ENV[\"TM_SUPPORT_PATH\"]}/lib/ui\"\nword = \"$WORD\"\nwordorg = \"$WORDORG\"\ntext = ENV['RES']\nfuns = text.split(\"\\n\")\nfunctions = funs.select{|item| item =~ /^\#{word}/}\nfunc = funs.select{|item| item !~ /^\#{word}/}\nf = func.collect { |f| f[0...f.index(\"(\")] }\nfp = f.join(\"\\n\")\nTextMate.exit_show_tool_tip(\"Only found :\\n\#{fp}\") if functions.size < 1\n\nif functions.size == 1\n  function = functions.first\nelse\n\tidx = TextMate::UI.menu functions.collect { |f| f[0...f.index(\"(\")] }\n\tTextMate.exit_discard if idx.nil?\n\tfunction = functions[idx]\nend\n#TextMate.exit_discard if function.empty?\nif ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty?\n  print function[wordorg.length..-1]\nelse\n  print function\nend\nSCRIPT\n",
  fallbackInput: "none",
  input: "selection",
  keyEquivalent: "^$",
  name: "Command Template",
  output: "insertAsSnippet",
  scope: "source.rd.console",
  uuid: "32812513-77C4-4C5C-9D8D-6467680759F7"},
 {beforeRunningCommand: "nop",
  command: 
   "n=$'\\n'\n\ncat <<-AS | iconv -f UTF-8 -t MACROMAN | osascript --\n  tell application \"AppleScript Editor\"\n      activate\n      set theDocument to make new document\n      tell theDocument\n          set contents of selection to \"tell application \\\"TextMate\\\" $n activate $n tell application \\\"System Events\\\" to keystroke \\\"r\\\" using {control down, command down, option down} $n end tell\"\n          try\n              check syntax\n              save as \"application bundle\" in posix file \"$HOME/Desktop/TM_Rdaemon.app\" run only TRUE startup screen FALSE\n          on error error_message number the error_number\n              display dialog \"Error: \" & the error_number & \". \" & the error_message buttons {\"OK\"} default button 1\n          end try\n      end tell\n         quit\n  end tell\nAS\n\ncp \"$TM_BUNDLE_PATH\"/Support/lib/TMRdaemonLogo.icns ~/Desktop/TM_Rdaemon.app/Contents/Resources/\n\ncat ~/Desktop/TM_Rdaemon.app/Contents/Info.plist | perl -e '$/=\"\";$pl=<>;$pl=~s!(CFBundleIconFile</key>\\n\\t{1,}<string>)(.*?)(</string>)!$1TMRdaemonLogo$3!;print $pl' > ~/Desktop/TM_Rdaemon.app/Contents/Info1.plist\nrm ~/Desktop/TM_Rdaemon.app/Contents/Info.plist\ncat ~/Desktop/TM_Rdaemon.app/Contents/Info1.plist > ~/Desktop/TM_Rdaemon.app/Contents/Info.plist\nrm ~/Desktop/TM_Rdaemon.app/Contents/Info1.plist",
  input: "none",
  name: "Create TM_Rdaemon.app",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "F43C0D32-2402-4542-8FB9-EF9AF960E3B9"},
 {beforeRunningCommand: "nop",
  command: "mate \"$HOME/Library/Application Support/Rdaemon\"/startOptions.R",
  input: "none",
  keyEquivalent: "~@c",
  name: "Edit StartOptions",
  output: "discard",
  scope: "source.rd.console",
  uuid: "48D80FF3-4866-4ECD-8637-B3E4F6FCDB02"},
 {beforeRunningCommand: "nop",
  bundleUUID: "B5A22967-2E6A-4B66-9C71-DA8762C01E27",
  command: ". \"$TM_BUNDLE_SUPPORT\"/bin/execute.sh",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "",
  name: "Execute Line / Selection",
  output: "insertAsSnippet",
  scope: "source.rd.console",
  uuid: "10522958-CCD6-4404-A582-1027A8A1EF87"},
 {beforeRunningCommand: "nop",
  bundleUUID: "B5A22967-2E6A-4B66-9C71-DA8762C01E27",
  command: 
   "######### global variables #########\n\nRDHOME=\"$HOME/Library/Application Support/Rdaemon\"\nif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$RDHOME\"\nfi\n\n\n######### begin script #########\n\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\n#check free space on ram drive\nif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRES=$(df -H | grep TMRramdisk1 | awk '{ print $5 }' | perl -e 'print <>+0;')\n\tif [ $RES -gt 96 ]; then\n\t\t\"$DIALOG\" -e -p '{messageTitle=\"Rdaemon – RAM drive – Security Alert\"; alertStyle=\"critical\"; informativeText=\"Free disk space is less than 3%!\\nFor safety reasons save your data image and restart the Rdaemon!\";}' >/dev/null\n\t\techo \"RAM drive on '/tmp/TMRramdrive1':\"\n\t\tRES=$(df -H | grep TMRramdisk1 | awk '{ print $5 }')\n\t\techo -n \" $RES are used of\"\n\t\tRES=$(df -H | grep TMRramdisk1 | awk '{ print $2 }')\n\t\techo -n \" $RES.\"\n\t\texit 206\n\tfi\nfi\n\n#get the task from TM and delete beginning >+: SPACE TAB\nTASK=$(cat | sed -e 's/Browse\\[.*\\]//;s/^[>+:] \\{0,1\\}//;s/\t/    /g;s/\\\\/\\\\\\\\/g;')\n\n#check named input pipe for safety reasons\nif [ ! -p \"$RDHOME\"/r_in ]; then\n\techo -en \"Rdaemon Error:\\nThe pipe /tmp/r_in is not found!\\n\\nYou have to kill Rdaemon manually!\"\n\texit 206\nfi\n\n#check if user wants to quit\nQTASK=$(echo -en \"$TASK\" | perl -pe 's/ *//g')\nif [ \"$QTASK\" == \"q()\" -o \"$QTASK\" == \"quit()\" ]; then\n\tANS=$(\"$DIALOG\" -e -p \"{messageTitle='Closing Rdaemon';informativeText='Save workspace image?';buttonTitles=('Save','Cancel','Don\\'t Save');}\")\n\tif [ \"$ANS\" == \"1\" ]; then\n\t\techo -en \"> \"\n\t\texit 204\n\telse\n\t\tif [ \"$ANS\" == \"0\" ]; then\n\t\t\techo -e \"@|q()\\n@|y\\n\" > \"$RDHOME/r_in\"\n\t\tfi\n\t\tif [ \"$ANS\" == \"2\" ]; then\n\t\t\techo -e \"@|q()\\n@|n\\n\" > \"$RDHOME/r_in\"\n\t\tfi\n\t\tif [ ! -e \"$RDHOME\"/daemon/x11runs ]; then\n\t\t\tosascript <<-AS &>/dev/null\n\t \t\t\tignoring application responses\n\t \t\t\ttell application \"X11\" to quit\n\t \t\t\tend ignoring\n\t\t\tAS\n\t\tfi\n\t\texit 200\n\tfi\nfi\n\n#set history counter to 0\necho -n 0 > \"$RDHOME/history\"/Rhistcounter.txt\n\n#send task to Rdaemon and give Rdaemon the chance to read from the pipe\necho -e \"@|sink('$RDHOME/r_res')\"  > \"$RDHOME\"/r_in\n#send task to Rdaemon\nif [ -z \"$TM_SELECTED_TEXT\" ]; then\n\techo -e \"$TASK\" > \"$RDHOME\"/r_in\nelse\n\texport token=$(\"$DIALOG\" -a ProgressDialog -p \"{title=Rdaemon;isIndeterminate=1;summary='Sending task to Rdaemon…';}\")\n\techo -e \"$TASK\" | while read LINE\n\tdo\n\t\techo -e \"$LINE\" > \"$RDHOME\"/r_in\n\t\tsleep 0.002\n\t\t\"$DIALOG\" -t $token -p \"{details='${LINE//\\'/’}';}\" 2&>/dev/null\n\tdone\n\t\"$DIALOG\" -x $token 2&>/dev/null\nfi\necho \"@|sink(file=NULL)\" > \"$RDHOME\"/r_in\n\necho \"Result is being written into 'r_res'\"\nexit_show_tool_tip\n",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "$",
  name: "Execute Line / Selection (Background  r_res)",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "60C2BE95-B3D8-4BB4-ACBC-8638E8CEC58F"},
 {beforeRunningCommand: "nop",
  command: 
   "TASK=$(cat | perl -pe 's/^> \\s*//')\nTASK=\"ifelse(is.null(dim($TASK)),write($TASK, '|pbcopy'),write.table($TASK, file=pipe('pbcopy'),quote=F,row.names=F, sep='\\t'))\"\n\necho \"@|$TASK\" | \"$TM_BUNDLE_SUPPORT\"/bin/execute.sh > /dev/null &\n\n# | sed '1d;$d' | pbcopy",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "$",
  name: "Execute Line / Selection and Copy into Pasteboard",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "CDBEF676-C47F-492B-B005-BFC7426798B9"},
 {beforeRunningCommand: "nop",
  command: 
   "RUBYRUN=$(ps xw | grep 'Rdaemon\\.rb')\nRRUN=$(ps aw | grep 'Librar.*--TMRdaemon')\nif [ ! ${#RRUN} == 0 -a ! ${#RUBYRUN} == 0 ]; then\n\tRUBYRUN=$(echo -en \"$RUBYRUN\" | awk '{print $1;}')\n\tRRUN=$(echo -en \"$RRUN\" | awk '{print $1;}')\n\tkill $RUBYRUN\n\t#kill $RRUN\n\techo -e \"Rdaemon was killed!\"\nelse\n\techo -e \"Rdaemon is not running!\"\nfi\n\nif [ ! -e \"$HOME/Library/Application Support/Rdaemon/daemon/x11runs\" ]; then\nosascript <<-AS &>/dev/null\n \ttell application \"X11\"\n \t\tquit\n \tend tell\nAS\nfi\n",
  input: "selection",
  name: "Force Kill Rdaemon",
  output: "showAsTooltip",
  scope: "source.rd.console",
  tabTrigger: "kill",
  uuid: "6B70DCAD-E1F1-4080-B50C-442C628842A8"},
 {beforeRunningCommand: "nop",
  command: "\"$HOME/Library/Application Support/Rdaemon/help/grMan.sh\"\n",
  input: "none",
  keyEquivalent: "~@g",
  name: "Graphic Manager",
  output: "showAsHTML",
  scope: "source.rd.console",
  uuid: "26515667-4135-43CB-B706-19BA1D604131"},
 {beforeRunningCommand: "nop",
  command: 
   ". \"$TM_SUPPORT_PATH/lib/webpreview.sh\"\nhtml_header \"R Console (Rdaemon) Bundle Help\" \"R\"\n\"$TM_SUPPORT_PATH/lib/markdown_to_help.rb\" \"$TM_BUNDLE_SUPPORT/lib/help.markdown\"\nhtml_footer",
  input: "none",
  name: "Help",
  output: "showAsHTML",
  scope: "source.rd.console",
  uuid: "3BDDFA7D-5095-4665-8906-718DF27CD3F9"},
 {beforeRunningCommand: "nop",
  command: 
   "[[ -d \"$HOME/Library/Application Support/Rdaemon\" ]] && echo -e \"'$HOME/Library/Application Support/Rdaemon' already exists! Please remove it first.\" && exit_show_tool_tip\ncp -R \"$TM_BUNDLE_SUPPORT\"/Rdaemon \"$HOME/Library/Application Support/Rdaemon\"\necho -e \"Rdaemon was installed in:\\n'$HOME/Library/Application Support/Rdaemon'\"",
  input: "none",
  name: "Install Rdaemon",
  output: "showAsTooltip",
  scope: "source.rd.console",
  tabTrigger: "installrd",
  uuid: "C25F0701-67B0-44A4-AD75-76BD7F7EFF7F"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\nif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$HOME/Library/Application Support/Rdaemon\"\nfi\n\necho \"@|sink('$RDRAMDISK/r_tmp');cat(getwd());sink(file=NULL)\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in\nsleep 0.1\nCURDIR=$(cat \"$RDRAMDISK\"/r_tmp)\nif [ ! -e \"$CURDIR/.RData\" ]; then\n\techo \"No file .RData found in current working directory '$CURDIR'.\"\nelse\n\techo \"@|load(file='$CURDIR/.RData')\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in\n\tsleep 0.1\n\techo \"Workspace loaded\"\nfi",
  input: "none",
  keyEquivalent: "~@w",
  name: "Load Default Workspace",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "5D4BA313-66B4-4674-9E55-DB56F788587B"},
 {beforeRunningCommand: "nop",
  bundleUUID: "DA2A7475-3FDF-4D66-A796-1C45F6BBF5B9",
  command: 
   "VAR=$(ruby -- <<-SCR1 \n\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\n\tword = Word.current_word('\\w\\.')\nprint word\nSCR1\n)\n\n[[ -z $VAR ]] && exit_discard\n\nif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$HOME/Library/Application Support/Rdaemon\"\nfi\n\nTASK=\"@|cat(is.matrix($VAR))\"\nRES=$(\"$HOME/Library/Application Support/Rdaemon\"/daemon/execRStr.sh \"$TASK\" | tail -n 1)\n[[ \"$RES\" != \"TRUE> \" ]] && echo \"'$VAR' is not a matrix.\" && exit_show_tool_tip\n\nTASK=\"@|sink('$RDRAMDISK/r_tmp');cat(dim($VAR)[1], sep='\\\\\\\\\\\\\\n');cat(dim($VAR)[2], sep='\\\\\\\\\\\\\\n');if(is.null(dimnames($VAR)[1]) || length(dimnames($VAR)[[1]])==0) cat(paste('[', c(1:dim($VAR)[1]), ',]', sep=''),sep='\\\\\\\\\\\\\\n') else cat(dimnames($VAR)[[1]], sep='\\\\\\\\\\\\\\n');if(is.null(dimnames($VAR)[2]) || length(dimnames($VAR)[[2]])==0) cat(paste('[,', c(1:dim($VAR)[2]), ']', sep=''),sep='\\\\\\\\\\\\\\n') else cat(dimnames($VAR)[[2]], sep='\\\\\\\\\\\\\\n');cat(t($VAR), sep='\\\\\\\\\\\\\\n');sink(file=NULL);\"\n\"$HOME/Library/Application Support/Rdaemon\"/daemon/execRStr.sh \"$TASK\" > /dev/null\n\nRES=$(cat \"$RDRAMDISK/r_tmp\")\nROWS=$(echo -e \"$RES\" | head -n 1 )\nRES=$(echo -e \"$RES\" | sed '1,1d')\nCOLS=$(echo -e \"$RES\" | head -n 1 )\n\nLC=$(($ROWS * 26 + 135))\n[[ $LC -gt 630 ]] && LC=630\ncat <<HTML0 \n<html>\n<head>\n<title>Rdaemon &mdash; Matrix Editor</title>\n<style type=\"text/css\">\n<!--\nINPUT {\nborder: #AAAAAA 0px solid;\nbackground-color: #FFFFFF;\ntext-align:right;\nfont-family:Monaco\n}\nBODY {\nfont-family:Monaco;\n}\n.var {\nborder: lightgrey 0px dotted;\nbackground-color: white;\ntext-align:left;\ntext-weight:bold;\nfont-size:11pt;\n}\n.var1 {\nborder: lightgrey 0px dotted;\nbackground-color: #ECECEC;\ntext-align:center;\nfont-size:8pt;\n}\n.var2 {\nborder: lightgrey 0px dotted;\nbackground-color: #ECECEC;\ntext-align:right;\nfont-size:8pt;\n}\n-->\n</style>\n<script type=\"text/javascript\">\n\tfunction saveIt() {\n\t\tTextMate.isBusy = true;\n\t\tvar reg = new RegExp(\"(^\\\"?\\-?[0-9\\.]+[0-9]*\\\"?$)|(^NA$)\");\n\t\tvar data = new Array();\n\t\tvar dim=$COLS*$ROWS;\n\t\tvar rownames = new Array();\n\t\tif (document.getElementById(\"row_1\").value.substr(0,1)!=\"[\") {\n\t\t\tfor (var i=1; i<=$ROWS; i++) {\n\t\t\t\tvar rn = document.getElementById(\"row_\"+String(i));\n\t\t\t\trownames.push(\"as.character(\\\"\"+rn.value+\"\\\")\");\n\t\t\t}\n\t\t\tvar rnames = \"c(\" + rownames.join(\",\") + \")\";\n\t\t} else {\n\t\t\tvar rnames = \"NULL\";\n\t\t}\n\t\tvar colnames = new Array();\n\t\tif (document.getElementById(\"col_1\").value.substr(0,1)!=\"[\") {\n\t\t\tfor (var i=1; i<=$COLS; i++) {\n\t\t\t\tvar rn = document.getElementById(\"col_\"+String(i));\n\t\t\t\tcolnames.push(\"as.character(\\\"\"+rn.value+\"\\\")\");\n\t\t\t}\n\t\t\tvar cnames = \"c(\" + colnames.join(\",\") + \")\";\n\t\t} else {\n\t\t\tvar cnames = \"NULL\";\n\t\t}\n\t\tfor (var i=1; i<=dim; i++) {\n\t\t\tvar inp = document.getElementById(\"in_\"+String(i));\n\t\t\tif (inp.value.length == 0) {\n\t\t\t\tdata.push(\"NA\");\n\t\t\t} else {\n\t\t\t\tif (reg.test(inp.value)) {\n\t\t\t\t\tdata.push(inp.value);\n\t\t\t\t} else {\n\t\t\t\t\tdata.push(\"as.character(\\\"\"+inp.value+\"\\\")\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar cmd = \"echo '\" + document.getElementById(\"varname\").value +\"<-matrix(c(\" + data.join(\",\") + \"),ncol=$COLS,byrow=T,dimnames=list(\" + rnames + \",\" + cnames + \"))' > \"$HOME/Library/Application Support/Rdaemon\"/r_tmp;echo -e '@|source(\\\"$HOME/Library/Application Support/Rdaemon/r_tmp\\\")' > \"$HOME/Library/Application Support/Rdaemon\"/r_in\";\n\t\tTextMate.system(cmd,null);\n\t\tTextMate.isBusy = false;\n\t\twindow.close();\n\t}\n\tfunction init() {\n\t\tdocument.getElementById('in_1').focus();\n\t\t//window.resizeTo(480,$LC);\n\t}\n\tfunction keyalert(index)\n\t{\n\t\tvar VK_LEFT = 37;\n\t\tvar VK_UP = 38;\n\t\tvar VK_RIGHT = 39;\n\t\tvar VK_DOWN = 40;\n\t\tvar VK_PAGEUP = 33;\n\t\tvar VK_PAGEDOWN = 34;\n\t\tvar VK_ESC = 27;\n\t\tif (!event.altKey & !event.ctrlKey & !event.shiftKey) {\n\t\tswitch (event.keyCode){\n\t\t\tcase VK_ESC : {\n\t\t\t\t//window.close();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase VK_UP : {\n\t\t\t\tif (index>$COLS) {\n\t\t\t\t\tvar rind = 'in_' + String(index-$COLS)\n\t\t\t\t\tdocument.getElementById(rind).focus();\n\t\t\t\t\tdocument.getElementById(rind).select();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase VK_RIGHT : {\n\t\t\t\tif (index>0) {\n\t\t\t\t\tvar rind = 'in_' + String(index+1)\n\t\t\t\t\tdocument.getElementById(rind).focus();\n\t\t\t\t\tdocument.getElementById(rind).select();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase VK_LEFT : {\n\t\t\t\tif (index>1) {\n\t\t\t\t\tvar rind = 'in_' + String(index-1)\n\t\t\t\t\tdocument.getElementById(rind).focus();\n\t\t\t\t\tdocument.getElementById(rind).select();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase VK_DOWN : {\n\t\t\t\tif (index<document.getElementsByTagName(\"input\").length) {\n\t\t\t\t\tvar rind = 'in_' + String(index+$COLS)\n\t\t\t\t\tdocument.getElementById(rind).focus();\n\t\t\t\t\tdocument.getElementById(rind).select();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t}\n\t}\n</script>\n</head>\n<body>\n<center>\n<div style=\"background-color:white;padding:2mm\">\n<font color=grey><small>matrix:</small></font> <input id=varname size=10 class=var value=\"$VAR\" id=\"var\">\n</div>\n<table border=1 style=\"border-collapse:collapse;\">\n\n\nHTML0\n\ncat \"$RDRAMDISK/r_tmp\" | perl -e '\n$cols=<>;chomp($cols);\n$rows=<>;chomp($rows);\n@rownames=();\n@colnames=();\nfor($i=0;$i<$cols;$i++) {\n\t$item=<>;\n\tchomp($item);\n#\t$item =~ s/ /&nbsp;/g;\n\tpush(@colnames,\"$item\");\n}\nfor($i=0;$i<$rows;$i++) {\n\t$item=<>;\n\tchomp($item);\n#\t$item =~ s/ /&nbsp;/g;\n\tpush(@rownames,\"$item\");\n}\n$rcnt=1;\n$ccnt=0;\n$cnt=1;\nprint \"<tr><td bgcolor=#ECECEC align=right>&nbsp;</td>\";\nfor($i=1;$i<=$rows;$i++) {\n\tprint \"<td bgcolor=#ECECEC align=center><small><input id=col_$i size=8 type=text class=var1 value=\\\"\".$rownames[$i-1].\"\\\"></small></td>\";\n\tif(! ($i % 10)){\n\t\tprint \"<td bgcolor=#ECECEC align=right><small>&nbsp;</small></td>\\n\";\n\t}\n}\nprint \"</tr>\\n\";\n$flag=0;\nwhile(<>){\n\t$LINE=$_;\n\tchomp($LINE);\n\tif( $cnt>1 && (! (($cnt-1) % 10))){\n\t\t$rcnt--;\n\t\tprint \"<td bgcolor=#ECECEC align=center><small><small>\".$colnames[$rcnt-1].\"</small></td>\\n\";\n\t\t$rcnt++;\n\t}\n\tif($cnt==1 || (! (($cnt-1) % ($rows)))){\n\t\tif(! ($rcnt % 20)) {\n\t\tprint \"<tr><td bgcolor=#ECECEC>&nbsp;</td>\";\n\t\tfor($i=1;$i<=$rows;$i++) {\n\t\t\tprint \"<td bgcolor=#ECECEC align=right><small><small>\".$rownames[$i-1].\"</small></td>\";\n\t\t\tif(! ($i % 10)){\n\t\t\t\tprint \"<td bgcolor=#ECECEC align=right><small><small>&nbsp;</small></td>\\n\";\n\t\t\t}\n\t\t}\n\t\tprint \"</tr>\\n\";\n\t\t}\n\t\tprint \"<tr><td bgcolor=#ECECEC align=right><small><input id=row_$rcnt size=8 type=text class=var2 value=\\\"\".$colnames[$rcnt-1].\"\\\"></small></td>\\n\";\n\t\t$rcnt++;\n\t}\n\tprint \"<td><input id=in_$cnt size=8 type=\\\"text\\\" value=\\\"$LINE\\\" onkeyup=keyalert($cnt)></td>\\n\";\n\t$cnt++;\n}\n$rcnt--;\nprint \"<td bgcolor=#ECECEC align=center><small><small>\".$colnames[$rcnt-1].\"</small></td></tr>\\n\";\n'\n\ncat <<HTML5\n</table>\n<div style=\"margin-top:2mm;background-color:lightgrey;padding:2mm\">\n<button onclick=\"saveIt()\">&nbsp;Save&nbsp;</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button onclick=\"window.close()\">Cancel</button>\n</div>\n<script type=\"text/javascript\">window.onload = init;</script>\n</body>\n</html>\nHTML5\n\nexit_show_html\n",
  input: "none",
  name: "Matrix Editor (β)",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "627438F9-5393-4D64-A0ED-18F58A35F1CA"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\necho -e \"@|quartz();plot.new()\\n\" > \"$HOME/Library/Application Support/Rdaemon/r_in\"",
  input: "none",
  keyEquivalent: "~@g",
  name: "New Quartz Device",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "AAA400CC-29E7-44B3-8582-A78B654DEF5B"},
 {beforeRunningCommand: "nop",
  command: 
   "C=$(cat \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistcounter.txt)\n[[ \"$C\" == \"1\" ]] && exit_discard\nC=$(($C-1))\n\nL=$(tail -r \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistory.txt | uniq | cat -n | egrep \"^ *$C\t\" | sed 's/^.*\t//' )\n\necho -n $C > \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistcounter.txt\nL=$(echo \"$L\" | sed 's/\\\\/\\\\\\\\/g')\nL=${L//$/\\\\$}\nL=${L//\\`/\\\\\\`}\n\necho -n \"> $L\"",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "@",
  name: "Next History Item",
  output: "insertAsSnippet",
  scope: "source.rd.console.prompt",
  uuid: "2CAD539C-0C6C-45E9-AE28-7872204E4627"},
 {beforeRunningCommand: "nop",
  command: 
   "RDHOME=\"$HOME/Library/Application Support/Rdaemon\"\nif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$RDHOME\"\nfi\n\n\nfunction getSig {\n\tWORD=$1\n\t[[ -e \"$RDRAMDISK\"/r_tmp ]] && rm \"$RDRAMDISK\"/r_tmp\n\tTASK=\"@|sink('$RDRAMDISK/r_tmp')\"\n\techo -e \"$TASK\" > \"$RDHOME\"/r_in\n\tTASK=\"@|try(cat(unlist(attributes($WORD)),sep=';'))\"\n\techo -e \"$TASK\" > \"$RDHOME\"/r_in\n\tTASK=\"@|sink(file=NULL)\"\n\techo -e \"$TASK\" > \"$RDHOME\"/r_in\n\n\t#get R's PID\n\tRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\t#check whether Rdaemon runs\n\ttest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\n\twhile [ 1 ]\n\tdo\n\t\tRES=$(tail -c 2 \"$RDRAMDISK\"/r_out)\n\t\t#expect these things from R\n\t\t[[ \"$RES\" == \"> \" ]] && break\n\t\t[[ \"$RES\" == \"+ \" ]] && break\n\t\t[[ \"$RES\" == \": \" ]] && break\n\t\tsleep 0.05\n\tdone\n\texport RES=$(cat \"$RDRAMDISK\"/r_tmp)\n\n}\n\nWORD=$(ruby -- <<-SCR1 \nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\nword = Word.current_word('\\w\\.')\nprint word\nSCR1\n)\n\necho -en \"\\$\"\nif [ \"${#WORD}\" -eq 0 ]; then\n\texit_insert_text\nfi\n\nWORDORG=\"$WORD\"\n\ngetSig \"$WORDORG\"\n\nif [ \"${#RES}\" -eq 0 ]; then\n\texit_insert_text\nfi\n#echo -en \"$RES\" && exit_create_new_document\nruby -- <<-SCRIPT 2> /dev/null\nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/exit_codes.rb\")\nrequire \"\#{ENV[\"TM_SUPPORT_PATH\"]}/lib/ui\"\nword = \"$WORD\"\nwordorg = \"$WORDORG\"\ntext = ENV['RES']\nfuns = text.split(\";\")\nTextMate.exit_discard if funs.size < 1\n\nif funs.size == 1\n  function = funs.first\nelse\n\tidx = TextMate::UI.menu(funs)\n\tTextMate.exit_discard if idx.nil?\n\tfunction = funs[idx]\nend\nTextMate.exit_discard if function.empty?\nprint function\nSCRIPT\n",
  fallbackInput: "none",
  input: "selection",
  name: "Object's Attribute…  (β)",
  output: "openAsNewDocument",
  scope: "source.rd.console",
  uuid: "DC7AC092-0A49-4CB0-A0FE-6993963F5BC6"},
 {beforeRunningCommand: "nop",
  command: 
   "if [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tcat /tmp/TMRramdisk1/r_out| perl -e '\n\tundef($/); $a=<>;\n\t$a=~s/\\x0D{1,}/\\x0D/sg;\n\twhile($a=~m/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/) { $a=~s/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/$1$2$3/sg; }\n\t$a=~s/\\\\/\\\\\\\\/g;$a=~s/\\`/\\\\\\`/sg;$a=~s/\\$/\\\\\\$/sg;$a=~s/_\\x08//sg;\n\t$a=~s/\\x07//sg;\n\t$a .= \"\\n> \" if ($a!~/> $/ && $a!~/\\+ $/);\n\tprint \"$a\";\n' > \"$HOME/Library/Application Support/Rdaemon\"/r_out.R\n\tmate \"$HOME/Library/Application Support/Rdaemon\"/r_out.R\nelse\n\tcat \"$HOME/Library/Application Support/Rdaemon\"/r_out| perl -e '\n\tundef($/); $a=<>;\n\t$a=~s/\\x0D{1,}/\\x0D/sg;\n\twhile($a=~m/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/) { $a=~s/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/$1$2$3/sg; }\n\t$a=~s/\\\\/\\\\\\\\/g;$a=~s/\\`/\\\\\\`/sg;$a=~s/\\$/\\\\\\$/sg;$a=~s/_\\x08//sg;\n\t$a=~s/\\x07//sg;\n\t$a .= \"\\n> \" if ($a!~/> $/ && $a!~/\\+ $/);\n\tprint \"$a\";\n' > \"$HOME/Library/Application Support/Rdaemon\"/r_out.R\n\tmate \"$HOME/Library/Application Support/Rdaemon\"/r_out.R\nfi",
  input: "none",
  keyEquivalent: "~@t",
  name: "Open Console Logfile r_out",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "DA39733A-10BB-4526-A0D2-20ECAD9FD965"},
 {beforeRunningCommand: "nop",
  command: "mate \"$HOME/Library/Application Support/Rdaemon/r_res\"",
  input: "none",
  keyEquivalent: "~@t",
  name: "Open Result File r_res",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "A1B39ABA-7E6E-4023-8AE3-C9474E09B3E1"},
 {beforeRunningCommand: "nop",
  command: "mate \"$HOME/Library/Application Support/Rdaemon\"",
  input: "none",
  keyEquivalent: "~@t",
  name: "Open “Rdaemon” as TM Project",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "85D5C6E2-0BD4-4F82-A686-42C76CF1CF90"},
 {beforeRunningCommand: "nop",
  command: 
   "if [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$HOME/Library/Application Support/Rdaemon\"\nfi\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\nprintframe() {\n\tcat <<-HF\n\t<HTML>\n\t<HEAD>\n\t<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n\t<TITLE>Rdaemon &mdash; Package Manager</TITLE>\n\t</HEAD>\n\t<FRAMESET ROWS=\"*,45%\" FRAMEBORDER=\"5\" FRAMESPACING=\"5\" BORDER=\"7\" FRAMEBORDER=\"YES\">\n\t\t<FRAME SRC=\"tm-file://${TM_BUNDLE_SUPPORT// /%20}/lib/pkman.html\" NAME=\"head\" MARGINWIDTH=\"30\" MARGINHEIGHT=\"0\"  SCROLLING=\"YES\">\n\t\t<FRAME SRC=\"tm-file://${TM_BUNDLE_SUPPORT// /%20}/lib/pkdata.html\" NAME=\"data\" MARGINWIDTH=\"30\" MARGINHEIGHT=\"0\"  SCROLLING=\"YES\">\n\t</FRAMESET>\n\t</HTML>\nHF\n\n}\n\nHEAD=\"$TM_BUNDLE_SUPPORT/lib/pkman.html\"\nDATA=\"$TM_BUNDLE_SUPPORT/lib/pkdata.html\"\n\n\ncat<<END > \"$HEAD\"\n<html><head><title>Rdaemon &mdash; Package Manager</title>\n<style type=\"text/css\">\n<!--\n.point {\n\tcursor:pointer;\n}\ntr {\n\t-webkit-transition: all 20ms ease-out;\n}\ntr:hover {\n\tbackground-color:lightblue;\n}\n-->\n</style>\n<script type=\"text/javascript\">\n\t\tfunction getR(Rcmd) {\n\t\t    var cmd = '\"$HOME/Library/Application Support/Rdaemon/daemon/execRStr.sh\" \"@|'+Rcmd+'\"';\n\t\t    document.getElementById(\"main\").innerHTML = \"<pre><font style='font-size:8pt'>\" + TextMate.system(cmd, null).outputString\n\t\t}\n        function pkgMan(pkg) {\n\t\t    var cmd; var Rcmd;\n\t\t\tif(pkg.checked == true) {\n\t\t\t\tRcmd = 'library(' + pkg.name + ')';\n\t\t\t    cmd = '\"$HOME/Library/Application Support/Rdaemon/daemon/execRStr.sh\" \"@|'+Rcmd+'\"';\n\t\t\t    myCommand = TextMate.system(cmd, function (task) { });\n\t\t\t} else {\n\t\t\t\tRcmd = 'detach(package:' + pkg.name + ')';\n\t\t\t\tcmd = '\"$HOME/Library/Application Support/Rdaemon/daemon/execRStr.sh\" \"@|'+Rcmd+'\"';\n\t\t\t\tmyCommand = TextMate.system(cmd, function (task) { });\n\t\t\t}\n\t\t}\n\t\tfunction show(arg) {\n\t\t\tparent.data.location.href = arg;\n\t\t}\n\n</script>\n</head>\n<body>\nEND\n\"$HOME/Library/Application Support/Rdaemon/daemon/execRStr.sh\" \"@|sink('$RDRAMDISK/r_tmp');source('~/Library/Application Support/Rdaemon/help/pkgMan.R');sink(file=NULL);\" > /dev/null\ncat \"$RDRAMDISK\"/r_tmp >> \"$HEAD\"\necho \"<html></html>\" > \"$DATA\"\nprintframe\nexit_show_html",
  input: "none",
  keyEquivalent: "~@p",
  name: "Package Manager",
  output: "discard",
  scope: "source.rd.console",
  uuid: "F349C212-E113-47F2-A4E3-95F6BF3C9310"},
 {beforeRunningCommand: "nop",
  command: 
   "C=$(cat \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistcounter.txt)\nC=$(($C+1))\n\nHC=$(wc -l \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistory.txt | awk '{print $1}')\n[[ $C -gt $HC ]] && exit_discard\n\nL=$(tail -r \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistory.txt | uniq | cat -n | egrep \"^ *$C\t\" | sed 's/^.*\t//' )\n\necho -n $C > \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistcounter.txt\nL=$(echo \"$L\" | sed 's/\\\\/\\\\\\\\/g')\nL=${L//$/\\\\$}\nL=${L//\\`/\\\\\\`}\n\necho -n \"> $L\"",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "@",
  name: "Previous History Item",
  output: "insertAsSnippet",
  scope: "source.rd.console.prompt",
  uuid: "C14369D7-79B8-4D9B-BB90-E91B36C79AF2"},
 {beforeRunningCommand: "nop",
  command: 
   "\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\necho -e \"@|q()\\n@|n\\n\" > \"$HOME/Library/Application Support/Rdaemon/r_in\"\n\nif [ ! -e \"$HOME/Library/Application Support/Rdaemon\"/daemon/x11runs ]; then\nosascript <<-AS &>/dev/null\n \ttell application \"X11\"\n \t\tquit\n \tend tell\nAS\nfi\n",
  input: "none",
  keyEquivalent: "~@c",
  name: "Quit and Don't Save",
  output: "showAsTooltip",
  scope: "source.rd.console",
  tabTrigger: "q",
  uuid: "5323D41C-90B6-4CA0-A3D6-69E9AC9A7404"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\necho -e \"@|q()\\n@|y\\n\" > \"$HOME/Library/Application Support/Rdaemon/r_in\"\n\nif [ ! -e \"$HOME/Library/Application Support/Rdaemon\"/daemon/x11runs ]; then\nosascript <<-AS &>/dev/null\n \ttell application \"X11\"\n \t\tquit\n \tend tell\nAS\nfi\n",
  input: "none",
  keyEquivalent: "~@c",
  name: "Quit and Save",
  output: "showAsTooltip",
  scope: "source.rd.console",
  tabTrigger: "q",
  uuid: "48328ACB-AE0F-44FE-8655-D2043C866751"},
 {beforeRunningCommand: "nop",
  command: 
   "osascript &>/dev/null \\\n\t   -e 'tell app \"SystemUIServer\" to activate' \\\n\t   -e 'tell app \"TextMate\" to activate' &",
  input: "none",
  keyEquivalent: "~@t",
  name: "Rescan Open Files",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "DD6DBA08-B4F1-491D-90DB-5FDB002112EC"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\necho \"@|while(sink.number()>0){sink(file=NULL)}\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in\n",
  input: "none",
  keyEquivalent: "~@a",
  name: "Reset Output",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "F607CDD3-CBED-4E4D-BB17-95B4BB0B8AF5"},
 {beforeRunningCommand: "nop",
  command: "open -a Finder \"$HOME/Library/Application Support/Rdaemon\"",
  input: "none",
  keyEquivalent: "~@t",
  name: "Reveal “Rdaemon” in Finder",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "0971AC5F-1B24-41F7-9DF2-9E8FDAF96B3D"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\n\necho \"@|save.image()\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in",
  input: "none",
  keyEquivalent: "~@w",
  name: "Save Default Workspace",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "48A661E4-4365-4847-BEAB-85555BDBEDD5"},
 {beforeRunningCommand: "nop",
  command: 
   "WORD=$(\"$DIALOG\" -m -p 'prompt=\"Search for:\";title=\"Rdaemon History List\";' RequestString | perl -e 'undef($/);$a=<>;$a=~s/\\n|\\t//mg;$a=~m/.*?<key>returnArgument<\\/key><string>(.*?)<\\/string>.*/; print $1 if (length($1))')\n\n[[ -z \"$WORD\" ]] && exit_discard\n\n#show Rhistory as inline menu in reversed order grepped\nL=$(tail -r \"$HOME/Library/Application Support/Rdaemon\"/history/Rhistory.txt | egrep -i \"$WORD\" | grep -v '^----# ' | uniq | ruby -e '\n\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/ui.rb\")\n\twords = STDIN.read().split(\"\\n\")\n\tindex=TextMate::UI.menu(words)\n\tif index != nil\n\t\tprint \"> \" + words[index]\n\tend\n')\n\nif [ -n \"$L\" ]; then\n\tL=$(echo \"$L\" | sed 's/\\\\/\\\\\\\\/g')\n\tL=${L//$/\\\\$}\n\tL=${L//\\`/\\\\\\`}\n\techo -n \"$L\"\nelse\n\texit_discard\nfi\n",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "^~",
  name: "Search in History List",
  output: "insertAsSnippet",
  scope: "source.rd.console",
  uuid: "DF4A33C2-091E-4DD7-A379-97A7861B83F8"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\nPATH=$(osascript -e 'tell application \"TextMate\"' -e 'activate' -e 'POSIX path of (choose folder with prompt \"Set the working directory of the current Rdaemon session\")' -e 'end tell' 2>/dev/null)\n\n[[ ! -z $PATH ]] && echo \"@|setwd('$PATH')\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in",
  input: "none",
  keyEquivalent: "@d",
  name: "Set Working Directory",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "6B398625-7207-4BA6-BD1F-1FD41CF5674F"},
 {beforeRunningCommand: "nop",
  command: 
   "if [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\ttail /tmp/TMRramdisk1/r_out| perl -e '\n\tundef($/); $a=<>;\n\t$a=~s/\\x0D{1,}/\\x0D/sg;\n\twhile($a=~m/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/) { $a=~s/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/$1$2$3/sg; }\n\t$a=~s/\\\\/\\\\\\\\/g;$a=~s/\\`/\\\\\\`/sg;$a=~s/\\$/\\\\\\$/sg;$a=~s/_\\x08//sg;\n\t$a=~s/\\x07//sg;\n\t$a .= \"\\n> \" if ($a!~/> $/ && $a!~/\\+ $/);\n\tprint \"$a\";\n'\nelse\n\ttail \"$HOME/Library/Application Support/Rdaemon\"/r_out| perl -e '\n\tundef($/); $a=<>;\n\t$a=~s/\\x0D{1,}/\\x0D/sg;\n\twhile($a=~m/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/) { $a=~s/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/$1$2$3/sg; }\n\t$a=~s/\\\\/\\\\\\\\/g;$a=~s/\\`/\\\\\\`/sg;$a=~s/\\$/\\\\\\$/sg;$a=~s/_\\x08//sg;\n\t$a=~s/\\x07//sg;\n\t$a .= \"\\n> \" if ($a!~/> $/ && $a!~/\\+ $/);\n\tprint \"$a\";\n'\nfi",
  input: "none",
  keyEquivalent: "~@t",
  name: "Show End of r_out",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "2E40AF2C-A50C-4453-9880-7B67FD7D3599"},
 {beforeRunningCommand: "nop",
  command: 
   "#show Rhistory as inline menu in reversed order\n\nRDHOME=\"$HOME/Library/Application Support/Rdaemon\"\n\nL=$(tail -r \"$RDHOME\"/history/Rhistory.txt | uniq | ruby -e '\n\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/ui.rb\")\n\twords = STDIN.read().split(\"\\n\")\n\tindex=TextMate::UI.menu(words)\n\tif index != nil\n\t\tprint \"> \" + words[index]\n\tend\n')\nif [ -n \"$L\" ]; then\n\tL=$(echo \"$L\" | sed 's/\\\\/\\\\\\\\/g')\n\tL=${L//$/\\\\$}\n\tL=${L//\\`/\\\\\\`}\n\n\techo -n \"$L\"\nelse\n\texit_discard\nfi\n",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "^~",
  name: "Show History List",
  output: "insertAsSnippet",
  scope: "source.rd.console",
  uuid: "84EB83FE-A3FF-4C32-8912-3F5B82A66AAF"},
 {beforeRunningCommand: "nop",
  command: 
   "if [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$HOME/Library/Application Support/Rdaemon\"\nfi\n\n\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\necho \"@|sink('$RDRAMDISK/r_tmp');cat(geterrmessage());sink(file=NULL)\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in\nsleep 0.2\nOUT=$(echo -e `cat \"$RDRAMDISK\"/r_tmp`)\n\nif [ -z \"$OUT\" ]; then\n\techo \"No previous error\"\nelse\n\techo \"$OUT\"\nfi",
  input: "none",
  keyEquivalent: "~@a",
  name: "Show Last Error Message",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "5C4C09CC-BAD9-48CC-A044-F0001156E915"},
 {beforeRunningCommand: "nop",
  command: 
   "RUBYRUN=$(ps xw | grep 'Rdaemon\\.rb')\nRRUN=$(ps aw | grep 'Librar.*--TMRdaemon')\nif [ ! ${#RRUN} == 0 -a ! ${#RUBYRUN} == 0 ]; then\n\tRUBYRUN=$(echo -en \"$RUBYRUN\" | awk '{print $1;}')\n\tRRUN=$(echo -en \"$RRUN\" | awk '{print $1;}')\n\techo -en \"Rdaemon: $RUBYRUN\\nR      : $RRUN\"\nelse\n\techo -en \"Rdaemon is not running!\"\nfi\n",
  input: "none",
  keyEquivalent: "~@t",
  name: "Show PIDs",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "1B07309F-2D19-455E-9B39-A1CD1D19F97E"},
 {beforeRunningCommand: "nop",
  command: 
   "RPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\nps -eo pcpu,pid | grep \"\\b$RPID\\b\" | awk '{print $1;}'",
  input: "none",
  keyEquivalent: "~@t",
  name: "Show R CPU coverage",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "DE52C868-EAC5-4A0B-8329-E1F05EFD20B6"},
 {beforeRunningCommand: "nop",
  command: 
   "if [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\necho \"RAM drive on '/tmp/TMRramdrive1':\"\nRES=$(df -H | grep TMRramdisk1 | awk '{ print $5 }')\necho -n \" $RES is used of\"\nRES=$(df -H | grep TMRramdisk1 | awk '{ print $2 }')\necho -n \" $RES.\"\nelse\necho \"Rdaemon is not using a RAM drive.\"\nfi",
  input: "none",
  keyEquivalent: "~@t",
  name: "Show RAM disk usage",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "CADF7EC3-54F3-4AB5-9D77-DEF83CE73EA4"},
 {beforeRunningCommand: "nop",
  command: 
   "if [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$HOME/Library/Application Support/Rdaemon\"\nfi\n\n\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\necho \"@|sink('$RDRAMDISK/r_tmp');cat(getwd());sink(file=NULL)\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in\nsleep 0.2\necho -e `cat \"$RDRAMDISK\"/r_tmp`",
  input: "none",
  keyEquivalent: "~@c",
  name: "Show Working Directory",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "A562212A-C512-46AB-B2A0-EBF9B5E2F3B2"},
 {beforeRunningCommand: "nop",
  command: 
   "if [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$HOME/Library/Application Support/Rdaemon\"\nfi\n\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\ncat<<HTML\n<html><head><title>Rdaemon Workspace</title>\n<style type=\"text/css\">\n<!--\n.helpSym {\n\tbackground-color:lightgrey;\n\tcolor:black;\n\tcursor:pointer;\n\tfont-size:8pt;\n}\n.nonVisible {\n\tdisplay:none;\n}\n.selected {\n\tbackground-color:lightblue;\n}\n.unselected {\n\tbackground-color:white;\n}\n#ask {\n    position: absolute;\n    top: -300;\n    left: 60;\n    height: 80px;\n\twidth: 200px;\n    background: rgba(238,238,238,0.85);\n    border-bottom: 1px solid rgb(80, 80, 80);\n    padding: 2px 8px;\n\tz-index: 1000;\n}\n-->\n</style>\n<script type=\"text/javascript\">\n\t\tvar item = null;\n\t\tfunction askForRemove(elt) {\n\t\t\titem = elt;\n\t\t\tdocument.getElementById(\"object\").innerHTML = \"<b>Removing of '\" + item + \"'</b>\";\n\t\t\tvar panel=document.getElementById('ask').style;\n\t\t\tpanel.top = window.pageYOffset;\n\t\t\tpanel.left = window.innerWidth/2-100;\n\t\t\tdocument.getElementById(item).className = \"selected\";\n\t\t}\n\t\tfunction askForRemoveHide() {\n\t\t\tdocument.getElementById(item).className = \"unselected\";\n\t\t\tvar panel=document.getElementById('ask').style;\n\t\t\tpanel.top = -300;\n\t\t}\n\t\tfunction exec() {\n\t\t\taskForRemoveHide();\n\t\t\tvar cmd = 'echo \"@|rm('+item+');gc(reset(TRUE))\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in';\n\t\t\tTextMate.system(cmd, null);\n\t\t\tdocument.getElementById(item).className = \"nonVisible\";\n\t\t}\n\t\tfunction edit(item) {\n\t\t\tvar cmd = 'echo \"@|fix('+item+')\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in';\n\t\t\tTextMate.system(cmd, null);\n\t\t\twindow.close();\n\t\t}\n</script>\n</head>\n<body>\n<div id=\"ask\">\n<center>\n<p>\n<span id=\"object\" style=\"font-size:9pt;\"></span><br />\n<span style=\"font-size:7pt;\">Are you sure?</span>\n</p>\n<input onclick=\"askForRemoveHide()\" type=\"button\" value=\"Cancel\">\n&nbsp;&nbsp;\n<input onclick=\"exec()\" type=\"button\" value=\"Yes\">\n</center>\n</div>\n\n<table border=1 cellpadding=\"5\" style='border-collapse:collapse;'>\nHTML\n\n\"$HOME/Library/Application Support/Rdaemon/daemon/execRStr.sh\" \"@|sink('$RDRAMDISK/r_tmp');try({ifelse((length(ls())>0),{for(ü in 1:(length(ls()))){cat('<tr id=\\\"');cat(ls()[ü]);cat('\\\"><td align=right bgcolor=#EEEEEE><b>');cat(ls()[ü]);cat('</b><td>');cat(str(get(ls()[ü])));cat('</td><td><span onclick=\\\"edit(\\'');cat(ls()[ü]);cat('\\')\\\" class=\\\"helpSym\\\">&nbsp;edit&nbsp;</span></td><td><span onclick=\\\"askForRemove(\\'');cat(ls()[ü]);cat('\\')\\\" class=\\\"helpSym\\\">&nbsp;remove&nbsp;</span></td></tr>');rm(ü)}},{cat('Workspace is empty.')})});sink(file=NULL);\" > /dev/null\ncat \"$RDRAMDISK\"/r_tmp | sed 's/\\$/<br><font color=blue>\\$<\\/font>/g'\necho \"</table>\"\n\nexit_show_html",
  input: "none",
  keyEquivalent: "~@w",
  name: "Show Workspace",
  output: "discard",
  scope: "source.rd.console",
  uuid: "7536CA0C-A1ED-41B3-A82B-BF514A1C22A3"},
 {beforeRunningCommand: "nop",
  bundleUUID: "B5A22967-2E6A-4B66-9C71-DA8762C01E27",
  command: 
   "\nRDHOME=\"$HOME/Library/Application Support/Rdaemon\"\n\nif [ -f \"$HOME\"/Rdaemon/daemon/startScript.sh ]; then\n\tANS=$(\"$DIALOG\" -e -p '{messageTitle=\"New Rdaemon installation path\"; informativeText=\"Please note that Rdaemon’s installation path was changed to:\\n\\n“~/Library/Application Support/Rdaemon”.\\n\\nIf there are any customizations in “~/Rdaemon/startOptions.R” please copy that file to the new location and remove or rename the old directory\\n“~/Rdaemon”.\"; buttonTitles=(\"OK\");}')\nfi\n\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs - if not start it\nif [ -z $RPID ]; then\n\n\tif [ -f \"$RDHOME\"/daemon/startScript.sh ]; then\n\t\trm -rf \"$RDHOME\"/daemon\n\t\trm -rf \"$RDHOME\"/help\n\t\tcp -R \"$TM_BUNDLE_SUPPORT\"/Rdaemon/daemon \"$RDHOME\"\n\t\tcp -R \"$TM_BUNDLE_SUPPORT\"/Rdaemon/help \"$RDHOME\" \n\t\t\"$RDHOME\"/daemon/startScript.sh\n\t\techo -en \"> \"\n\telse\n\t\t[[ -d \"$RDHOME\" ]] && echo -e \"The folder '$RDHOME' already exists! Please remove or rename it first.\" && exit_show_tool_tip\n\t\tcp -R \"$TM_BUNDLE_SUPPORT\"/Rdaemon \"$RDHOME\"\n\t\techo -e \"Rdaemon was installed in:\\n'$RDHOME'\"\n\t\tif [ -f \"$RDHOME\"/daemon/startScript.sh ]; then\n\t\t\t\"$RDHOME\"/daemon/startScript.sh\n\t\t\techo -en \"> \"\n\t\telse\n\t\t\techo \"Error while installing Rdaemon!\"\n\t\t\texit_show_tool_tip\n\t\tfi\n\tfi\n\nelse\n\techo -n \"> \"\nfi",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "~@c",
  name: "Start Rdaemon",
  output: "insertAsSnippet",
  scope: "source.rd.console",
  tabTrigger: "start",
  uuid: "DE978737-FAC6-4DAD-ADEE-43172F55BDC5"},
 {beforeRunningCommand: "nop",
  command: 
   "OS=$(uname -r | perl -pe 's/(\\d+)\\..*/$1/')\nif [ $OS -eq 8 ]; then\n\texport DISPLAY=:0.0\n\topen -a X11\n\tosascript <<-AS &>/dev/null\n \t\ttell application \"TextMate\"\n \t\t\tactivate\n\t \tend tell\n\tAS\nelse\n\techo \"Only necessary for Mac OSX 10.4.x (Tiger)\"\nfi\n",
  input: "none",
  keyEquivalent: "~@c",
  name: "Start X11",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "B9DD511C-6147-4ACF-8538-226554F62B81"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\nkill -s INT $RPID",
  input: "selection",
  keyEquivalent: "~@c",
  name: "Try to interrupt current task",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "34A37FE6-794D-4AA5-A300-BB446654E0A6"},
 {beforeRunningCommand: "nop",
  bundleUUID: "DA2A7475-3FDF-4D66-A796-1C45F6BBF5B9",
  command: 
   "VAR=$(ruby -- <<-SCR1 \n\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\n\tword = Word.current_word('\\w\\.')\nprint word\nSCR1\n)\n\n[[ -z $VAR ]] && exit_discard\n\nif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\tRDRAMDISK=\"/tmp/TMRramdisk1\"\nelse\n\tRDRAMDISK=\"$HOME/Library/Application Support/Rdaemon\"\nfi\n\nTASK=\"@|cat(is.vector($VAR))\"\nRES=$(\"$HOME/Library/Application Support/Rdaemon\"/daemon/execRStr.sh \"$TASK\" | tail -n 1)\n[[ \"$RES\" != \"TRUE> \" ]] && echo \"'$VAR' is not a vector.\" && exit_show_tool_tip\n\nTASK=\"@|sink('$RDRAMDISK/r_tmp');cat($VAR, sep='\\\\\\\\\\\\\\n');sink(file=NULL);\"\n\"$HOME/Library/Application Support/Rdaemon\"/daemon/execRStr.sh \"$TASK\" > /dev/null\n\nRES=$(cat \"$RDRAMDISK/r_tmp\")\n\nLC=$(echo -e \"$RES\" | wc -l)\nLC=$(($LC * 26 + 110))\n[[ $LC -gt 630 ]] && LC=630\ncat <<HTML0 \n<html>\n<head>\n<title>Rdaemon &mdash; Vector Editor</title>\n<style type=\"text/css\">\n<!--\nINPUT {\nborder: #AAAAAA 0px solid;\nbackground-color: #FFFFFF;\ntext-align:right;\nfont-family:Monaco\n}\nBODY {\nfont-family:Monaco;\n}\n.var {\nborder: lightgrey 0px solid;\nbackground-color: white;\ntext-align:left;\ntext-weight:bold;\nfont-size:11pt;\n}\n-->\n</style>\n<script type=\"text/javascript\">\n\tfunction saveIt() {\n\t\tTextMate.isBusy = true;\n\t\tvar inp = document.getElementsByTagName(\"input\");\n//\t\tvar reg = new RegExp(\"(^\\\"?\\-?[0-9]+\\.?[0-9]*\\\"?$)|(^NA$)\");\n\t\tvar reg = new RegExp(\"(^\\\"?\\-?[0-9\\.]+[0-9]*\\\"?$)|(^NA$)\");\n\t\taccu = new Array();\n\t\tfor (var i=1; i<inp.length; i++) {\n\t\t\tif (inp[i].value.length == 0) {\n\t\t\t\taccu.push(\"NA\");\n\t\t\t} else {\n\t\t\t\tif (reg.test(inp[i].value)) {\n\t\t\t\t\taccu.push(inp[i].value);\n\t\t\t\t} else {\n\t\t\t\t\taccu.push(\"as.character(\\\"\"+inp[i].value+\"\\\")\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar cmd = \"echo '\" + inp[0].value +\"<-c(\" + accu.join(\", \") + \")' > \"$HOME/Library/Application Support/Rdaemon\"/r_tmp;echo -e '@|source(\\\"$HOME/Library/Application Support/Rdaemon/r_tmp\\\")' > \"$HOME/Library/Application Support/Rdaemon\"/r_in\";\n\t\tTextMate.system(cmd,null);\n\t\tTextMate.isBusy = false;\n\t\twindow.close();\n\t}\n\tfunction init() {\n\t\tdocument.getElementsByTagName('input')[1].focus();\n\t}\n\tfunction keyalert(index)\n\t{\n\t\tvar VK_LEFT = 37;\n\t\tvar VK_UP = 38;\n\t\tvar VK_RIGHT = 39;\n\t\tvar VK_DOWN = 40;\n\t\tvar VK_PAGEUP = 33;\n\t\tvar VK_PAGEDOWN = 34;\n\t\tvar VK_ESC = 27;\n\t\tswitch (event.keyCode){\n\t\t\tcase VK_ESC : {\n\t\t\t\t//window.close();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase VK_UP : {\n\t\t\t\tif (index>1) {\n\t\t\t\t\tdocument.getElementsByTagName('input')[index-1].focus();\n\t\t\t\t\tdocument.getElementsByTagName('input')[index-1].select();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase VK_DOWN : {\n\t\t\t\tif (index<document.getElementsByTagName(\"input\").length) {\n\t\t\t\t\tdocument.getElementsByTagName('input')[index+1].focus();\n\t\t\t\t\tdocument.getElementsByTagName('input')[index+1].select();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n</script>\n</head>\n<body>\n<center>\n<div style=\"background-color:white;padding:2mm\">\n<font color=grey><small>vector:</small></font> <input size=10 class=var value=\"$VAR\" id=\"var\">\n</div>\n\n<table border=1 style=\"border-collapse:collapse\">\n\nHTML0\nC=1\necho -e \"$RES\" | while read LINE\ndo\n\techo \"<tr><td align=right bgcolor=#ECECEC><small>[$C]</small></td><td><input type='text' value='$LINE' onkeyup=keyalert($C)></td></tr>\"\n\tC=$(($C + 1))\ndone\n\ncat <<HTML5\n</table>\n<div style=\"margin-top:2mm;background-color:lightgrey;padding:2mm\">\n<button onclick=\"saveIt()\">&nbsp;Save&nbsp;</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button onclick=\"window.close()\">Cancel</button>\n</div>\n<script type=\"text/javascript\">window.onload = init;</script>\n</body>\n</html>\nHTML5\n\nexit_show_html\n",
  input: "none",
  name: "Vector Editor (β)",
  output: "discard",
  scope: "source.rd.console",
  uuid: "DDB68BBA-7243-4DCE-B940-B0E82CA9B9AA"},
 {beforeRunningCommand: "nop",
  command: 
   "#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n#check whether Rdaemon runs\ntest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\necho \"@|quartz.save(type='pdf', file='$HOME/Library/Application Support/Rdaemon/plots/RcurrentPlot.pdf')\" > \"$HOME/Library/Application Support/Rdaemon\"/r_in\nsleep 0.5\nopen -a ${TM_RdaemonPDFVIEWER:-Preview} \"file://$HOME/Library/Application Support/Rdaemon/plots/RcurrentPlot.pdf\"\n\n",
  input: "none",
  keyEquivalent: "~@g",
  name: "View Active Graphic Device as PDF",
  output: "showAsTooltip",
  scope: "source.rd.console",
  uuid: "FA204D99-DC57-46C9-A727-8D54AAA59897"}]
