jupyterlab-vim icon indicating copy to clipboard operation
jupyterlab-vim copied to clipboard

Option to start clicked cells in insert mode

Open tlkaufmann opened this issue 5 years ago • 5 comments

I love this extension, thanks a ton!

When clicking in any given cell it places the cursor in Vim mode. Is there an option to change this default to insert mode?

Thanks in advance

tlkaufmann avatar May 08 '19 08:05 tlkaufmann

I second this! After reading the index.ts, it looks like MAYBE this can be done by commenting out line 64? I'm not sure, I can't get it to run in jupyter lab because I don't know how to compile and load it lol.

Honestly, this makes copying and pasting from cells into sublime a real pain in the butt because I'm used to just clicking a cell, doing control+a, then control+c. But control+a doesn't work unless you're in insert mode, so I press: control a, control c, realize it didn't work, press i, press control+a, press control+c, and then I've copied a cell.

Line 64:

SqrtRyan avatar Oct 14 '20 01:10 SqrtRyan

Hi both,

from a vim user perspective wishing for the default to be insert mode seems a bit odd to me. Why do you want to use the vim extension in the first place, then? But I obviously don't mean to oppose an option to manually change the default behaviour, as long as it is not changed generally for everybody.

Regarding specifically your copy-paste example, @SqrtRyan, since ctrl+a is not a vim keybinding, I feel like this is not a good motivation for changing the default behaviour of a vim extension. The vim way of "select all" is ggVG. After that you can copy/yank with y if you're staying within jupyter lab or use ctrl+c in your case to paste to sublime.

lukashergt avatar Oct 14 '20 02:10 lukashergt

First of all, thank you for responding so quickly! :)

I really love using this VIM plugin for when I need to do tons of text editing in a single cell. That's why I love using this plugin...but I'm not a vim purist. I really only need to use the NAV mode when I'm doing heavy editing on a single cell, which for me is less than a quarter of the time I click a cell (most of the time, when I use the mouse, it's because I'm copying and pasting).

I know you can do ggVG, but not only is that more typing, but when I switch between that and the jupyter console (which doesn't have vim keybindings) it's confusing and it trips me up because I'm so used to control+a etc. It's really annoying to need so many keystrokes when I need to copy, say, 10 cells to sublime text. I don't use this plugin because I love vim keybindings...I use it because it saves me time lol. When the vim keybindings get more verbose than the originals (control+a vs ggVg, or (click) i control-v vs just (click)control-v), it makes me loose time.

(On the same note of verbosity, I also wish there was a way to exit the cell's edit mode with something other than :wq, perhaps hitting escape twice in NAV mode, as (at least on my computer) :wq often lags a little, taking up to half a second on my computer sometimes - just waiting for the : prompt to show up so I can type wq(enter)). I wanted to ask if it would be possible to add an option such that when you hit 'escape' in NAV mode, it exits the cell in the same way :wq(enter) does? (I'm not sure if this is the right place to ask though, so I could make a separate issue for this if you'd like)

Thank you, Ryan

SqrtRyan avatar Oct 14 '20 03:10 SqrtRyan

Oh, on a sidenote - the author of Vintageous (the vim plugin for sublime) originally had a similar argument to making nav mode the default when switching tabs in Sublime, but eventually added an option earlier this year to make insert mode the default. I changed it right away because I really like starting in insert mode, and having VIM as an option I opt for rather than the default :)

SqrtRyan avatar Oct 14 '20 03:10 SqrtRyan

Oh, another sidenote - I think one possibility that would make everybody happy might be to retain whatever mode you had before you clicked off the cell, and use that. For example, if I was in NAV mode before clicking out of the cell, the next time I click into a cell it should still be in NAV mode. Likewise, if I was in INSERT mode before clikcing out of a cell, the next cell I click into would also be in INSERT mode.

I believe this is the way Google Colab works when you set their keybindings to VIM mode, so it's not without precedent

SqrtRyan avatar Oct 14 '20 03:10 SqrtRyan