[IPython-User] Swap enter and shift-enter in notebook?
Matthias BUSSONNIER
bussonniermatthias@gmail....
Sat Aug 4 09:35:40 CDT 2012
Le 3 août 2012 à 02:23, Michael McNeil Forbes a écrit :
> On 2 Aug 2012, at 12:39 AM, Matthias Bussonnier wrote:
>> Sorry for the brievty, answer from my phone.
>>
>> If you use 0.14 dev. you can overwrite ipython file without touching
>> the server.
>> Just add them into .ipython/profile/profile_xxx/
>>
>
> This seems to work fine:
> 1) Install IPython 0.14-dev from github on server.
> 2) Copy notebook.js and codecell.js to ~/.ipython/profile/profile_xxx/
> static/js/ from
> https://raw.github.com/ipython/ipython/master/IPython/
> Note: this profile name must match the name of the profile on the
> server. This is a
> little strange in terms of UI since the name of this profile is
> not even visible
usually you start your notebook with --profile=whatever
if you don't say anything it will use…default
> from the web interface, but probably makes sense from a dev.
> perspective to localize
> the effects.
> 3) Swap the shift-flag near as follows
>
> if (event.which == key.ENTER) {
> // MMF Customization: swap enter and shift-enter
> event.shiftKey = !event.shiftKey;
> }
>
> Do this near the start of the following function in codecell.js
>
> CodeCell.prototype.handle_codemirror_keyevent = function
> (editor, event) {
>
> and near the start of the following block in notebook.js
>
> $(document).keydown(function (event) {
>
> While I am at it I might add a sequence for joining two adjacent
> blocks. Is there
> a function that will do this simply?
IPython.notebook.merge_cell_above();
IPython.notebook.merge_cell_below();
is IMHO what you want.
if you ever want to refactor the javascript and
make something that allows to easily configure the keybindings (dict of {key:function}) for example
we love Pull requests.
--
Matthias
>
> Thanks,
> Michael.
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
More information about the IPython-User
mailing list