jwkvam / jupyterlab-vim

:neckbeard: Vim notebook cell bindings for JupyterLab
MIT License
973 stars 73 forks source link

Toggle cell output #74

Open foonwong opened 5 years ago

foonwong commented 5 years ago

Is there a key to toggle cell output?

BTW, I would like to thank everyone who made this awesome extension happen.

jwkvam commented 5 years ago

There are commands to expand and collapse cell outputs but currently they are not bound to anything. There doesn't appear to be any commands to toggle outputs nor toggle inputs. I think we could make those. It might be good to get them upstream though.

I'm not sure what keybinding to use. I use Tab in vim to toggle folds. Maybe other people would find that agreeable :stuck_out_tongue_closed_eyes: What keybind would you like to use @foonwong?

sirex commented 5 years ago

I think vim's fold commands can be used to toggle code and output:

                                   (1)      (2)      (3)
notebook:hide-cell-code            Z c  or  Z a  or  z c
notebook:show-cell-code            Z o  or  Z a  or  z c
notebook:hide-all-cell-code        Z C  or  Z A  or  z C
notebook:show-all-cell-code        Z O  or  Z A  or  z C

notebook:hide-cell-outputs         z c  or  z a  or  z o
notebook:show-cell-outputs         z o  or  z a  or  z o
notebook:hide-all-cell-outputs     z C  or  z A  or  z O
notebook:show-all-cell-outputs     z O  or  z A  or  z O

notebook:enable-output-scrolling                     z s
notebook:disable-output-scrolling                    z s

I don't know if it is possible to toggle cells, because I could only find hiding and showing, but no toggling.

If toggling is possible third option would be most convenient.

https://neovim.io/doc/user/fold.html

https://github.com/jupyterlab/jupyterlab/blob/89e7251fbb83ecfeff879032e7fb3c2f8fea27e3/packages/notebook-extension/src/index.ts#L180-L198