hoishing / cell-navigation

cell-navigation plugin for Atom text editor, companion of Hydrogen / Jupytext
MIT License
5 stars 4 forks source link

Feature Request: Create Cell Shortcut #2

Closed HeisenbergK closed 4 years ago

HeisenbergK commented 4 years ago

Hello,

thanks for the great extension!!

Is there any way we can add a feature by which with a shortcut we create a cell?

That is in the current line, go to the beginning and write "# %% "

Would make life a little easier.

There might be such a thing, but I am really a rookie right now to know it.

Thanks!!

hoishing commented 4 years ago

I personally use code snippets to facilitate cell insertion, you may try add the following code in the .atom/snippets.cson file

'.source.python':
    'cell insert':
        'prefix': 'cell'
        'body': """
            # %%

        """

afterwards you can insert the cell by simply typing ce and enter

HeisenbergK commented 4 years ago

That's true, it's a genius solution! One thing I'd like to know is if we can make it insert the # %% at the beginning of the line, in case for example you come from within for-loops or defs and want to save yourself the trouble of the Shift-Tabs. I checked the atom documentation and flight manual on snippets and I can't find a way to put the snippet at the beginning of the respective line.

Thanks a lot BTW!!

hoishing commented 4 years ago

Maybe it cannot achieve by snippets. I normally did that by cmd left (mac) to place the cursor at the beginning of line.