marimo icon indicating copy to clipboard operation
marimo copied to clipboard

Vim mode exits command mode when moving between cells

Open anjiro opened this issue 1 year ago • 2 comments

Describe the bug

Using Vim mode is great, but when I go between cells, I get dropped back into command mode. For example, if I have two cells:

#Cell 1
print("Here is some stuff")
x = 5

#Cell 2
print("This is cell 2")

If I'm in command mode in cell 2 and want to get to the first line in cell one, I hit kk on my keyboard. What I end up with is the cursor on the bottom line of cell 1 which now reads kx = 5.

This doesn't always happen but seems to mostly when I'm holding down j or k to quickly navigate between chunks of code.

Environment

{
  "marimo": "0.3.0",
  "OS": "Darwin",
  "OS Version": "23.3.0",
  "Processor": "arm",
  "Python Version": "3.11.2",
  "Binaries": {
    "Chrome": "122.0.6261.94",
    "Node": "v21.6.2"
  },
  "Requirements": {
    "black": "23.12.1",
    "click": "8.1.3",
    "jedi": "0.18.2",
    "pymdown-extensions": "10.7",
    "starlette": "0.36.1",
    "tomlkit": "0.12.3",
    "typing_extensions": "4.9.0",
    "uvicorn": "0.27.0.post1"
  }
}

Code to reproduce

No response

anjiro avatar Mar 06 '24 17:03 anjiro

Currently Vim mode is set on a per-cell basis - I guess i see no harm in setting it for all cells and keeping them in sync

mscolnick avatar Mar 06 '24 19:03 mscolnick

Yes, please! That fits with the mental model of Vim—that when you are in command mode, you are in command mode, no matter where you move the cursor. It should only ever drop into insert mode when I ask it to, and vice-versa for insert to command mode.

anjiro avatar Mar 07 '24 09:03 anjiro