/
RSiteSearch for Word:Selection.tmCommand
54 lines (51 loc) · 1.55 KB
/
RSiteSearch for Word:Selection.tmCommand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
if [ -z "$TM_SELECTED_TEXT" ]; then
WORD=$(/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -- <<-SCR1
require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb")
word = Word.current_word('\w\.')
word.gsub!(/^[\d\.\-]+$/,"")
print word
SCR1
)
else
WORD=$TM_SELECTED_TEXT
fi
if [ -z "$WORD" ]; then
open "http://search.r-project.org/"
else
W=`echo -en "$WORD" | sed 's/ {1,}/+/g'`
open "http://search.r-project.org/cgi-bin/namazu.cgi?query=$W&max=20&result=normal&sort=score&idxname=Rhelp02a&idxname=functions&idxname=docs"
fi
</string>
<key>fallbackInput</key>
<string>word</string>
<key>input</key>
<string>selection</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>^~@H</string>
<key>name</key>
<string>RSite Search for Word / Selection</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>toolTip</string>
<key>scope</key>
<string>source.r, source.rd.console</string>
<key>uuid</key>
<string>B26AF49E-C737-41D4-990F-5BBB138B3FCD</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>