Skip to content

Commit e44ed4e

Browse files
committed
first checkin
Signed-off-by: James Deng <[email protected]>
0 parents  commit e44ed4e

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

Default (Linux).sublime-keymap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"keys": ["ctrl+shift+g"],
4+
"command": "go_to_doc",
5+
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
6+
}
7+
]

Default (OSX).sublime-keymap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"keys": ["super+g"],
4+
"command": "go_to_doc" ,
5+
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
6+
}
7+
]

Default (Windows).sublime-keymap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"keys": ["ctrl+shift+g"],
4+
"command": "go_to_doc",
5+
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
6+
}
7+
]

GoToDoc.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sublime, sublime_plugin
2+
import webbrowser
3+
4+
# 1. go to only package document at http://golang.org/pkg/
5+
# 2. google search on golang.org and go to the first result like "I'm Feeling Lucky"
6+
# 3.
7+
8+
class GoToDocCommand(sublime_plugin.TextCommand):
9+
10+
def description(self):
11+
return 'A Sublime Text 2 plugin to quickly open go package document base on the selected text'
12+
13+
def get_full_pkg_name(self, edit):
14+
'''Try to find the full package name in go import statement'''
15+
pass
16+
17+
def run(self, edit):
18+
#self.view.insert(edit, 0, "Hello, World!")
19+
sels = self.view.sel()
20+
for sel in sels:
21+
#print(self.view.substr(sel))
22+
webbrowser.open_new_tab('http://golang.org/pkg/' + self.view.substr(sel))

0 commit comments

Comments
 (0)