在VIM中使用GOOGLE进行搜索或者翻译,vimgoogle,[Python]代码py
在VIM中使用GOOGLE进行搜索或者翻译,vimgoogle,[Python]代码py
[Python]代码
python << EOM#coding = utf-8def google_it(word): import re import webbrowser if not word or word.isspace(): print 'there is no word under the cursor' else: try: url = 'http://www.google.com/search?q='+word webbrowser.open(url) except: print 'cannot access google!'def google_translate_it(word): import re import webbrowser if not word or word.isspace(): print 'there is no word under the cursor!' else: try: url = 'http://translate.google.cn/#en|zh-CN|'+word+'%0A' webbrowser.open(url) except: print 'cannot access google!'EOMfunction! Google()python << EOM#coding = utf-8import vimpy_word = vim.eval("expand(\"<cword>\")")print py_wordgoogle_it(py_word)EOMendfunctionfunction! GoogleTranslate()python << EOM#coding = utf-8import vimpy_word = vim.eval("expand(\"<cword>\")")print py_wordgoogle_translate_it(py_word)EOMendfunctioncommand GOOGLE :call Google()command GOOGLETRANSLATE :call GoogleTranslate()
相关内容
- secure crt 脚本,securecrt,[Python]代码#$
- hashlib穷举字典破解md5,sha1,hashlibsha1,初步完工,在U
- python求素数的一句话代码 lambda实现,pythonlambda,#在交互
- 用python计算(1+2+3+4……+100),python,[Python]代码n=
- python修改操作系统时间的代码,python操作系统,#-*- cod
- python根据出生年份计算生肖的代码,python出生年份,#计
- 解数独,,[Python]代码#!
- 解24点,,[Python]代码#!
- Python program to solve an equation using Gauss elimination,equatio
- python实例 盖房子种树记好时间,python实例,[Python]代码
评论关闭