# Encoding: UTF-8 [{beforeRunningCommand: "nop", command: "CRAN=\"http://cran.cnr.berkeley.edu\"\nSOFILE=\"$HOME/Library/Application Support/Rdaemon/startOptions.R\"\nif [ -f \"$SOFILE\" ]; then\n\tRES=$(cat \"$SOFILE\" | egrep 'options.*?repos.*?list' | perl -pe 's/^\\s*options\\s*.*?repos\\s*=\\s*.*?[\\x{27}\"](.*?)[\\x{27}\"].*/$1/g' | tail -n 1)\n\t[[ ! -z \"$RES\" ]] && [[ \"${RES:0:4}\" == \"http\" ]] && CRAN=\"$RES\"\nfi\nopen \"$CRAN/web/packages/\"", input: "none", name: "CRAN Packages", output: "showAsTooltip", scope: "source.r", uuid: "2A3C3EF9-2043-4304-81EC-EA3309286F98"}, {beforeRunningCommand: "nop", command: "\nexport WORD=$(ruby -- <<-SCR1 \n\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\n\tword = Word.current_word('\\w\\.')\n\tprint word\nSCR1\n)\n\n#check whether WORD is defined otherwise quit\n[[ -z \"$WORD\" ]] && echo \"No keyword found\" && exit_show_tool_tip\n\nRhelperAnswer=\"/tmp/textmate_Rhelper_out\"\n\nWORDORG=\"$WORD\"\nRD=$(echo -n \"$TM_SCOPE\" | grep -c -F 'source.rd.console')\n\nif [ $RD -gt 0 ]; then\n\tRDHOME=\"$HOME/Library/Application Support/Rdaemon\"\n\tif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\t\tRDRAMDISK=\"/tmp/TMRramdisk1\"\n\telse\n\t\tRDRAMDISK=\"$RDHOME\"\n\tfi\n\n\t#get R's PID\n\tRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\n\t#check whether Rdaemon runs\n\tif [ -z $RPID ]; then\n\t\tRDTEXT=\"Rdaemon is not running.\"\n\telse\n\t\t[[ -e \"$RDRAMDISK\"/r_tmp ]] && rm \"$RDRAMDISK\"/r_tmp\n\t\tTASK=\"@|sink('$RDRAMDISK/r_tmp')\"\n\t\techo -e \"$TASK\" > \"$RDHOME\"/r_in\n\t\tTASK=\"@|cat(paste(apropos('^${WORD}'),'|OK',sep='',collapse='\\\\\\n'))\"\n\t\techo -e \"$TASK\" > \"$RDHOME\"/r_in\n\t\tTASK=\"@|sink(file=NULL)\"\n\t\techo -e \"$TASK\" > \"$RDHOME\"/r_in\n\n\t\t#get R's PID\n\t\tRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\t\t#check whether Rdaemon runs\n\t\ttest -z $RPID && echo -en \"Rdaemon is not running.\" && exit 206\n\n\t\twhile [ 1 ]\n\t\tdo\n\t\t\tRES=$(tail -c 2 \"$RDRAMDISK\"/r_out)\n\t\t\t#expect these things from R\n\t\t\t[[ \"$RES\" == \"> \" ]] && break\n\t\t\t[[ \"$RES\" == \"+ \" ]] && break\n\t\t\t[[ \"$RES\" == \": \" ]] && break\n\t\t\tsleep 0.05\n\t\tdone\n\t\tsleep 0.001\n\t\tLOCAL=$(cat \"$RDRAMDISK\"/r_tmp | sort)\n\tfi\nfi\n\n[[ $RD -eq 0 ]] && LOCAL=$(cat | grep '<\\- *function' | perl -pe 's/\\t//g;s/ *(.*?) *<\\-.*/$1|OK/' | sort | egrep -i \"^${WORD//./\\\\.}\")\n\n#get suggestions\n\"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"@getCompletionList('$WORD',T)\"\nRES=$(cat \"$RhelperAnswer\")\nRES=$(echo -e \"$LOCAL\"; echo -en \"$RES\")\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 = \"$RES\"\nfuns = text.gsub(/\\n{2,}/,\"\\n\").split(\"\\n\")\n\nrdfuns = funs.select {|x| x =~ /\\|OK$/ }\nrdfuns.collect! {|x| x.gsub(/\\|OK$/, \"\") }\nfuns.delete_if {|x| x.match('\\|OK$') }\nf1 = funs.collect{|item| item.gsub(/\\t.*/, \"\")}\nrdfuns.sort! {|x,y| y <=> x }\nrdfuns.each_index do |i|\n\tif ! f1.include?(rdfuns[i]) && rdfuns[i].length > 0\n\t\tfuns.unshift(rdfuns[i] + \"\tlocal\" )\n\tend\nend\n\nfuns.delete_if {|x| x.match('[,\\- ]') }\nfuns.delete_if {|x| x.match('matrices.*rgl') }\nfuns.delete_if {|x| x.match('^\\s*$') }\nif \"$RD\" == \"1\"\n\tfuns.collect! do |x|\n\t\tif rdfuns.include?(x.gsub(/\\t.*/,\"\"))\n\t\t\tx= \"%s   …%s…\" % x.split(\"\\t\")\n\t\telse\n\t\t\tx= \"%s   {%s}\" % x.split(\"\\t\")\n\t\tend\n\tend\nelse\n\tfuns.collect! do |x|\n\t\tif rdfuns.include?(x.gsub(/\\t.*/,\"\"))\n\t\t\tx= \"%s   …%s…\" % x.split(\"\\t\")\n\t\telse\n\t\t\tx= \"%s   [%s]\" % x.split(\"\\t\")\n\t\tend\n\tend\nend\n\nfunctions = funs.select{|item| item =~ /^\#{word.gsub(\".\",\"\\\\.\")}/}\nfunc = funs.select{|item| item !~ /^\#{word.gsub(\".\",\"\\\\.\")}/}\nfp = func.join(\"\\n\")\nif (functions.size < 1 && (ENV['TM_SELECTED_TEXT'].nil? || ENV['TM_SELECTED_TEXT'].empty?)) then\n\tif fp.size > 0\n\t\tTextMate.exit_show_tool_tip(\"Only found :\\n\#{fp}\")\n\telse\n\t\tTextMate.exit_show_tool_tip(\"Nothing found\")\n\tend\nend\n\nif (! ENV['TM_SELECTED_TEXT'].nil? && ! ENV['TM_SELECTED_TEXT'].empty?) then\n\tfunctions.replace(funs)\nend\n\nif (functions.size == 1 && (ENV['R_AUTOCOMPLETE'].to_i == 1 || ENV['TM_R_AUTOCOMPLETE'].to_i == 1))\n\tfunction = functions.first\nelse\n\tisDIALOG2 = ! ENV[\"DIALOG\"].match(/2$/).nil?\n\tif isDIALOG2\n\t\tfn = []\n\t\tfunctions.each do |f|\n\t\t\tfn << {'insert' => \"\\${1:(\\${2:})}\", 'display' => f, 'match' => f.gsub(/\\s.*/,\"\")}\n\t\tend\n\t\tTextMate::UI.complete(fn, :extra_chars => '.')\n\t\tTextMate.exit_discard\n\telse\n\t\tidx = TextMate::UI.menu(functions)\n\t\tTextMate.exit_discard if idx.nil?\n\t\tfunction = functions[idx]\n\tend\nend\n# TextMate.exit_discard if function.empty?\nif ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty?\n print function.gsub!(/\\s.*/,\"\")[wordorg.length..-1]\nelse\n print function.gsub!(/\\s.*/,\"\")\nend\nSCRIPT\n", fallbackInput: "none", input: "document", keyEquivalent: "^.", name: "Completion…", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "8A17F5A3-7E52-4C6D-AA70-99476FB82625"}, {beforeRunningCommand: "nop", command: "cat | R --vanilla --slave --no-readline --encoding=UTF-8 | pbcopy", input: "selection", keyEquivalent: "^@r", name: "Copy Result into Pasteboard", output: "showAsTooltip", scope: "source.r", uuid: "C666D732-9E4D-49C7-BEEC-BC20590414BF"}, {beforeRunningCommand: "nop", command: "#!/usr/bin/env ruby\nrequire ENV['TM_SUPPORT_PATH'] + \"/lib/escape.rb\";\ntext = STDIN.read\ntext = `export __CF_USER_TEXT_ENCODING=0x1F5:0x8000100:0x8000100; pbpaste` if text.empty?\ntext << \"\\n\" if ! text.match(/\\n$/)\nrcnt = text.count \"\\n\"\n\ntext.gsub!(/(^\\s+|\\s+$)/,\"\")\ntext.gsub!(/\\s{1,}/,\" \")\nprint \"${1:${2:x} <- }matrix(c(\"\nout = Array.new\n$LFlag = ''\ntext.split.each{|b|\n\t$LFlag = ''\n\tif b.match(/^\\d+L$/)\n\t\t$LFlag = 'L'\n\t\tb.gsub!(/L$/, '')\n\tend\n\tif (b.to_f == 0 && ! b.match(/-?\\.?0\\.?0*/) && ! b.match(/^[\"'].*[\"']$/)) || b.match(/^\\d+[^\\d\\-\\.eE]+/)\n\t\tout << '\"' + e_sn(b) + '\"'\n\telse\n\t\tout << e_sn(b) + $LFlag\n\tend\n}\nprint out.join(', ')\nprint \"), nrow=\#{rcnt}, byrow=TRUE)\"\n\n\n\n#print \"${1:${2:x} <- }matrix(c(\"+e_sn(text).sub(/\\s+$/,\"\").gsub(/([a-zA-Z]+)/, '\"\\1\"').gsub(/\\s+/,\", \") + \"), nrow=\#{rcnt}, byrow=TRUE)\"", fallbackInput: "none", input: "selection", keyEquivalent: "^~c", name: "Create Matrix from Selection", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "BC6C2055-67E1-4902-98B0-AACDFEE031BB"}, {beforeRunningCommand: "nop", command: "#!/usr/bin/env ruby -wKU\nrequire ENV['TM_SUPPORT_PATH'] + \"/lib/escape.rb\";\ntext = STDIN.read\ntext = `export __CF_USER_TEXT_ENCODING=0x1F5:0x8000100:0x8000100; pbpaste` if text.empty?\ntext.gsub!(/(^\\s+|\\s+$)/,\"\")\ntext.gsub!(/\\s{1,}/,\" \")\nprint \"${1:${2:x} <- }c(\"\nout = Array.new\n$LFlag = ''\ntext.split.each{|b|\n\t$LFlag = ''\n\tif b.match(/^\\d+L$/)\n\t\t$LFlag = 'L'\n\t\tb.gsub!(/L$/, '')\n\tend\n\tif (b.to_f == 0 && ! b.match(/-?\\.?0\\.?0*/) && ! b.match(/^[\"'].*[\"']$/)) || b.match(/^\\d+[^\\d\\-\\.eE]+/ )\n\t\tout << '\"' + e_sn(b) + '\"'\n\telse\n\t\tout << e_sn(b) + $LFlag\n\tend\n}\nprint out.join(', ')\nprint \")\"\n", fallbackInput: "none", input: "selection", keyEquivalent: "^~c", name: "Create Vector from Selection", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "F61688AA-C298-4D58-A9DE-87891797B2F9"}, {beforeRunningCommand: "nop", command: "#!/usr/bin/env ruby\n# print \"Got:\" + STDIN.read\n\nrequire ENV['TM_SUPPORT_PATH'] +'/lib/ui.rb'\nrequire ENV['TM_SUPPORT_PATH'] +'/lib/exit_codes.rb'\nopts = { \"Mean\" => \"mean(${1:x})\", \n \"Variance\" => \"var(${1:x})\",\n \"Std. Dev.\" => \"sd(${1:x})\",\n \"Correlation\" => \"cor(${1:x})\",\n \"Five Num Sum\" => \"fivenum(${1:x})\",\n \"Quantiles\" => \"quantile(${1:x},${2:quantiles})\",\n \"Median\" => \"median(${1:x})\",\n\t\t\"Max\" => \"max(${1:x}${2:, na.rm=TRUE})\",\n\t\t\"Min\" => \"min(${1:x}${2:, na.rm=TRUE})\",\n\t\t\"Range\" => \"range(${1:x}${2:, na.rm=TRUE})\"\n}\nkeys = opts.keys.sort\nans = TextMate::UI.menu(keys)\nTextMate.exit_discard unless ans\nprint opts[keys[ans]]", fallbackInput: "word", input: "none", keyEquivalent: "~@D", name: "Descriptives…", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "6BC03260-79E4-47B6-87CE-020BD066E0FB"}, {beforeRunningCommand: "nop", command: "WDIR=\"$HOME/Library/Application Support/TextMate/R/help/command_args\"\n\n\"$TM_BUNDLE_SUPPORT\"/bin/initCommandArgsDir.sh\n\nmate \"$WDIR\"", input: "none", name: "Edit user-defined Function Parameter", output: "showAsTooltip", scope: "source.r, source.rd.console", uuid: "BED22435-E025-4C52-9CC5-08B4296F524F"}, {beforeRunningCommand: "nop", command: "#!/usr/bin/env ruby\nrequire ENV['TM_SUPPORT_PATH'] +'/lib/escape.rb'\nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\nif ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty?\n\tword = Word.current_word('\\w\\.')\nelse\n\tword = ENV['TM_SELECTED_TEXT']\nend\nline, col = ENV['TM_CURRENT_LINE'], ENV['TM_LINE_INDEX'].to_i\nleft = line[0...(col - word.length)].to_s\nright = line[col..-1].to_s\nif ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty?\n\tprint \"\#{e_sn(left)}${1:sum}(\#{e_sn(word)})\#{e_sn(right)}\"\nelse\n\tprint \"${1:\#{ENV['TM_R_WRAP_DEFAULT_FUNCTION']?ENV['TM_R_WRAP_DEFAULT_FUNCTION']:'sum'}}(\#{e_sn(word)})\"\nend", fallbackInput: "line", input: "selection", keyEquivalent: "^W", name: "Function Call", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "769AC12C-9EDF-4089-8834-062A301907ED"}, {beforeRunningCommand: "nop", command: "#!/usr/bin/env ruby\n#require ENV['TM_SUPPORT_PATH'] +'/lib/escape.rb'\n#print \"${1:${2:x} <- }function(${3:var}) {\\n\#{if s = ENV['TM_SELECTED_TEXT'] then e_sn(s.chomp.gsub(/(\\A|\\n)/,\"\\\\1\\t\")) else \"\\t\\$4\" end}\\n}\"\n\nrequire ENV['TM_SUPPORT_PATH'] +'/lib/escape.rb'\nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\nif ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty?\n\tword = Word.current_word('\\w\\.')\nelse\n\tword = ENV['TM_SELECTED_TEXT']\nend\nline, col = ENV['TM_CURRENT_LINE'], ENV['TM_LINE_INDEX'].to_i\nleft = line[0...(col - word.length)].to_s\nright = line[col..-1].to_s\nif ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty?\n\tprint \"\#{e_sn(left)}${1:${2:x} <- }function(${3:var}) {\\n\\t\#{e_sn(word)}\\$4\\n}\#{e_sn(right)}\"\nelse\n\tprint \"${1:${2:x} <- }function(${3:var}) {\\n\\t\#{e_sn(word)}\\$4\\n}\"\nend", fallbackInput: "line", input: "selection", keyEquivalent: "^@W", name: "Function Definition", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "4C1A1536-31FF-4FF5-B0C5-CD47D21CFD52"}, {beforeRunningCommand: "nop", command: "\n# clean unused file\nrm -f \"$TM_BUNDLE_SUPPORT/help.index\"\nrm -f \"$TM_BUNDLE_SUPPORT/helpshort.index\"\nrm -f \"$TM_BUNDLE_SUPPORT/help.pkgs\"\nrm -f \"$TM_BUNDLE_SUPPORT/libpaths\"\nrm -f \"$TM_BUNDLE_SUPPORT/httpPort\"\nrm -f \"$TM_BUNDLE_SUPPORT/isHelpServer\"\nrm -f \"$TM_BUNDLE_SUPPORT/lib/data.html\"\nrm -f \"$TM_BUNDLE_SUPPORT/lib/head.html\"\nrm -f \"$TM_BUNDLE_SUPPORT/lib/search.html\"\n\n. \"$TM_SUPPORT_PATH/lib/webpreview.sh\"\nhtml_header \"R Bundle Help\" \"R\"\n\"$TM_SUPPORT_PATH/lib/markdown_to_help.rb\" \"$TM_BUNDLE_SUPPORT/lib/help.markdown\"\nhtml_footer\n", input: "none", name: "Help", output: "showAsHTML", scope: "source.r -source.rd.console -source.rapp-console", uuid: "8A8B6803-AF20-47EC-9382-62E1EBA76B4A"}, {beforeRunningCommand: "nop", command: "if [ -z \"$TM_SELECTED_TEXT\" ]; then\n\techo\n\tcat | R --vanilla --slave --no-readline --encoding=UTF-8\nelse\n\tcat | R --vanilla --slave --no-readline --encoding=UTF-8\n\texit_replace_text\nfi", input: "selection", keyEquivalent: "^@r", name: "Insert Result", output: "afterSelectedText", scope: "source.r", uuid: "99E59A8E-A7DC-4CB0-AA51-6305921D3411"}, {beforeRunningCommand: "nop", command: "echo -en 'library(${1:\"${2:`\"$TM_BUNDLE_SUPPORT\"/bin/insert_package_name.sh`}\"})${0:}'", input: "none", name: "Load Library using “library”", output: "insertAsSnippet", scope: "source.r, source.rd.console", tabTrigger: "lib", uuid: "2EBC36A2-A927-4AEC-99A1-9F06C88B6844"}, {beforeRunningCommand: "nop", command: "echo -en 'require(${1:\"${2:`\"$TM_BUNDLE_SUPPORT\"/bin/insert_package_name.sh`}\"})${0:}'", input: "none", name: "Load Library using “require”", output: "insertAsSnippet", scope: "source.r, source.rd.console", tabTrigger: "req", uuid: "C2ADF348-D6FE-45B5-8BCC-A62B912A881B"}, {beforeRunningCommand: "nop", command: "LIST=$(cat)\n[[ -z \"$LIST\" ]] && exit_discard\necho -en \"$LIST\" | ruby -e '\n\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/ui.rb\")\n\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/exit_codes.rb\")\n\twords = STDIN.read().split(\"|\")\n\tif words.size == 1\n\t\tif words[0] == \"TRUE\" || words[0] == \"FALSE\" || words[0] == \"T\" || words[0] == \"F\"\n\t\t\tprint \"FALSE\" if words[0] == \"TRUE\"\n\t\t\tprint \"TRUE\" if words[0] == \"FALSE\"\n\t\t\tprint \"F\" if words[0] == \"T\"\n\t\t\tprint \"T\" if words[0] == \"F\"\n\t\telse\n\t\t\tTextMate.exit_discard()\n\t\tend\n\telse\n\t\tindex=TextMate::UI.menu(words)\n\t\tif index != nil\n\t\t\tif words[index].match(\"\\-\")\n\t\t\t\tprint words[index].gsub!(/\\-.*/,\"\")\n\t\t\telse\n\t\t\t\tprint words[index]\n\t\t\tend\n\t\telse\n\t\t\tTextMate.exit_discard()\n\t\tend\n\tend\n'\n\n", fallbackInput: "word", input: "selection", keyEquivalent: "^", name: "Option List as Pull Down… / BoolToggler", output: "replaceSelectedText", scope: "source.r, source.rd.console", uuid: "B2612EB0-22A3-4D09-A851-721EA294DF13"}, {beforeRunningCommand: "nop", command: "\"$TM_BUNDLE_SUPPORT\"/bin/insert_package_name.sh", input: "none", keyEquivalent: "~@L", name: "Package Name…", output: "discard", scope: "source.r, source.rd.console", uuid: "18B3BAF5-A2E0-43A6-9017-56E1D365A055"}, {beforeRunningCommand: "nop", command: "#!/usr/bin/env ruby\n# print \"Got:\" + STDIN.read\n\nrequire ENV['TM_SUPPORT_PATH'] +'/lib/ui.rb'\nrequire ENV['TM_SUPPORT_PATH'] +'/lib/exit_codes.rb'\nopts = { \"Formula\" => \"plot(${1:y~x}${2:, data=${3:frame})\",\n \"Bar Graph\" => \"barplot(${1:table(${2:x})})\",\n\t\t\"Pie Chart\" => \"pie(${1:x}${2:, col=c(${3:colors})})\",\n\t\t\"Histogram\" => \"hist(${1:x}${2:, breaks = ${3:8}})\",\n\t\t\"Box Plot\" => \"boxplot(${1:x}${2:, horizontal = TRUE})\",\n\t\t\"Scatterplot\" => \"plot(${1:x})\"}\nkeys = opts.keys.sort\nans = TextMate::UI.menu(keys)\nTextMate.exit_discard unless ans\nprint opts[keys[ans]]", fallbackInput: "word", input: "none", keyEquivalent: "~@P", name: "Plots…", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "90EA3ACF-121E-4BBA-B1EB-3F461BCBDC8D"}, {beforeRunningCommand: "nop", command: "\"$TM_BUNDLE_SUPPORT\"/bin/prefix_package_name.sh", fallbackInput: "line", input: "selection", keyEquivalent: "^~L", name: "Prefix Package Name to current Function", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "7657BD74-1736-49B9-9AB1-4A10E256D484"}, {beforeRunningCommand: "nop", command: "# input is selection or document\nrawText=\"`cat`\"\n\ncurDir=''\nif [[ ${#TM_DIRECTORY} -gt 0 ]]; then\n\tcurDir=\"$TM_DIRECTORY\"\nfi\n\nosascript -e 'on run(theCode)' \\\n\t\t -e 'tell application \"R\" to activate' \\\n\t\t -e 'if (item 2 of theCode) is not \"\" then tell application \"R\" to cmd \"setwd('\\''\" & (item 2 of theCode) & \"'\\'')\"' \\\n\t\t -e 'tell application \"R\" to cmd (item 1 of theCode)' \\\n\t\t -e 'end run' -- \"$rawText\" \"$curDir\"\n", input: "selection", keyEquivalent: "~@R", name: "R.app", output: "showAsTooltip", scope: "source.r", uuid: "15FF2003-99F5-464C-A0C2-BAFED7AD73EB"}, {beforeRunningCommand: "nop", command: "# input is selection or document\nrawText=\"`cat`\"\n\ncurDir=''\nif [[ ${#TM_DIRECTORY} -gt 0 ]]; then\n\tcurDir=\"$TM_DIRECTORY\"\nfi\n\nosascript -e 'on run(theCode)' \\\n\t\t -e 'tell application \"R\" to activate' \\\n\t\t -e 'if (item 2 of theCode) is not \"\" then tell application \"R\" to cmd \"setwd('\\''\" & (item 2 of theCode) & \"'\\'')\"' \\\n\t\t -e 'tell application \"R\" to cmd (item 1 of theCode)' \\\n\t\t -e 'end run' -- \"$rawText\" \"$curDir\"\n\nopen \"txmt://open?line=$(($TM_LINE_NUMBER+1))&column=1000000\" &", fallbackInput: "line", input: "selection", keyEquivalent: "~$\n", name: "R.app & Step", output: "discard", scope: "source.r", uuid: "ED52D514-DDB8-4D8C-BE0C-F791C70F530A"}, {beforeRunningCommand: "nop", command: "\nif [ -z \"$TM_SELECTED_TEXT\" ]; then\n\tWORD=$(ruby -- <<-SCR1 \n\t\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\n\t\tword = Word.current_word('\\w\\.')\n\t\tword.gsub!(/^[\\d\\.\\-]+$/,\"\")\n\t\tprint word\n\tSCR1\n\t)\nelse\n\tWORD=$TM_SELECTED_TEXT\nfi\n\nif [ -z \"$WORD\" ]; then\n\topen \"http://www.rseek.org\"\nelse\n\topen \"http://www.rseek.org/?cx=010923144343702598753%3Aboaz1reyxd4&q=$WORD&sa=Search+functions%2C+lists%2C+and+more&cof=FORID%3A11\"\nfi\n", fallbackInput: "word", input: "selection", keyEquivalent: "^~@h", name: "RSeek Search for Word / Selection", output: "showAsTooltip", scope: "source.r, source.rd.console", uuid: "4DCF1FF7-D104-43C3-B0E3-8333A50CA5AA"}, {beforeRunningCommand: "nop", command: "\nif [ -z \"$TM_SELECTED_TEXT\" ]; then\n\tWORD=$(ruby -- <<-SCR1 \n\t\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\n\t\tword = Word.current_word('\\w\\.')\n\t\tword.gsub!(/^[\\d\\.\\-]+$/,\"\")\n\t\tprint word\n\tSCR1\n\t)\nelse\n\tWORD=$TM_SELECTED_TEXT\nfi\n\nif [ -z \"$WORD\" ]; then\n\topen \"http://search.r-project.org/\"\nelse\n\tW=`echo -en \"$WORD\" | sed 's/ {1,}/+/g'`\n\topen \"http://search.r-project.org/cgi-bin/namazu.cgi?query=$W&max=20&result=normal&sort=score&idxname=Rhelp02a&idxname=functions&idxname=docs\"\nfi\n", fallbackInput: "word", input: "selection", keyEquivalent: "^~@h", name: "RSite Search for Word / Selection", output: "showAsTooltip", scope: "source.r, source.rd.console", uuid: "B26AF49E-C737-41D4-990F-5BBB138B3FCD"}, {beforeRunningCommand: "nop", command: "#!/usr/bin/env ruby -wKU\n\nrd=STDIN.read()\nif rd =~ /(?m).*?\\\\usage\\{.*?\\((.*?)\\).*/m\n\trd.gsub!(/(?m).*?\\\\usage\\{.*?\\((.*?)\\).*/m, '\\1')\n\tputs \"\\\\arguments{\"\n\tcounter=1\n\trd.scan(/([\\w\\._]+)\\s*=/) do |arg|\n\t\tputs \"\\t\\\\item{\#{arg}}{${\#{counter}:}}\"\n\t\tcounter = counter+1\n\tend\n\tputs \"}\"\nelse\n\tputs \"\\\\arguments{\"\n\t\tputs \"\\t\\\\item{${1:}}{${2:}}${0:}\"\n\tputs \"}\"\nend\n", input: "document", name: "Rd Insert arguments tag", output: "insertAsSnippet", scope: "text.tex.latex.rd", tabTrigger: "arg", uuid: "EB595EE3-9439-4AC6-8352-1EC7CAC9B05E"}, {beforeRunningCommand: "saveActiveFile", command: "R CMD Rdconv -t html \"$TM_FILEPATH\"", input: "none", keyEquivalent: "^~@p", name: "Rd Preview as HTML", output: "showAsHTML", scope: "text.tex.latex.rd", uuid: "AE350C40-DA76-4BDD-AAD0-27F7247511EB"}, {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[[ ! -d \"$RDHOME\" ]] && echo \"Please install Rdaemon first.\" && exit 206\n\n######### begin script #########\n\n#get R's PID\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\nRdaemonWASrunning=1\n#check whether Rdaemon runs - if not start it\nif [ -z $RPID ]; then\n\t[[ -e \"$RDHOME\"/daemon/x11runs ]] && rm \"$RDHOME\"/daemon/x11runs\n\tX=$(ps -ax | grep X11 | wc -l)\n\tif [ \"$X\" -gt \"1\" ]; then\n\t\ttouch \"$RDHOME\"/daemon/x11runs\n\tfi\n\tif [ -f \"$RDHOME\"/daemon/startScript.sh ]; then\n\t\t\"$RDHOME\"/daemon/startScript.sh\n\telse\n\t\techo \"You have to install Rdaemon first!\"\n\t\texit_show_tool_tip\n\tfi\n\tRdaemonWASrunning=0\nfi\n\n#check free space on ram drive\nif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\nRES=$(df -H | grep TMRramdisk1 | awk '{ print $5 }' | perl -e 'print <>+0;')\nif [ $RES -gt 96 ]; then\n\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\techo \"RAM drive on '/tmp/TMRramdrive1':\"\n\tRES=$(df -H | grep TMRramdisk1 | awk '{ print $5 }')\n\techo -n \" $RES are used of\"\n\tRES=$(df -H | grep TMRramdisk1 | awk '{ print $2 }')\n\techo -n \" $RES.\"\n\texit_show_tool_tip\nfi\nfi\n\n#get the task from TM and delete beginning >+: SPACE TAB\nTASK=$(cat | sed -e 's/Browse\\[.*\\]//;s/^[>+:]//;s/^[ \t]*//;s/\\\\/\\\\\\\\/g;/^#/d')\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#set history counter to 0\necho -n 0 > \"$RDHOME/history\"/Rhistcounter.txt\n\n#get current position of r_out\nPOS=$(stat \"$RDRAMDISK\"/r_out | awk '{ print $8 }')\nPROMPT=$(tail -n 1 \"$RDRAMDISK\"/r_out | sed 's/> $//')\n\n#if [ ! -z \"$TM_DIRECTORY\" ]; then\n#\techo -e \"@|setwd('$TM_DIRECTORY')\" > \"$RDHOME\"/r_in\n#fi\n\n#send task to Rdaemon and give Rdaemon the chance to read from the pipe\nexport token=$(\"$DIALOG\" -a ProgressDialog -p \"{title=Rdaemon;isIndeterminate=1;summary='Sending task to Rdaemon…';}\")\necho \"$TASK\" | sed 's/\\\\/\\\\\\\\/g' | while read LINE\ndo\n\techo -e \"@|$LINE\" > \"$RDHOME\"/r_in\n\tsleep 0.002\n\t\"$DIALOG\" -t $token -p \"{details='$LINE';}\" 2&>/dev/null\ndone\n\"$DIALOG\" -x $token 2&>/dev/null\n\n#wait for R's response by expecting >, +, or : plus SPACE!\nPOSNEW=$(stat \"$RDRAMDISK\"/r_out | awk '{ print $8 }')\nOFF=$(($POSNEW - $POS + 2))\n\nPROGRESS_INIT=0 # to start the progress dialog after 100ms only\nwhile [ 1 ]\ndo\n\tRES=$(tail -c 2 \"$RDRAMDISK\"/r_out)\n\t#expect these things from R\n\t[[ \"$RES\" == \"> \" ]] && break\n\t[[ \"$RES\" == \"+ \" ]] && break\n\t[[ \"$RES\" == \": \" ]] && break\n\t#monitoring of the CPU coverage as progress bar\n\tcpu=$(ps o pcpu -p \"$RPID\" | tail -n 1)\n\t[[ \"${cpu:0:1}\" == \"%\" ]] && break\n\tCP=$(echo -n \"$cpu\" | perl -e 'print 100-<>')\n\tsleep 0.1\n\tif [ $PROGRESS_INIT -eq 0 ]; then\n\t\texport token=$(\"$DIALOG\" -a ProgressDialog -p \"{title=Rdaemon;progressValue=50;summary='Rdaemon is busy…';}\")\n\t\tPROGRESS_INIT=1\n\tfi\n\t\"$DIALOG\" -t $token -p \"{details='`tail -n 1 \"$RDRAMDISK\"/r_out`';progressValue=$CP;}\" 2&>/dev/null\ndone\n\"$DIALOG\" -x $token 2&>/dev/null\n\n#read only the current response from Rdaemon\nPOSNEW=$(stat \"$RDRAMDISK\"/r_out | awk '{ print $8 }')\nOFF=$(($POSNEW - $POS + 2))\n#clean/escape the response\necho -en \"$PROMPT\"\nRES=$(tail -c $OFF \"$RDRAMDISK\"/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')\nERR=$(echo -en \"$RES\" | egrep -i '^\\s*err' | wc -l)\nif [ $ERR -gt 0 ]; then\n\techo -en \"$RES\" > /tmp/TMRdaemon_error.rCon\n\tmate /tmp/TMRdaemon_error.Rcon\n\texit\n# else\n # echo -en \"$RES\" >> \"$RDHOME\"/console.Rcon\nfi\n\n\nif [ \"$RdaemonWASrunning\" == \"0\" ]; then\n#read only the current response from Rdaemon\nPOSNEW=$(stat \"$RDRAMDISK\"/r_out | awk '{ print $8 }')\nOFF=$(($POSNEW - $POS + 2))\n#clean/escape the response\n#echo -en \"$PROMPT\"\n# tail -c $OFF \"$RDRAMDISK\"/r_out | perl -e '\n# undef($/); $a=<>;\n# $a=~s/\\x0D{1,}/\\x0D/sg;\n# while($a=~m/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/) { $a=~s/(.*?)\\x0D<.{50}(.) +\\x08+(.*)/$1$2$3/sg; }\n# $a=~s/_\\x08//sg;\n# $a=~s/_\\x07//sg;\n# \#$a=~s/\\`/\\\\\\`/sg;$a=~s/\\$/\\\\\\$/sg;\n# $a .= \"\\n> \" if ($a!~/> $/ && $a!~/\\+ $/);\n# print \"$a\";\n# ' >> \"$RDHOME\"/console.Rcon\n\nosascript &>/dev/null \\\n\t -e 'tell app \"SystemUIServer\" to activate' \\\n\t -e 'tell app \"TextMate\" to activate' &\n\nopen \"$RDHOME/Rsession.tmproj\"\nmate \"$RDHOME\"/console.Rcon\nsleep 0.3\nopen \"txmt://open?line=1000000&column=10000000\"\nfi\n\n", fallbackInput: "document", input: "selection", keyEquivalent: "@R", name: "Rdaemon", output: "showAsTooltip", scope: "source.r", uuid: "DC1EC8A4-BC20-4D1C-91B6-328CEC2CA228"}, {autoScrollOutput: true, beforeRunningCommand: "nop", command: "\n#only for Mac OSX 10.4 X11\nOS=$(uname -r | perl -pe 's/(\\d+)\\..*/$1/')\n[[ $OS -eq 8 ]] && export DISPLAY=:0.0\n\nCRAN=\"http://cran.cnr.berkeley.edu\"\nSOFILE=\"$HOME/Library/Application Support/Rdaemon/startOptions.R\"\nif [ -f \"$SOFILE\" ]; then\n\tRES=$(cat \"$SOFILE\" | egrep 'options.*?repos.*?list' | perl -pe 's/^\\s*options\\s*.*?repos\\s*=\\s*.*?[\\x{27}\"](.*?)[\\x{27}\"].*/$1/g' | tail -n 1)\n\t[[ ! -z \"$RES\" ]] && [[ \"${RES:0:4}\" == \"http\" ]] && CRAN=\"$RES\"\nfi\n\nif [ ! -z \"$TM_INPUT_START_LINE\" ]; then\n\tif [ `echo -en \"$TM_SELECTED_TEXT\" | egrep -cv '^[\t ]*#'` -gt 0 ]; then\n\t\techo -en \"$TM_SELECTED_TEXT\" | \"$TM_BUNDLE_SUPPORT/tmR.rb\" \"$CRAN\" 1\n\telse\n\t\tcat | \"$TM_BUNDLE_SUPPORT/tmR.rb\" \"$CRAN\" 0\n\tfi\nelse\n\tcat | \"$TM_BUNDLE_SUPPORT/tmR.rb\" \"$CRAN\" 0\nfi\n", fallbackInput: "document", input: "document", keyEquivalent: "@r", name: "Run Document / Selection in R", output: "showAsHTML", scope: "source.r", uuid: "F5D7F00C-6DEE-469E-AFEE-6E4B7CDD4148"}, {beforeRunningCommand: "nop", command: "head -n 3 \"$TM_SELECTED_TEXT\"", fallbackInput: "none", input: "selection", name: "Show File Header", output: "showAsTooltip", scope: "source.r, source.rd.console", uuid: "381D1464-6F33-41E3-A938-C10FAB619C24"}, {beforeRunningCommand: "nop", command: "\nexport WORD=$(ruby -- <<-SCR1\nprint ENV['TM_CURRENT_LINE'][0...ENV['TM_LINE_INDEX'].to_i].gsub!(/ *$/, \"\").match(/[\\w.:]*$/).to_s\nSCR1\n)\n\nif [ -z \"$TM_SELECTED_TEXT\" ]; then\n\texport WORD=$(ruby -- <<-SCR1 \n\t\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\n\t\tword = Word.current_word('\\w\\.:')\n\t\tword.gsub!(/^[\\d\\.\\-]+$/,\"\")\n\t\tprint word\n\tSCR1\n\t) \n\tif [ -z \"$WORD\" ]; then\n\t\t#look for nested commands\n\t\texport WORD=$(perl -e '\n\t\t$line=$ENV{\"TM_CURRENT_LINE\"};$col=$ENV{\"TM_LINE_INDEX\"};\n\t\t$line=substr($line,0,$col);\n\t\t\#$line=~s/ //g;\n\t\t@arr=split(//,$line);$c=0;\n\t\tfor($i=$#arr;$i>-1;$i--){$c-- if($arr[$i] eq \")\");$c++ if($arr[$i] eq \"(\");last if $c>0;}\n\t\tif($i==-1) {\n\t\t\tprint \"\";\n\t\t} else {\n\t\t\tsubstr($line,0,$i)=~m/([\\w\\.:]+)$/;\n\t\t\tprint $1 if defined($1);\n\t\t}\n\t\t')\n\tfi\nelse\n\t#take the selected text\n\texport WORD=$(echo -en \"$TM_SELECTED_TEXT\" | perl -e '$_=<>;chomp;s/^[\\t ]*//;s/([\\w\\.]+)[ \\(\\{].*/$1/g;print')\nfi\n\nWORDORG=\"$WORD\"\nPKG=\"\"\nif [ `echo \"$WORD\" | grep -Fc ':'` -gt 0 ]; then\n\tPKG=\",package='${WORD%%:*}'\"\nfi\nWORD=\"${WORD##*:}\"\n\n#check whether WORD is defined otherwise quit\n[[ -z \"$WORD\" ]] && exit 200\n\nTEXT=$(cat)\n\nRhelperAnswer=\"/tmp/textmate_Rhelper_out\"\n\n# Rdaemon\nRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\nRD=$(echo -n \"$TM_SCOPE\" | grep -c -F 'source.rd.console')\nif [ ! -z \"$RPID\" -a \"$RD\" -gt 0 ]; then\n\tRDHOME=\"$HOME/Library/Application Support/Rdaemon\"\n\tif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\t\tRDRAMDISK=\"/tmp/TMRramdisk1\"\n\telse\n\t\tRDRAMDISK=\"$RDHOME\"\n\tfi\n\t[[ -e \"$RDRAMDISK\"/r_tmp ]] && rm \"$RDRAMDISK\"/r_tmp\n\n\t# execute \"args()\" in Rdaemon\n\tTASK=\"@|sink('$RDRAMDISK/r_tmp');args($WORDORG)\"\n\techo \"$TASK\" > \"$RDHOME\"/r_in\n\techo \"@|sink(file=NULL)\" > \"$RDHOME\"/r_in\n\twhile [ 1 ]\n\tdo\n\t\tRES=$(tail -c 2 \"$RDRAMDISK\"/r_out)\n\t\t[[ \"$RES\" == \"> \" ]] && break\n\t\t[[ \"$RES\" == \": \" ]] && break\n\t\t[[ \"$RES\" == \"+ \" ]] && break\n\t\tsleep 0.03\n\tdone\n\tsleep 0.001\n\tRES=$(cat \"$RDRAMDISK\"/r_tmp | sed 's/NULL$//;')\n\t[[ \"$RES\" == \"NULL\" ]] && RES=\"\"\n\t# \"args()\" did find something\n\tif [ ! -z \"$RES\" ]; then\n\t\tOUT=$(echo -en \"$WORD${RES:9}\" | perl -e 'undef($/);$a=<>;$a=~s/\"\\t\"/\"\\\\t\"/sg;$a=~s/\"\\n\"/\"\\\\n\"/sg;print $a')\n\t\trm -f \"$RDRAMDISK\"/r_tmp\n\t\tTASK=\"@|sink('$RDRAMDISK/r_tmp');cat(gsub('.*?/library/(.*?)/.*','\\\\\\\\1',as.vector(help('$WORD',try.all.packages=F)),perl=T),sep='\\n')\"\n\t\techo \"$TASK\" > \"$RDHOME\"/r_in\n\t\tTASK=\"@|sink(file=NULL)\"\n\t\techo \"$TASK\" > \"$RDHOME\"/r_in\n\t\twhile [ 1 ]\n\t\tdo\n\t\t\tRES=$(tail -c 2 \"$RDRAMDISK\"/r_out)\n\t\t\t[[ \"$RES\" == \"> \" ]] && break\n\t\t\t[[ \"$RES\" == \": \" ]] && break\n\t\t\t[[ \"$RES\" == \"+ \" ]] && break\n\t\t\tsleep 0.03\n\t\tdone\n\t\tsleep 0.001\n\t\tLIB=$(cat \"$RDRAMDISK\"/r_tmp)\n\t\tif [ -z \"$LIB\" ]; then\n\t\t\techo -n \"$OUT\"\n\t\t\techo -en \"\\n• local\"\n\t\t\texit 206\n\t\tfi\n\t\tCNT=$(echo \"$LIB\" | wc -l)\n\t\tif [ $CNT -eq 1 ]; then\n\t\t\techo -n \"$OUT\"\n\t\t\techo -en \"\\n•• library: $LIB\"\n\t\t\texit 206\n\t\tfi\n\t# \"args()\" didn't find anything ergo library isn't yet loaded\n\telse\n\t\t\"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"@getHelpURL('$WORD'$PKG)\"\n\t\tFILE=$(cat \"$RhelperAnswer\")\n\t\tif [ ! -z \"$FILE\" -a \"$FILE\" != \"NA\" ]; then\n\t\t\texec<\"$RhelperAnswer\"\n\t\t\twhile read i\n\t\t\tdo\n\t\t\tif [ \"${i:0:1}\" = \"/\" ]; then\n\t\t\t\tRES=$(cat \"$i\")\n\t\t\telse\n\t\t\t\tRES=$(curl -gsS \"$i\")\n\t\t\tfi\n\t\t\techo -n \"$RES\" | \"$TM_BUNDLE_SUPPORT/bin/parseHTMLForUsage.sh\" \"$WORD\" 0\n\t\t\tLIB=$(echo \"$i\" | perl -pe 's!.*?/library/(.*?)/.*!$1!')\n\t\t\tTASK=\"@|sink('$RDRAMDISK/r_tmp')\"\n\t\t\techo \"$TASK\" > \"$RDHOME\"/r_in\n\t\t\tTASK=\"@|cat(sum((.packages()) %in% \\\"$LIB\\\"),sep='')\"\n\t\t\techo \"$TASK\" > \"$RDHOME\"/r_in\n\t\t\tTASK=\"@|sink(file=NULL)\"\n\t\t\techo \"$TASK\" > \"$RDHOME\"/r_in\n\t\t\twhile [ 1 ]\n\t\t\tdo\n\t\t\t\tRES=$(tail -c 2 \"$RDRAMDISK\"/r_out)\n\t\t\t\t[[ \"$RES\" == \"> \" ]] && break\n\t\t\t\t[[ \"$RES\" == \": \" ]] && break\n\t\t\t\t[[ \"$RES\" == \"+ \" ]] && break\n\t\t\t\tsleep 0.02\n\t\t\tdone\n\t\t\tsleep 0.001\n\t\t\tRES=$(cat \"$RDRAMDISK\"/r_tmp)\n\t\t\tif [ ! -z \"$RES\" -a \"$RES\" == \"1\" ]; then\n\t\t\t\techo -en \"\\n•• library: $LIB\"\n\t\t\telse\n\t\t\t\techo -en \"\\n• library “${LIB}” not loaded [press CTRL+SHIFT+L]\"\n\t\t\tfi\n\t\t\techo\n\t\t\tdone\n\t\t\texit 206\n\t\telse\n\t\t\texit 200\n\t\tfi\n\tfi\nfi\n\n# R script\n\"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"@getHelpURL('$WORD'$PKG)\"\nFILE=$(cat \"$RhelperAnswer\")\nif [ ! -z \"$FILE\" -a \"$FILE\" != \"NA\" ]; then\n\texec<\"$RhelperAnswer\"\n\twhile read i\n\tdo\n\t\tif [ \"${i:0:1}\" = \"/\" ]; then\n\t\t\tRES=$(cat \"$i\")\n\t\telse\n\t\t\tRES=$(curl -gsS \"$i\")\n\t\tfi\n\t\t# \"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"@getPackageFor('$WORD')\"\n\t\t# LIB=$(cat \"$RhelperAnswer\")\n\t\tLIB=$(echo \"$i\" | perl -pe 's!.*?/library/(.*?)/.*!$1!')\n\t\tRES=$(echo -en \"$RES\" | \"$TM_BUNDLE_SUPPORT/bin/parseHTMLForUsage.sh\" \"$WORD\" 0)\n\t\tif [ ! -z \"$RES\" -a \"${RES:0:1}\" == \"${WORD:0:1}\" ]; then\n\t\t\techo -n \"$RES\"\n\t\t\techo -en \"\\n•• library: $LIB\\n\"\n\t\tfi\n\tdone\n\texit 206\nelse\n\t[[ `echo -n \"$TM_SCOPE\" | grep -c -F 'text.tex.latex.rdaemon'` -gt 0 ]] && exit 200\n\t# Parse R script for functions\n\tOUT=$(echo -en \"$TEXT\" | \"$TM_BUNDLE_SUPPORT/bin/parseDocForFunctions.sh\" \"$WORD\")\n\t[[ -z \"$OUT\" ]] && exit 200\n\techo -n \"$WORD$OUT\n• local\"\n\texit 206\nfi\n", fallbackInput: "none", input: "document", keyEquivalent: "~H", name: "Show Function Usage", output: "showAsTooltip", scope: "source.r, source.rd.console", uuid: "797A6B84-49BB-4BBD-8F51-9A225433CA9C"}, {beforeRunningCommand: "nop", command: "\n\n\"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"@getHttpPort()\"\nsleep 0.05\nPORT=$(cat /tmp/textmate_Rhelper_out)\n\n\nif [ $PORT -gt 0 ]; then\n\techo \"\"\n\tcurl -sS \"http://127.0.0.1:$PORT/doc/html/index.html\"\n\nelse\n\tRHOME=${R_HOME:=/Library/Frameworks/R.framework/Versions/Current/Resources}\n\techo \"\"\n\tcat \"${RHOME// /%20}\"/doc/html/index.html\n\nfi", input: "none", name: "Show R Documentation", output: "showAsHTML", scope: "source.r", uuid: "F6F4215A-5543-42B3-8EBD-C8C7C9F190C9"}, {beforeRunningCommand: "nop", command: "#dispose all frozen ProgressDialogs\n{\nwhile [ 1 ]\ndo\n\tres=$(\"$DIALOG\" -x `\"$DIALOG\" -l 2>/dev/null| grep Rdaemon | cut -d \" \" -f 1` 2>/dev/null)\n\t[[ ${#res} -eq 0 ]] && break\ndone\n} &\n\nRhelperAnswer=\"/tmp/textmate_Rhelper_out\"\n\nif [ -z \"$TM_SELECTED_TEXT\" ]; then\n\tWORD=$(ruby -- <<-SCR1 \n\t\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\n\t\tword = Word.current_word('\\w\\.:')\n\t\tword.gsub!(/^[\\d\\.\\-]+$/,\"\")\n\t\tprint word\n\tSCR1\n\t)\n\n\tif [ -z \"$WORD\" ]; then\n\t\t#look for nested commands\n\t\tWORD=$(perl -e '\n\t\t$line=$ENV{\"TM_CURRENT_LINE\"};$col=$ENV{\"TM_LINE_INDEX\"};\n\t\t$line=substr($line,0,$col);\n\t\t\#$line=~s/ //g;\n\t\t@arr=split(//,$line);$c=0;\n\t\tfor($i=$#arr;$i>-1;$i--){$c-- if($arr[$i] eq \")\");$c++ if($arr[$i] eq \"(\");last if $c>0;}\n\t\tif($i==-1) {\n\t\t\tprint \"\";\n\t\t} else {\n\t\t\tsubstr($line,0,$i)=~m/([\\w\\.:]+)$/;\n\t\t\tprint $1 if defined($1);\n\t\t}\n\t\t')\n\tfi\nelse\n\t#take the selected text\n\tWORD=$(echo -en \"$TM_SELECTED_TEXT\" | perl -e '$_=<>;chomp;s/^[\\t ]*//;s/([\\w\\.:]+)[ \\(\\{].*/$1/g;print')\nfi\n\nif [ -z \"$WORD\" ]; then\n\tWORD=$(\"$DIALOG\" -m -p 'prompt=\"Search for:\";title=\"Look up in R Documentation\";' RequestString | perl -e 'undef($/);$a=<>;$a=~s/\\n|\\t//mg;$a=~m/.*?returnArgument<\\/key>(.*?)<\\/string>.*/; print $1 if (length($1))')\n\t[[ -z \"$WORD\" ]] && exit_discard\nfi\n\n\n# LIB=\nif [ ! -z \"${WORD//:/}\" ]; then\n\tif [ `echo \"$WORD\" | grep -Fc ':'` -gt 0 ]; then\n\t\tLIB=\",package='${WORD%%:*}'\"\n\tfi\n\tWORD=\"${WORD##*:}\"\nfi\n\n#check whether WORD is defined otherwise quit\n[[ -z \"$WORD\" ]] && echo \"No keyword found.\" && exit_show_tool_tip\n\n# Check if it is a Rdaemon doc\nRD=$(echo -n \"$TM_SCOPE\" | grep -c -F 'source.rd.console')\nif [ $RD -gt 0 -a \"$TM_R_SHOW_ALWAYS_HELPSEARCH\" != \"1\" ]; then\n\t#get R's PID\n\tRPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' )\n\t#check whether Rdaemon runs\n\tif [ ! -z $RPID ]; then\n\t\tRDHOME=\"$HOME/Library/Application Support/Rdaemon\"\n\t\tif [ \"$TM_RdaemonRAMDRIVE\" == \"1\" ]; then\n\t\t\tRDRAMDISK=\"/tmp/TMRramdisk1\"\n\t\telse\n\t\t\tRDRAMDISK=\"$RDHOME\"\n\t\tfi\n\t\t[[ -e \"$RDRAMDISK\"/r_tmp ]] && rm \"$RDRAMDISK\"/r_tmp\n\t\tTASK=\"@|sink('$RDRAMDISK/r_tmp')\"\n\t\techo \"$TASK\" > \"$RDHOME\"/r_in\n\t\techo \"@|if(getRversion()>='2.10.0'){cat(gsub('.*/library/(.*?)/.*?/(.*?)(\\\\\\\\.html|$)',paste('http://127.0.0.1:',ifelse(tools:::httpdPort<1,tools::startDynamicHelp(T),tools:::httpdPort),'/library/\\\\\\\\1/html/\\\\\\\\2.html',sep=''),as.vector(help('$WORD'$LIB)),perl=T),sep='\\n')}else{cat(gsub('(.*?)/library/(.*?)/.*?/(.*?)(\\\\\\\\.html|$)','\\\\\\\\1/library/\\\\\\\\2/html/\\\\\\\\3.html',as.vector(help('$WORD'$LIB)),perl=T),sep='\\n')}\" > \"$RDHOME\"/r_in\n\t\tsleep 0.001\n\t\twhile [ 1 ]\n\t\tdo\n\t\t\tRES=$(tail -c 2 \"$RDRAMDISK\"/r_out)\n\t\t\t[[ \"$RES\" == \"> \" ]] && break\n\t\t\t[[ \"$RES\" == \": \" ]] && break\n\t\t\t[[ \"$RES\" == \"+ \" ]] && break\n\t\t\tsleep 0.005\n\t\tdone\n\t\tsleep 0.001\n\t\tFILE=$(cat \"$RDRAMDISK\"/r_tmp)\n\t\tTASK=\"@|sink(NULL)\"\n\t\techo \"$TASK\" > \"$RDHOME\"/r_in\n\t\tsleep 0.001\n\t\tif [ ! -z \"$FILE\" -a \"$FILE\" != \"NA\" ]; then\n\t\t\tif [ \"${FILE:0:1}\" = \"/\" ]; then\n\t\t\t\techo -en \"\"\n\t\t\telse\n\t\t\t\techo -en \"\"\n\t\t\tfi\n\t\t\texit_show_html\n\t\tfi\n\tfi\nfi\n\nFILE=\"\"\nCNT=0\nif [ \"$TM_R_SHOW_ALWAYS_HELPSEARCH\" != \"1\" ]; then\n\t\"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"@getHelpURL('$WORD'$LIB)\"\n\tFILE=$(cat \"$RhelperAnswer\")\n\tCNT=`echo -e \"$FILE\" | wc -l`\n\tif [ ! -z \"$FILE\" -a \"$FILE\" != \"NA\" -a $CNT -eq 1 ]; then\n\t\tif [ \"${FILE:0:1}\" = \"/\" ]; then\n\t\t\techo -en \"\"\n\t\telse\n\t\t\techo -en \"\"\n\t\tfi\n\t\texit_show_html\n\telse\n\t\tFILE=\"\"\n\t\tCNT=0\n\tfi\nfi\n\n# Function to output the HTML frame set\nprintframe() {\n\tROWSIZE=$1\n\tcat <<-HF\n\t\n\t\n\t\n\tTextMate's R Help\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\n\t\nHF\n\n}\n\nHEAD=\"/tmp/textmate_Rhelper_head.html\"\nDATA=\"/tmp/textmate_Rhelper_data.html\"\nSEARCH=\"/tmp/textmate_Rhelper_search.html\"\nRHOME=${R_HOME:=/Library/Frameworks/R.framework/Versions/Current/Resources}\n\necho \"\" > \"$DATA\"\n\n\"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"cat(getRversion()>='2.10.0',sep='')\"\nIS_HELPSERVER=$(cat \"$RhelperAnswer\")\n\"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"@getHttpPort()\"\nPORT=$(cat \"$RhelperAnswer\")\n\n\ncat <<-\"HFS\" > \"$SEARCH\"\n\n\t\n\t\n\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t
\n\t\t\t
\n\t\t\tSearch for
\n\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t

