jupyter-vim-binding icon indicating copy to clipboard operation
jupyter-vim-binding copied to clipboard

RFC: Jump and focus to a previous/next cell by some keyboard shortcut (<C-o><C-o> ?)

Open rsdenijs opened this issue 9 years ago • 5 comments

When I am working I often realize i need to do some import.
Then i scroll up (ctrl-o, gg), add the import and go want to go back to the previous cell with some shortcut. Is there any way to achieve something similar? Maybe through cell markers?

rsdenijs avatar Apr 22 '16 11:04 rsdenijs

It would be really nice feature thanks ;-) I often face similar situation as well.

The following is just an idea, what do you think about it

  • Record the history of which cell user was in by focus or blur event
  • Jump forward/backward the history and focus the cell by <C-o><C-i> and <C-o><C-o> like <C-i> and <C-o> jumps in a native Vim.

If I implement that feature, what you need to do is just hit <C-o><C-o> after.

It would be a bit hard to implement while I need to consider how to handle history correctly so please wait or send me a PR ;-)

lambdalisue avatar Apr 23 '16 03:04 lambdalisue

So to jump 2 steps in history we would do <C-o><C-o>, <C-o><C-o> ? In a bit more general setting, would it make sense to use cell metadata to store history/markers? Then they would even work after reloading. Going to cell with marker 'a' could then be <C-o> ' a.

rsdenijs avatar Apr 25 '16 07:04 rsdenijs

Sorry for late reply.

So to jump 2 steps in history we would do , ?

I think <C-o><C-o> + <C-o><C-o>

In a bit more general setting, would it make sense to use cell metadata to store history/markers? Then they would even work after reloading. Going to cell with marker 'a' could then be ' a.

I agree that it would be nice but the problem is it is a bit difficult to implement while there is no such feature in CodeMirror/Jupyter. That's why I just hit an idea which I explained.

lambdalisue avatar Apr 29 '16 10:04 lambdalisue

Sorry I missed the code block in my last comment, i was expecting that key sequence exactly.

Ok now I understand that keeping a history of cells might be tricky. I would like to learn a bit more about how the javascript of Jupyter works. Do you know of a good place to get started?

rsdenijs avatar Apr 29 '16 12:04 rsdenijs

Sorry I missed the code block in my last comment, i was expecting that key sequence exactly.

I see ;-)

Ok now I understand that keeping a history of cells might be tricky. I would like to learn a bit more about how the javascript of Jupyter works. Do you know of a good place to get started?

No. I learned that from the code of Jupyter itself. But it is quite clear so I'm sure that you will get the image pretty soon by reading the source code ;-)

lambdalisue avatar Apr 30 '16 07:04 lambdalisue