Home Download Buy Blog Forum Support

fresher ---> webbrowser keymap-bind

fresher ---> webbrowser keymap-bind

Postby iZuckonit on Wed Mar 21, 2012 6:06 am

################################
# this is the py source: #
################################

import sublime, sublime_plugin
import webbrowser

class GoogleCommand(sublime_plugin.TextCommand):
def run(self, edit):
url = 'http://www.google.com.hk/search?ix=hea&sourceid=chrome&ie=UTF-8&q='
sels = self.view.sel()
for sel in sels:
url += self.view.substr(sel)

webbrowser.open(url)



##################################
# this is the sublime-keymap #
##################################

[
{
"keys":["ctrl+alt+k"],
"command": "google"
}
]





#everything is ok when i run view.run_command('google') in console
#but not effective when using key-map
#what`s wrong? can you help me,a fresher ....
#Thanks very much
iZuckonit
 
Posts: 1
Joined: Wed Mar 21, 2012 6:00 am

Re: fresher ---> webbrowser keymap-bind

Postby DukeOfDrow on Tue Mar 27, 2012 6:28 am

Could it be that when you are typing into the console you are putting single quotes and when you are using the key map you have double quotes? I hope you get this working because this would make things so much easier for HTML which is what I do most.
DukeOfDrow
 
Posts: 1
Joined: Tue Mar 27, 2012 6:25 am


Return to Plugin Development

Who is online

Users browsing this forum: MarcusF and 2 guests