在VIM中使用GOOGLE进行搜索或者翻译,vimgoogle,一个在VIM中直接调用浏
在VIM中使用GOOGLE进行搜索或者翻译,vimgoogle,一个在VIM中直接调用浏
一个在VIM中直接调用浏览器搜索或翻译当前光标下单词的一段代码。VIM必须内建PYTHON.
放入.vimrc 文件中即可
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 = '<a href="http://www.google.com/search?q=">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 = '<a href="http://translate.google.cn/">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()#该片段来自于http://byrx.net
相关内容
- easy_install 错误Setup script exited with error: Unable to find vcv
- python简单的函数定义和使用范例,python函数范例,def c
- 找出数组中出现频率超过一半的数,数组超过一半,有一
- 3行Python代码解简单的一元一次方程,3行python,solve("
- python直接通过邮件服务器端口发送邮件,python邮件服务
- Python从ftp服务器下载文件的代码,,#coding=utf-
- python操作sqlite的CRUD,pythonsqlitecrud,import sqlit
- Ubuntu,按下ctrl,查询选定的单词,ubuntuctrl,双击或拖选
- Python从URL地址提取文件名,,import osurl
- python从mymailbox.msg获取邮件信息,,import rfc82
评论关闭