By junichi shinohara on February 12, 2009 10:49 AM | Permalink | Comments (0) | TrackBacks (0) 社内ではemacs派に押され気味のvim派ですが・・・ vimだってできるもんっ!ということで 先日の記事 emacs上でpythonコードをデバッグする に対抗してvim版をご紹介します。
カレント行テキストを取得する from vim import * print current.line 選択範囲テキストを取得する # -*- coding: shift_jis -*- from vim import * # 選択範囲3行目のデータを出力 print current.range[2] # -*- coding: shift_jis -*- from vim import * # 選択範囲のテキストを全て出力 for i in current.range: print i カレントバッファのテキストを取得する # -*- coding: shift_jis -*- from vim import * # 3行目のデータを出力 print current.buffer[2] # -*- coding: shift_jis -*- from vim import * # カレン
vimでPythonを書きやすくするように、入力補完するpydictionを入れる インストール 以下からダウンロード http://www.vim.org/scripts/script.php?script_id=850 そしてインストール cd ~ tar xvf pydiction-0.5.tar vi ~/.vimrc ----- if has("autocmd") autocmd FileType python set complete+=k/Users/username/pydiction -0.5/pydiction iskeyword+=.,( endif " has("autocmd") -----そして使ってみる. 適当なPythonファイルを編集 vi test.py ----- for<Ctrl-n> のように<Ctrl-n>を押すと、候補一覧が表示。さらに候補を選
Pydiction allows you to Tab-complete Python code in Vim such as keywords, built-ins, standard library, and third-party modules. For the latest version of Pydiction and full documentation, see: http://rkulla.github.io/pydiction/ It doesn't require installing any dependencies. It simply consists of three files: python_pydiction.vim -- Vim plugin that autocompletes Python code. complete-dict
今日はさっくり小ネタ。 最近私はPythonを勉強中なのですが、「このての軽量言語はさっと書いてさっと実行できなきゃだめ」という信念のもと、編集にはvimを使っています。 とはいえ、Pythonは実はかなり「エディタを選ぶ」言語です。インデントによってブロックを表現するので、インデントがきちんと表示されないと困りますし、タブとスペースが入り交じってしまわないようなエディタの補助も欲しいところです。 というわけで、今日は、そんなPythonをすっきり快適に編集できるような vim の設定をご紹介します。 いきなり結論 私は以下のような記述を ~/.vimrc に追記しました。 autocmd FileType python setl autoindent autocmd FileType python setl smartindent cinwords=if,elif,else,for,wh
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く