Help us understand the problem. What is going on with this article?

IPython notebookでemacs or vimのキーバインドを使う

More than 5 years have passed since last update.

皆さん、超便利なipython notebook使ってますよね。
そして、vimやemacsユーザーの皆さんは、vimのキーバインドやemacsのキーバインドが使えなくて苦しんでますよね?


そんなあなたに魔法のjsコードをプレゼントしましょう。


以下のjsを、$IPYTHONDIR/profile_default/static/custom/custom.jsの末尾に追記しましょう。

魔法のコード
var my_keymap = 'emacs';
// var my_keymap = 'vim';

$.getScript("/static/components/codemirror/keymap/" + my_keymap + ".js");

IPython.RawCell.options_default.cm_config = {keyMap: my_keymap};
IPython.Cell.options_default.cm_config.keyMap = my_keymap;
IPython.TextCell.options_default.cm_config.keyMap = my_keymap;
IPython.MarkdownCell.options_default.cm_config.keyMap = my_keymap;
IPython.HeadingCell.options_default.cm_config = {keyMap: my_keymap};
IPython.CodeCell.options_default.cm_config.keyMap = my_keymap;

環境変数IPYTHONDIRが存在しない場合は、ipythonを起動して、以下のコードで確認できます。(典型的には$HOME/.ipython, $HOME/.config/ipythonが多いみたいです。詳しくはここ。)

import IPython
IPython.utils.path.get_ipython_dir()

ちなみに確認環境はipython2.1.0.

kenbeese
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした