-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove "dd" key binding? #4765
Comments
As a vim user I have also found these key-bindings surprising, and I don't particularly like them for the reasons you have laid out, @mgeier. That being said, one of our core goals for JupyterLab right now is feature parity with the classic notebook, which does use these commands. For that reason I don't think we should change them by default right now. We do have the ability for users to change the keyboard shortcuts for various commands using the Advanced Settings Editor, and it is possible to make all of the changes you suggest on a per-user basis ( Finally, I will note that there is a nice project for adding vim-like bindings to notebooks in JupyterLab which you may or may not be aware of: https://github.com/jwkvam/jupyterlab-vim |
OK, I understand feature parity, but do we also want "bug parity"? I hope not! IMHO this is definitely a bug, but it can be seen in two different ways (with different solutions):
It's great that users can customize key bindings, but that makes it an even less severe change to remove the "dd" key binding. And yes, I already know |
I agree with @mgeier, this is super dangerous! As a vim user, my first instinct is to either paste the deleted cell or undo the action. Because of the difference in the shortcuts, it's really easy for a novice user to try pressing "u" in hopes of undoing the action (especially upon discovering that the cell is not stored in the clipboard). The ensuing panic and misclicks may very well render "z" futile... As it happened to me a few minutes ago! Although, instead of removing the "dd" shortcut by default altogether, I'd suggest:
Fortunately, the above is easily implemented on a custom setup, although I don't see why this can't be the default behavior. The following works for me, and I haven't discovered any conflicts so far (should be inserted into Settings -> Advanced Settings Editor -> Keyboard Shortcuts -> User Preferences [the right panel]):
(I added "P" and "Shift P" for paste-below and paste-above behavior, respectively, to match that of vim -- again seems like there are no conflicts.) |
This aligns with what would be expected from vim and makes it more difficult for a user to accidently lose work. Fixes jupyterlab#4765
As far as I can tell these don't conflict with any existing shortcuts. This also adds the ability to paste above, which was missing from the default shortcuts. Based on jupyterlab#4765 (comment)
This aligns with what would be expected from vim and makes it more difficult for a user to accidently lose work. Fixes jupyterlab#4765
As far as I can tell these don't conflict with any existing shortcuts. This also adds the ability to paste above, which was missing from the default shortcuts. Based on jupyterlab#4765 (comment)
This aligns with what would be expected from vim and makes it more difficult for a user to accidently lose work. Fixes jupyterlab#4765
As far as I can tell these don't conflict with any existing shortcuts. This also adds the ability to paste above, which was missing from the default shortcuts. Based on jupyterlab#4765 (comment)
This aligns with what would be expected from vim and makes it more difficult for a user to accidently lose work. Fixes jupyterlab#4765
As far as I can tell these don't conflict with any existing shortcuts. This also adds the ability to paste above, which was missing from the default shortcuts. Based on jupyterlab#4765 (comment)
This aligns with what would be expected from vim and makes it more difficult for a user to accidently lose work. Fixes jupyterlab#4765
As far as I can tell these don't conflict with any existing shortcuts. This also adds the ability to paste above, which was missing from the default shortcuts. Based on jupyterlab#4765 (comment)
As far as I can tell these don't conflict with any existing shortcuts. This also adds the ability to paste above, which was missing from the default shortcuts. Based on jupyterlab#4765 (comment)
This aligns with what would be expected from vim and makes it more difficult for a user to accidently lose work. Fixes jupyterlab#4765
As far as I can tell these don't conflict with any existing shortcuts. This also adds the ability to paste above, which was missing from the default shortcuts. Based on jupyterlab#4765 (comment)
For JL 3 and 4, the notebook shortcuts are in the jupyterlab-vim plugin, and d, d binding cuts cells as proposed. I believe this issue can be closed now? |
That's great news! I can confirm that However, |
I really love that it is possible to move down and up between cells with "j" and "k"! I use this all the time!
It was't a surprise to me as a long-time Vim user, that I can remove cells with "dd", just like I can use it to remove lines in Vim.
Then, however, the next logical thing would be to use "p" (which is supposed to mean "put") to re-insert the cell that I removed with "dd" back in after the current cell. This doesn't work, though.
Even worse, once I realize that I cannot get my deleted cell back, I immediately try to undo the deletion with "u" (which obviously is supposed to mean "undo"). But this doesn't work, either! (I later found out that the "undo" button is "z".)
If "dd" is supported, it would also make sense to support "yy" (short for "yank line", where "yank" is the Vim term for "copy"). This doesn't work either (but "c" can be used instead).
AFAICT, "j", "k", "dd" are the only Vim-like keys?
"dd" on its own doesn't make too much sense, so I think it should be either removed or it should be extended with "p" and "u" and probably "yy".
It looks like "yy", "p" and "u" have already the existing key bindings "c" (copy), "v" (paste) and "z" (undo).
I assume the idea of "c", "v" and "z" comes from the common key bindings "ctrl-c", "ctrl-v" and "ctrl-z", which I think is easy to teach to beginners.
In the end, it turns out that whenever I want to use "dd", I can as well use "x". This does the same thing with a minor difference: "dd" doesn't put the deleted cell into the clipboard and therefore it cannot be re-inserted later. But this behavior is inconsistent with what "dd" does in Vim, because there the deleted line will end up in the clipboard!
Long story short, I hereby suggest to remove "dd" from the key bindings.
The text was updated successfully, but these errors were encountered: