{
"metadata": {
"name": "",
"signature": "sha256:0b8db271ae751a6fc05bc9df0d1a34e3ec4680328277979b957e83f2c9af3847"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.html.widgets import *\n",
"from IPython.display import display, display_javascript\n",
"h = HTMLWidget(value=\"\"\"\"\"\")\n",
"display(h)\n",
"def vim_interact(height, fixed_height, HideMySource, keymap):\n",
" h.value = \"\"\"\"\"\"%(keymap,\n",
"\"if (i==0) cells[i].code_mirror.setSize(null, 0); else\" if HideMySource else \"\", \n",
"height if fixed_height else \"'auto'\", \n",
"keymap)\n",
" \n",
"interact(vim_interact, height=IntSliderWidget(min=10, max=1000, step=20, value=300),\n",
" fixed_height = True, HideMySource = True, keymap = DropdownWidget(values=['default','emacs','vim','sublime'], value='vim', Description=\"keymap:\") \n",
" )"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# attempt to override the chrome developer console, not finished yet\n",
"from IPython.html.widgets import *\n",
"from IPython.display import display, display_javascript\n",
"h = HTMLWidget(value=r\"\"\"\n",
"\n",
"\"\"\")\n",
"display(h)\n"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%javascript\n",
"/* Use Ctrl-Enter to execute this cell, automatically clear output */\n",
"(function(){\n",
"var idx = IPython.notebook.get_selected_index();\n",
"if(idx >0)\n",
"setTimeout(function(){IPython.notebook.clear_output(idx-1);}, 100);\n",
"setTimeout(function(){IPython.notebook.clear_output(idx);}, 100);\n",
"$.getScript(\"/static/components/codemirror/keymap/vim.js\");\n",
"IPython.CodeCell.options_default.cm_config.keyMap = 'vim';\n",
"IPython.keyboard_manager.edit_shortcuts.remove_shortcut('Esc');\n",
"setTimeout(function(){\n",
"var cells = IPython.notebook.get_cells();\n",
"var i;\n",
"for(i in cells) {cells[i].cm_config.keyMap='vim';\n",
" cells[i].code_mirror.setSize(null, 300); \n",
" }\n",
"}, 100);\n",
"setTimeout(function(){IPython.notebook.clear_output(idx);}, 100);\n",
"if(idx>0)\n",
"setTimeout(function(){IPython.notebook.clear_output(idx-1);}, 100);\n",
"})();"
],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# this will failed to load the output\n",
"from IPython.display import Javascript, HTML\n",
"display(HTML( \"\"\"\n",
"\"\"\"))"
],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}