2009年8月23日日曜日

vimからpydocして補完する

manpageview.vim


http://www.vim.org/scripts/script.php?script_id=489
"ManPageView - Viewer for manpages, gnu info, perldoc, and php (unix/linux/cygwin) : vim online")
manpageview.vimは任意の拡張子に大してmanコマンドを設定できるみたい。

let g:manpageview_pgm_py="pydpoc"

とすると、:Man string.py で表示できた。

let g:manpageview_sfx_py=".py"

とするとおそらく*.py編集中に :Man string で表示できそう。

その他の案: pydoc.vim を使用する


http://www.vim.org/scripts/script.php?script_id=910
あ、更新されてない。見送る。

その他の案: オンラインドキュメントを表示


http://vim.g.hatena.ne.jp/y_yanbe/20081012/1223781859
yanbe.vim - vimグループ
Linuxはopenをfirefoxとかにするかxgd-openにするとgnome-openやら介して適切なプログラムで表示してくれそう。
「オンラインドキュメントの方がpydocよりも内容が詳しい」しらんかった…

ref.vim


ref.vim 書いた - 永遠に未完成
http://d.hatena.ne.jp/thinca/20090809/1249829893
あたらしめのref.vimというプラグインもでてきたのでコミュニティのひとはこっちも試してテストに参加するのもいいかも。

2009年8月17日月曜日

[python]Twitter Streaming API

参考:
Twitter Streaming APIをRubyで試してみる - しばそんノート
http://d.hatena.ne.jp/shibason/20090816/1250405491
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urlparse
import urllib2
from pit import Pit
try:
import json
except ImportError:
import simplejson as json
SPRITZER_API_URL = 'http://stream.twitter.com/spritzer.json'
SPRITZER_API_HOST = urlparse.urlparse(SPRITZER_API_URL).hostname
AUTHORIZATION_RELM = 'Firehose'
config = Pit.get('twitter.com',
{'require': {'login': 'login name',
'password': 'login password',}})
USER = config['login']
PASSWORD = config['password']
def _install_opener():
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password(
AUTHORIZATION_RELM,
SPRITZER_API_HOST,
USER, PASSWORD
)
opener = urllib2.build_opener(auth_handler)
urllib2.install_opener(opener)
def main():
_install_opener()
response = urllib2.urlopen(SPRITZER_API_URL)
connection = True
while (connection):
try:
next = response.next()
status = json.loads(next)
if 'text' in status:
print "%s: %s" % (
status['user']['screen_name'],
status['text'])
except Exception, e:
connection = False
print e
print "...close connection."
if __name__ == "__main__":
main()
view raw twi_stream.py hosted with ❤ by GitHub

もりもり流れてくる。

2009年8月8日土曜日

blogger.vim

blogger.vim での投稿。
ku.vimとかmetarw.vimとか名前だけ聞いたことのあったプラグインもインストールした。
なかなかクール。ドキュメント読まないとさっぱり分かれそうにないな。