begins with\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\n\nHFS01\n\necho \"\" > \"$HEAD\"\necho \"\" >> \"$HEAD\"\n\nif [ $CNT -gt 10 ]; then\n\texport token=$(\"$DIALOG\" -c -a ProgressDialog -p \"{title=Rdaemon;isIndeterminate=1;summary='R Documentation';details='Please wait. Building Help Page… $CNT items found';}\")\nfi\n\nif [ $CNT -gt 500 ]; then\n\techo \"\" >> \"$HEAD\"\nelse\n\t\toifs=\"$IFS\"\n\t\tIFS=\"\n\"\n\n\tif [ \"$IS_HELPSERVER\" == \"TRUE\" ]; then\n\t\tfor i in $FILE\n\t\tdo\n\t\t\tlib=$(echo -e \"$i\" | cut -d '\t' -f1)\n\t\t\tfun=$(echo -e \"$i\" | cut -d '\t' -f2)\n\t\t\tlink=$(echo -e \"$i\" | cut -d '\t' -f3)\n\t\t\techo \"\" >> \"$HEAD\"\n\t\tdone\n\t\tif [ $CNT -eq 1 ]; then\n\t\t\techo \"\" > \"$DATA\"\n\t\t\tcurl -gsS \"$link\" >> \"$DATA\"\n\t\tfi\n\telse\n\t\tfor i in $FILE\n\t\tdo\n\t\t\tlib=$(echo -e \"$i\" | cut -d '\t' -f1)\n\t\t\tfun=$(echo -e \"$i\" | cut -d '\t' -f2)\n\t\t\tlink=$(echo -e \"$i\" | cut -d '\t' -f3)\n\t\t\techo \"\" >> \"$HEAD\"\n\t\tdone\n\t\tif [ $CNT -eq 1 ]; then\n\t\t\techo \"\" > \"$DATA\"\n\t\t\tcat \"$link\" | iconv -s -f ISO8859-1 -t UTF-8 >> \"$DATA\"\n\t\tfi\n\tfi\nfi\necho \"
PackageTopic
too much matches...
$lib$fun
$lib$fun
\" >> \"$HEAD\"\n\nprintframe 340\n\n\"$DIALOG\" -x $token 2&>/dev/null\nexit_show_html\n\n", fallbackInput: "none", input: "selection", keyEquivalent: "^h", name: "Show R Help for actual Word / Selection", output: "showAsTooltip", scope: "source.r, source.rd.console", uuid: "3F849C03-8BFC-4A54-B985-09BB453AF679"}, {beforeRunningCommand: "nop", command: "cat | R --vanilla --slave --no-readline --encoding=UTF-8", input: "selection", keyEquivalent: "^@r", name: "Show Result as Tooltip", output: "showAsTooltip", scope: "source.r", uuid: "E3EAFF15-1B8D-4E74-8649-2A3CADC0A119"}, {beforeRunningCommand: "nop", command: "#!/usr/bin/env ruby\n# print \"Got:\" + STDIN.read\n\nrequire ENV['TM_SUPPORT_PATH'] +'/lib/ui.rb'\nrequire ENV['TM_SUPPORT_PATH'] +'/lib/exit_codes.rb'\nopts = { \"Summary\" => \"summary(${1:x})\", \n \"Table\" => \"table(${1:x})\"}\nkeys = opts.keys.sort\nans = TextMate::UI.menu(keys)\nTextMate.exit_discard unless ans\nprint opts[keys[ans]]", fallbackInput: "word", input: "none", keyEquivalent: "~@S", name: "Summaries…", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "6A931F29-5A2B-4CCB-A958-0A0A9A3F2BEF"}, {beforeRunningCommand: "nop", command: "RPID=$(ps aw | grep '[0-9] /.*TMRHelperDaemon' | awk '{print $1}' )\nif [ ! -z $RPID ]; then\n\tout=$(kill $RPID)\n\tif [ -z \"$out\" ]; then\n\t\trm -f /tmp/textmate_Rhelper_console\n\t\trm -f /tmp/textmate_Rhelper_data.html\n\t\trm -f /tmp/textmate_Rhelper_head.html\n\t\trm -f /tmp/textmate_Rhelper_in\n\t\trm -f /tmp/textmate_Rhelper_out\n\t\trm -f /tmp/textmate_Rhelper_search.html\n\t\trm -f /tmp/textmate_Rhelper_status\n\t\techo \"Helper Daemon was terminated.\"\n\telse\n\t\techo \"Error while terminating Helper Daemon running as PID $RPID.\"\n\tfi\nelse\n\techo \"No Helper Daemon found.\"\nfi", input: "none", name: "Terminate Helper Daemon", output: "showAsTooltip", scope: "source.r, source.rd.console", uuid: "90C73568-B9B1-4D3D-BAC5-5C2999BE39BC"}, {beforeRunningCommand: "nop", command: "#[[ -z \"$TM_SELECTED_TEXT\" ]] && echo \"Please select a function definition\" && #exit_show_tool_tip\n\necho \"dummy <- function() {\" > /tmp/TM_Rtidy_func.R\ncat >> /tmp/TM_Rtidy_func.R\necho \"}\" >> /tmp/TM_Rtidy_func.R\n\nif [ $TM_SOFT_TABS == \"YES\" ]; then\n\texport TAB=$(perl -e 'print \" \" x $ENV{\"TM_TAB_SIZE\"}')\nelse\n\texport TAB=\"\t\"\nfi\n\nexport TABLEVEL=$(head -n 2 /tmp/TM_Rtidy_func.R | tail -n 1 | perl -pe 's/^([ \\t]*).*/$1/')\n\ncat <<-HFS > /tmp/TM_Rtidy.R\noptions(keep.source = FALSE)\noptions(warn = -1)\noptions(show.error.messages = TRUE)\nsource(\"/tmp/TM_Rtidy_func.R\")\ndump(ls(all = TRUE), file = \"/tmp/TM_Rtidy_func_new.R\", control = c(\"keepInteger\", \"keepNA\", \"quoteExpressions\"))\nHFS\n\nR --vanilla --slave < /tmp/TM_Rtidy.R 2> /tmp/TM_Rtidy.err\n\nERR=$(cat /tmp/TM_Rtidy.err | sed '1,3d' | sed '$d')\nif [ ! -z \"$ERR\" ]; then\n\t[[ -e /tmp/TM_Rtidy_func.R ]] && rm /tmp/TM_Rtidy_func.R\n\t[[ -e /tmp/TM_Rtidy.R ]] && rm /tmp/TM_Rtidy.R\n\t[[ -e /tmp/TM_Rtidy_func_new.R ]] && rm /tmp/TM_Rtidy_func_new.R\n\t[[ -e /tmp/TM_Rtidy.err ]] && rm /tmp/TM_Rtidy.err\n\techo \"Syntax Error at:\"\n\tif [ -z \"$TM_SELECTED_TEXT\" ]; then\n\t\tERR=$(echo -en \"$ERR\" | perl -e '$_=<>;chomp;m/^(\\d+):(.*)/;print \"line \" . ($1-1) . \": $2\"')\n\t\tLINE=$(echo -en \"$ERR\" | perl -pe 's/^line (\\d+):.*/$1/')\n\t\topen \"txmt://open?line=$LINE\"\n\telse\n\t\tERR=$(echo -en \"$ERR\" | perl -e '$_=<>;chomp;m/^(\\d+):(.*)/;print \"line \" . ($1-2+$ENV{\"TM_INPUT_START_LINE\"}) . \": $2\"')\n\t\tLINE=$(echo -en \"$ERR\" | perl -pe 's/^line (\\d+):.*/$1/')\n\t\t#LINE=$(($LINE + $TM_INPUT_START_LINE - 1))\n\t\topen \"txmt://open?line=$LINE\"\n\tfi\n\techo -en \"$ERR\"\n\texit_show_tool_tip\nfi\n\nif [ -e /tmp/TM_Rtidy_func_new.R ]; then\n\tcat /tmp/TM_Rtidy_func_new.R | sed '1,3d;$d' | perl -pe 's/^ /$ENV{\"TABLEVEL\"}/;s/^\\`(.*?)\\` <\\-\\n/$1 <\\- /;s/ {4}/$ENV{\"TAB\"}/g;s/function \\(/function(/;s/(.*?<\\- function\\()/\\n$1/'\nelse\n\techo \"Unknown error occured\"\n\texit_show_tool_tip\nfi\n\n[[ -e /tmp/TM_Rtidy_func.R ]] && rm /tmp/TM_Rtidy_func.R\n[[ -e /tmp/TM_Rtidy.R ]] && rm /tmp/TM_Rtidy.R\n[[ -e /tmp/TM_Rtidy_func_new.R ]] && rm /tmp/TM_Rtidy_func_new.R\n[[ -e /tmp/TM_Rtidy.err ]] && rm /tmp/TM_Rtidy.err\n\n\n\n", fallbackInput: "document", input: "selection", keyEquivalent: "^H", name: "Tidy (removes all comments!)", output: "replaceSelectedText", scope: "source.r -source.r.rd.console", uuid: "3A526F78-B82D-41BD-9799-CA5F846401DC"}, {beforeRunningCommand: "nop", command: "FLAG=$(echo -en \"$TM_CURRENT_LINE\" | perl -e '$_=<>;m/.*?( $)/;print 1 if defined($1)')\nif [ -z \"$FLAG\" ]; then\n\techo -n \" <- \"\nelse\n\techo -n \"<- \"\nfi", input: "none", keyEquivalent: "^-", name: "“ <- ”", output: "afterSelectedText", scope: "source.r, source.rd.console", uuid: "06BD4251-25D5-4BA0-99BC-5D3061E64128"}, {beforeRunningCommand: "nop", command: "export WORD=\"par\"\n\n\"$TM_BUNDLE_SUPPORT\"/bin/initCommandArgsDir.sh\nif [ -e \"$TM_BUNDLE_SUPPORT\"/lib/command_args/$WORD ]; then\n\texport RES=$(cat \"$TM_BUNDLE_SUPPORT\"/lib/command_args/$WORD | perl -pe 's/\\|/:/g;s/,/\\|/g;s/\\n/,/g;s/ //g;')\nfi\n\n#if no parameter quit\n[[ -z \"$RES\" ]] && exit_discard\n\n#show all parameters as inline menu and insert the parameter as snippet (if '=' is found only the value)\nruby -- <<-SCRIPT\n# 2> /dev/null\nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/exit_codes.rb\")\nrequire \"\#{ENV[\"TM_SUPPORT_PATH\"]}/lib/ui\"\nword = \"$WORD\"\ntext = ENV[\"RES\"]\nfuns = text.split(\",\")\nfuns.collect! {|x| x.gsub(/\\|/, \", \").gsub(/=/, \" = \").gsub(/:/, \"|\")}\n\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?\ncurword = ENV['TM_CURRENT_WORD']\ncomma=\"\"\nif ! curword.match(\",\") && ! curword.match('\\( *\\)+$')\n\tcomma = \"\\${200:, }\"\nend\n\nif function.match(\"=\")\n\tarr = function.gsub(/ = /, \"=\").split('=')\n\tif arr[1].match(\"\\\"\")\n\t\tprint \"\#{comma}\#{arr[0]} = \\\"\\${1:\#{arr[1].gsub(/\\\"/, \"\")}}\\\"\\${300:}\"\n\telse\n\t\tif arr[1].match(\"^c\\(.*?\\)$\")\n\t\t\tsubarr = arr[1].gsub(/^c\\(/, \"\").gsub(/\\)$/,\"\").gsub(/ /,\"\").split(\",\")\n\t\t\tfor i in (0..(subarr.size - 1))\n\t\t\t\tsubarr[i] = \"\\${\#{i+2}:\#{subarr[i]}}\"\n\t\t\tend\n\t\t\tprint \"\#{comma}\#{arr[0]} = \\${1:c(\#{subarr.join(\", \")})}\\${300:}\"\n\t\telse\n\t\t\tprint \"\#{comma}\#{arr[0]} = \\${1:\#{arr[1]}}\\${30:}\"\n\t\tend\n\tend\nelse\n\tprint \"\#{comma}\\${1:\#{function}}\\${3:}\"\nend\nSCRIPT\n", fallbackInput: "none", input: "none", keyEquivalent: "^;", name: "“par()” Parameters…", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "38BD6CA7-0916-43BD-88C9-CBFC4ED17FDE"}, {beforeRunningCommand: "nop", command: "[[ -n \"$TM_SELECTED_TEXT\" ]] && echo \"Please unselect first.\" && exit_show_tool_tip\n\nLINE=$(cat | perl -e '\n\t$line=$ENV{\"TM_CURRENT_LINE\"};$col=$ENV{\"TM_LINE_INDEX\"};\n\t$lineL=substr($line,0,$col);\n\t$lineR=substr($line,$col);\n\t$lineL=~s/(?=[\\$`\\\\])/\\\\/g;\n\t$lineR=~s/(?=[\\$`\\\\])/\\\\/g;\n\tprint \"$lineL\\${0:}$lineR\";\n')\nWORD=$(ruby -- <<-SCR1 \n\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/current_word.rb\")\n\tword = Word.current_word('\\w._\\(')\n\tprint word\nSCR1\n)\n\nWORD=$(echo -en \"$WORD\" | perl -pe 's/\\([^\\(]*$//')\n\n[[ -z \"$WORD\" ]] && echo \"No keyword found\" && exit_show_tool_tip\n\n\"$TM_BUNDLE_SUPPORT\"/bin/askRhelperDaemon.sh \"@getPackageFor('$WORD')\"\nLIB=$(cat /tmp/textmate_Rhelper_out)\nif [ -z \"$LIB\" ]; then\n\techo -en \"No package found.\"\n\texit 206\nfi\n\nif [ `echo \"$LIB\" | wc -l` -gt 1 ]; then\n\tLIB=$(echo \"$LIB\" | sort -f | ruby -e '\n\t\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/ui.rb\")\n\t\trequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/exit_codes.rb\")\n\t\twords = STDIN.read().split(\"\\n\")\n\t\tindex=TextMate::UI.menu(words)\n\t\tif index != nil\n\t\t\tprint words[index]\n\t\tend\n\t')\nfi\n\nif [ `echo -n \"$TM_SCOPE\" | grep -c -F 'source.rd.console'` -gt 0 ]; then\n\techo -en \"> require($LIB); \"\n\techo -n \"$LINE\" | sed 's/^> //'\nelse\n\tTABS=$(echo -en \"$LINE\" | perl -e '$a=<>;$a=~m/^([\\t ]+)/;print $1 if defined($1)')\n\techo -en \"$TABS\"\n\techo -e \"require($LIB)\"\n\techo -n \"$LINE\"\nfi\n\n", fallbackInput: "line", input: "selection", keyEquivalent: "^L", name: "“require(xxx)” for current Function", output: "insertAsSnippet", scope: "source.r, source.rd.console", uuid: "8D7F64A5-B2C5-4BF1-B7C5-352CF6AAEF28"}]