Vim Script - Fanfou
这是个很简单的 Vim + Python 脚本,可是我却写了一整夜,毕竟对于 Python,我还是在入门边缘徘徊的菜鸟。
这个脚本做三件事情:
- 显示饭否随便看看的消息
- 显示饭否中我以及我的好友的消息
- 发布新的饭否消息
其实,按照 API 来说,还是可以做很多,比如好友管理什么的,不过天快亮了,就不做了,基本上可以发布消息,可以看消息基本就 OK 了。
由于这个 Script 包含 Python 文件,所以你的 Vim 必须支持 Python 并安装 simplejson 模块才行(使用 easy_install simplejson 安装,具体步骤,请自行查询,谢谢:P ),否则无法使用,Vim 启动时会报错,很难看哦!
Installation:
把 fanfou.py、fanfou.vim 拷贝到 vimfiles/plugin 目录下面,打开 fanfou.vim,编辑:
if !exists("g:fanfou_username")
let g:fanfou_username = "fanfou-id-or-email"
endif
if !exists("g:fanfou_password")
let g:fanfou_password = "fanfou-password"
endif
let g:fanfou_username = "fanfou-id-or-email"
endif
if !exists("g:fanfou_password")
let g:fanfou_password = "fanfou-password"
endif
填入你的帐号密码,即可。
另外你也可以修改下面的键盘映射:
nmap <Leader>tw <Esc>:execute 'py FanfouVim.UpdateStatus("' . inputdialog('Enter a fanfou status message:') . '")'<CR>
nmap <Leader>tp <Esc>:py FanfouVim.GetPublicTimeline()<CR>
nmap <Leader>tf <Esc>:py FanfouVim.GetFriendsTimeline()<CR>
nmap <Leader>tp <Esc>:py FanfouVim.GetPublicTimeline()<CR>
nmap <Leader>tf <Esc>:py FanfouVim.GetFriendsTimeline()<CR>
Update: Jun 28, 2007 17:50
- 修正source问题,使用该插件发送饭否消息时,将显示为:“通过 Vim”
Update: Jul 11, 2007 05:38
- 没有安装 Python 以及没有安装 simplejson 的情况,显示友好的报错信息。
Download:
Vim Script - Fanfou 1.0b2




Bruce Gao said,
Wrote on July 31, 2007 @ 4:28 pm
不错不错,哈哈,我正学习Python中
Verdana Mu said,
Wrote on July 31, 2007 @ 4:58 pm
Python 我很菜,以后多交流哈,呵呵
auc said,
Wrote on August 3, 2007 @ 9:30 am
verdana,还使用2.4么,该换成python2.5.1了。
ngn999 said,
Wrote on January 6, 2008 @ 9:34 am
这么复杂!
我在用VIM但是不懂python.
不下了!
ngn999 said,
Wrote on June 10, 2008 @ 2:23 pm
装上了,但只有\tw能用,\tp和\tf都不能用啊,是不是楼上说的版本的问题,我的pytho是2.5的!