[IPython-dev] Shortcut to convert cell between code and markdown while remaining in edit mode?

James Booth jabooth at gmail.com
Sun Apr 20 16:24:10 EDT 2014

I would second this as a bit of a usability pain point, but for a slightly different reason. I don't mind '<esc> <m> <enter>' to quickly switch to markdown and get back to editing  (maybe being a Vim user helps!) but this resets the cursor back to the start of the cell. If the cursor was back where I left it I could realise my error, hit the keystrokes instinctively and get straight back to typing - instead I have to reposition the cursor which does break flow. (Granted, Ctrl-E is usually enough but it's not always the case that my cursor is at the end when I realise my error!)

Would it be an easy fix to remember cursor position between cell type changes? Is there any reason why it goes back to the start every time?

Personally I think this would be a usability improvement regardless of whether there was an option to perform the switch whilst remaining in edit mode as Max is suggesting or not. 


P.S. I've been threatening to get into IPython front end development for ages, if it's not too difficult and people would like this behaviour I'm more than happy to prepare a PR, just aim me in the right general direction!

> On 20 Apr 2014, at 18:09, Maximilian Albert <maximilian.albert at gmail.com> wrote:
> Hi all,
> First of all a big word of thanks to the entire team for all the great and hard work! I'm using IPython for pretty much all of my work and it gets better and better by the day and is a joy to use. :)
> I have a small remark/request about the new modal interface for the notebook. I really like it in most ways, but it would be great if there was a way to convert a cell from code to markdown (and vice versa) *without having to leave edit mode*.
> Background: I frequently find myself in a situation where I just executed a code cell and now want to enter a few descriptive sentences for the next piece of code. So I start typing, but since I just executed a code cell the current cell is also a code cell. I realise this after a few words and then have to execute three key strokes:
>    Esc  -> go into command mode
>    m  -> convert cell to markdown
>    Enter  -> enter edit mode
> Since all of these keys are at different positions on the keyboard, it makes this process a bit cumbersome, especially because I always lose half a second or so between each key stroke to check whether it actually did what I expected it to do. It's not a major problem, but it is annoying enough to get in my way because it interrupts the mental flow while I'm focusing on how to write a (possibly non-trivial) explanation for the next bit of code.
> So it would be great if there was a way to simply convert a cell from code to markdown with a single keyboard shortcut, while *remaining in edit mode*.
> Suggestions:
> - Currently, the shortcuts "Ctrl-m" and "Esc" have the same meaning in edit mode (viz., "enter command mode"). Why not change the meaning of "Ctrl-m" to: "convert current cell to markdown and remain in edit mode"? This plays nicely with the fact that "m" on its own (without Ctrl) converts a cell to markdown when in command mode.
> - It would be nice to have a similar shortcut for the "reverse" operation "convert current cell to code cell and remain in edit mode". I would have suggested "Ctrl-y" for this (due to the same mnemonic reason, since "y" alone has the same meaning in command mode). But this is already used for "redo". But I'd be happy with any other shortcut, too.
> Apologies for this long email for such a simple request. Thanks for reading, and thanks for considering it!
> Best wishes,
> Max
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

More information about the IPython-dev mailing list