jupyterlab-vim
jupyterlab-vim copied to clipboard
Vim cell commands
It'd be nice if Vim bindings could while in the notebook cell mode (not editing a cell). i.e., dd
deletes a celland
yy` copies a cell.
I keep on running into this bug from Jupyter notebook muscle memory. It'd be nice if installing this package meant that those keybindings were enabled (and yes, I could go into settings and change them all but this would be easier).
Thanks for the suggestion, I like this idea.
How would you feel if they were a single letter? So I would make the following mappings:
D
: cut cell
P
: paste below
Shift P
: paste above
Y
: yank cell
My main reason for this is I grew tired of double letter commands with jupyter-vim-binding at times and like the quickness with single letter commands. I think I would be more inclined to make it 'D D' if there are other motions that we could do with D. For example if we had 'D J' delete the current cell and the cell below.
I'd prefer the bindings to be the same as vim's actions for a single line. I don't need to learn another set of keybindings then.
Could we present a choice to the user? I think maybe a switch would be appropriate here.
I think others also preferred Ctrl-O D D
to just Ctrl-O D
for that reason. Yea, a switch would be nice. I haven't looked into what user configs extensions can create yet. I'll take a look at some point.
I'm really missing cell-level commands too.
I agree with @stsievert it's better them to be consistent with vim row-level bindings (at least by default). We're already using this bindings working with cells content, why use anything else on cell level?
I would mention gg
/ G
and visual mode for selecting and moving multiple cells at once.
Also I would be happy to have double esc
and ctrl + {
switching editor to cell-mode.
@imbolc Apologies for my delayed response and thanks for your feedback.
-
I'm working on something to add this feature in as a setting, perhaps defaulting to the double commands. In the meantime, you should be able to add them with the advanced settings editor.
-
Yes, I agree
gg
andG
would be good to implement. I'll open a separate issue to track this. -
Would your issues with selecting and moving multiple cells be solved with improving the cut and paste shortcuts? If not, I'd like to make a new issue for this. Ah I think you are looking for shortcuts that will move the current cell or selected cells up or down? I think that would be pretty slick.
-
Interesting idea. I'm not sure how easy the double escape would be. I think it may interfere with some of the existing handlers but I would need to investigate more. Is
ctrl-{
a vim shortcut or are you referring toctrl-[
? Or are you saying you would likectrl-shift-[
to go to cell-mode?
- I personally would be completely satisfied with
yy
,dd
,y
addd
with selected cells andp
- Sorry, I meant just
ctrl-[
I personally would be completely satisfied with yy, dd, y add d with selected cells and p
Same here. I would also suggest making yy
and dd
the default cell-level copy and cut commands to match with vim syntax, but a way to switch from that to just y
and d
for people who are interested would be nice. @jwkvam I understand the point you made above:
My main reason for this is I grew tired of double letter commands with jupyter-vim-binding at times and like the quickness with single letter commands.
However, one thing I ran into when I wasn't expecting this was something like this: I wanted to delete a cell, then scroll down with j
and paste it down lower. I typed CTRL-o dd
then held j
to start scrolling, but what this did is delete the cell after CTRL-o d
, then deleted the current line and line below it with dj
. I think other people with vim muscle memory would run into issues like this too.
Thanks for the great work on this @jwkvam!
Just found this issue after wanting this enough to go and do https://github.com/jwkvam/jupyterlab_vim/pull/28 :)
Since this is explicitly a vim extension I think we should stay as close as possible to vim muscle memory shortcuts and make it easy for people to customize if they want other commands. At least for me it'd majorly mess with my sanity if dd
deleted two cells.
Is it possible to "y3y" to yank three cells, and "p" to copy them. (the same goes with "d3d" where 3 is just some arbitrary number)