Skip to content

Commit

Permalink
Readme cleanup (#154)
Browse files Browse the repository at this point in the history
* Initial cleanup

* Lint

* Abbreviate `cmd`, revise "change cell type" binding description to follow JL and revise `Shift` description

* Reorder key bindings so that corresponding Edit mode and Command mode bindings are in the same order

* More fixes
  • Loading branch information
firai authored Nov 25, 2024
1 parent c08147b commit 9b44041
Showing 1 changed file with 63 additions and 63 deletions.
126 changes: 63 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Notebook cell vim bindings

## Modes

Like vim, Jupyterlab has a distinction between edit mode and command mode. Jupyterlab Command mode is when the cursor is not in a specific cell, and edit mode when typing in a cell.
Like vim, Jupyterlab has a distinction between Edit mode and Command mode. Jupyterlab is in Command mode when the cursor is not in a specific cell, and it is in Edit mode when typing in a cell.

This extension combines the Jupyterlab (Edit and Command) modes with the standard vim modes (Normal, Insert, Visual). So the set of modes now looks like:
This extension combines the Jupyterlab (Edit and Command) modes with the standard vim modes (Normal, Insert and Visual). So the set of modes now looks like:

1. Jupyterlab Command Mode
2. Jupyterlab Edit Mode
- Insert
1. Jupyterlab Command mode
2. Jupyterlab Edit mode
- Normal
- Insert
- Visual

See [key bindings for switching between modes](#switching-between-modes).
Expand All @@ -44,66 +44,66 @@ mamba install -c conda-forge jupyterlab_vim

To learn how to modify key bindings see the [modify-keybinds.md](modify-keybinds.md) file.

**Please note that all keys are lowercase unless `Shift` is explicitly indicated.**
For example, `Y, Y` is two lowercase `y`s, `Shift-Y, Y` is one uppercase `Y` followed by a lowercase `y`.
**Please note that all keys are lowercase unless <kbd>Shift</kbd> is explicitly indicated.**
For example, "<kbd>Y</kbd>, <kbd>Y</kbd>" means pressing lowercase <kbd>y</kbd> twice, while "<kbd>Shift-Y</kbd>, <kbd>Y</kbd>" means pressing <kbd>Shift</kbd>+<kbd>y</kbd> followed by a lowercase <kbd>y</kbd>.

Shortcuts this extension introduces:
Shortcuts that this extension introduces:

### Vim Ex commands

| Command | Action |
| -------- | -------------------------- |
| :w[rite] | Save Notebook |
| :q[uit] | Enter Jupyter command mode |

### Vim command bindings

| Chord | Action |
| --------------- | ------------------------- |
| Ctrl-O, U | Undo Cell Action |
| - | Split Cell at Cursor |
| Ctrl-O, - | Split Cell at Cursor |
| Ctrl-O, D | Cut Cell |
| Ctrl-O, Y | Copy Cell |
| Ctrl-O, P | Paste Cell |
| Ctrl-Shift-J | Extend Marked Cells Below |
| Ctrl-Shift-K | Extend Marked Cells Above |
| Ctrl-O, O | Insert Cell Below |
| Ctrl-O, Ctrl-O | Insert Cell Above |
| Ctrl-J | Select Cell Below |
| Ctrl-K | Select Cell Above |
| Ctrl-O, G | Select First Cell |
| Ctrl-O, Ctrl-G | Select Last Cell |
| Ctrl-E | Move Cell Down |
| Ctrl-Y | Move Cell Up |
| Ctrl-O, Z, Z | Center Cell |
| Ctrl-G | Show Tooltip |
| Command/Ctrl-1 | Code Cell Mode |
| Command/Ctrl-2 | Markdown Cell Mode |
| Command/Ctrl-3 | Raw Cell Mode |
| Shift-Escape | Leave Vim Mode |
| Escape, Ctrl-\[ | Exit Vim Insert Mode |

### Jupyter command bindings

| Chord | Action |
| ------- | ------------------- |
| G, G | Select First Cell |
| Shift-G | Select Last Cell |
| D, D | Delete Cell |
| Y, Y | Yank (Copy) Cell |
| P | Paste Cell |
| Shift-P | Paste Cell Above |
| O | Insert Cell |
| Shift-O | Insert Cell Above |
| U | Undo Cell Action |
| Ctrl-E | Move Cells Down |
| Ctrl-Y | Move Cells Up |
| Z, Z | Center Cell |
| Z, C | Hide Code Cell |
| Z, O | Show Code Cell |
| Z, M | Hide All Code Cells |
| Z, R | Show All Code Cells |
| :q[uit] | Enter Jupyter Command Mode |

### Vim (Jupyter Edit mode) bindings

| Shortcut | Action |
| -------------- | ------------------------- |
| - | Split Cell at Cursor |
| Ctrl-O, - | Split Cell at Cursor |
| Ctrl-Shift-J | Extend Marked Cells Below |
| Ctrl-Shift-K | Extend Marked Cells Above |
| Ctrl-J | Select Cell Below |
| Ctrl-K | Select Cell Above |
| Ctrl-O, G | Select First Cell |
| Ctrl-O, Ctrl-G | Select Last Cell |
| Ctrl-O, O | Insert Cell Below |
| Ctrl-O, Ctrl-O | Insert Cell Above |
| Ctrl-O, D | Delete (Cut) Cell |
| Ctrl-O, Y | Yank (Copy) Cell |
| Ctrl-O, P | Paste Cell Below |
| Ctrl-E | Move Cell Down |
| Ctrl-Y | Move Cell Up |
| Ctrl-O, U | Undo Cell Action |
| Ctrl-O, Z, Z | Center Cell |
| Ctrl-G | Show Tooltip |
| Cmd/Ctrl-1 | Change to Code Cell |
| Cmd/Ctrl-2 | Change to Markdown Cell |
| Cmd/Ctrl-3 | Change to Raw Cell |
| Shift-Esc | Exit to Command Mode |
| Esc or Ctrl-\[ | Exit Current Mode |

### Jupyter Command mode bindings

| Shortcut | Action |
| -------- | ------------------- |
| G, G | Select First Cell |
| Shift-G | Select Last Cell |
| O | Insert Cell Below |
| Shift-O | Insert Cell Above |
| D, D | Delete (Cut) Cell |
| Y, Y | Yank (Copy) Cell |
| P | Paste Cell Below |
| Shift-P | Paste Cell Above |
| Ctrl-E | Move Cells Down |
| Ctrl-Y | Move Cells Up |
| U | Undo Cell Action |
| Z, Z | Center Cell |
| Z, C | Hide Code Cell |
| Z, O | Show Code Cell |
| Z, M | Hide All Code Cells |
| Z, R | Show All Code Cells |

### Switching between modes

Expand All @@ -114,11 +114,11 @@ Shortcuts this extension introduces:
- To leave Normal mode to Command mode, several options are available:
- <kbd>Shift</kbd>+<kbd>Esc</kbd>
- <kbd>Esc</kbd> or <kbd>Ctrl</kbd>+<kbd>[</kbd>, if the "Enable `Esc` and `Ctrl-[` leaving vim Normal mode to Jupyter Command mode" option is enabled (on by default). To disable the option, go to Settings menu → Settings Editor → Notebook Vim.
- To enter Insert mode from Normal mode, use one of the insert commmands, such as <kbd>i</kbd>, <kbd>I</kbd>, <kbd>a</kbd>, <kbd>A</kbd>, <kbd>o</kbd>, <kbd>O</kbd>, <kbd>c</kbd>, <kbd>C</kbd>, <kbd>s</kbd> or <kbd>S</kbd>.
- To enter Visual Mode from Normal mode, use one of the visual commands, such as <kbd>v</kbd>, <kbd>V</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd>.
- From Insert or Visual modes:
- To leave Insert or Visual modes to Normal Mode, press <kbd>Esc</kbd> or <kbd>Ctrl</kbd>+<kbd>[</kbd>.
- To leave Insert or Visual modes to Command Mode, press <kbd>Shift</kbd>+<kbd>Esc</kbd>.
- To enter Insert mode from Normal mode, use one of the insert commmands, such as <kbd>i</kbd>, <kbd>Shift</kbd>+<kbd>i</kbd>, <kbd>a</kbd>, <kbd>Shift</kbd>+<kbd>a</kbd>, <kbd>o</kbd>, <kbd>Shift</kbd>+<kbd>o</kbd>, <kbd>c</kbd>, <kbd>Shift</kbd>+<kbd>c</kbd>, <kbd>s</kbd> or <kbd>Shift</kbd>+<kbd>s</kbd>.
- To enter Visual mode from Normal mode, use one of the visual commands, such as <kbd>v</kbd>, <kbd>Shift</kbd>+<kbd>v</kbd> or <kbd>Ctrl</kbd>+<kbd>v</kbd>.
- From Insert or Visual mode:
- To leave Insert or Visual mode to Normal mode, press <kbd>Esc</kbd> or <kbd>Ctrl</kbd>+<kbd>[</kbd>.
- To leave Insert or Visual mode to Command mode, press <kbd>Shift</kbd>+<kbd>Esc</kbd>.

## Special Thanks

Expand Down

0 comments on commit 9b44041

Please sign in to comment.