Vim Script - Fanfou

Fanfou Logo

这是个很简单的 Vim + Python 脚本,可是我却写了一整夜,毕竟对于 Python,我还是在入门边缘徘徊的菜鸟。

这个脚本做三件事情:

  1. 显示饭否随便看看的消息
  2. 显示饭否中我以及我的好友的消息
  3. 发布新的饭否消息

其实,按照 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
</php>
 
填入你的帐号密码,即可。
 
另外你也可以修改下面的键盘映射:
 
<pre lang="bash">
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>

Update: Jun 28, 2007 17:50

  1. 修正source问题,使用该插件发送饭否消息时,将显示为:“通过 Vim”

Update: Jul 11, 2007 05:38

  1. 没有安装 Python 以及没有安装 simplejson 的情况,显示友好的报错信息。

Download:
Vim Script - Fanfou 1.0b2

Comments (6)

Bruce GaoJuly 31st, 2007 at 4:28 pm

不错不错,哈哈,我正学习Python中

Verdana MuJuly 31st, 2007 at 4:58 pm

Python 我很菜,以后多交流哈,呵呵 :)

aucAugust 3rd, 2007 at 9:30 am

verdana,还使用2.4么,该换成python2.5.1了。

ngn999January 6th, 2008 at 9:34 am

这么复杂!
我在用VIM但是不懂python.
不下了!

ngn999June 10th, 2008 at 2:23 pm

装上了,但只有\tw能用,\tp和\tf都不能用啊,是不是楼上说的版本的问题,我的pytho是2.5的!

jinuljtSeptember 12th, 2008 at 7:27 pm

自娱自乐,很好。

Leave a comment

Your comment