Key Bindings
Editing Modes
The key-bindings used when editing a cell or in the console are determined by the edit_mode
configuration variable. This can be set to micro
, emacs
or vim
to use key-bindings in the style of the respective text editor.
Custom Key Bindings
Key bindings can be customized by setting the key_bindings
configuration parameter.
This parameter takes the form of a mapping, where they keys are references to modes or components to which a set of key-bindings apply, and the values are mapping of command names to lists of keys.
Key bindings set in the configuration will entirely over-ride the default binding, so if you want to add an additional binding for a command while retaining the default, you will need to include the default binding in the configuration.
Below is an example Configuration File showing how the key-bindings can be set:
{
"notebook": {
"autoformat": false,
"expand": true,
"key_bindings": {
"euporie.notebook.app.NotebookApp": {
"quit": ["c-q", "c-p"],
"new-notebook": []
}
},
}
}
This example sets two key-bindings in the Notebook app for the quit command: Ctrl+Q and Ctrl+P. It also unsets any key-bindings for the new-notebook command.
Custom key-binding configuration can also be passed on the command line in the form of a JSON string:
$ euporie-notebook --key-bindings='{"euporie.notebook.app.NotebookApp": {"new-notebook": [],"quit": ["c-q", "c-p"]}}'
Valid component names include:
euporie.core.app.BaseApp
euporie.core.widgets.pager.Pager
euporie.core.widgets.inputs.KernelInput
euporie.core.key_binding.bindings.micro.EditMod
euporie.notebook.app.NotebookApp
euporie.notebook.tabs.notebook.Notebook
euporie.console.app.ConsoleApp
euporie.console.tabs.console.Console
euporie.preview.app.PreviewApp
Most command names are listed in Default Key Bindings Reference.
Running Cells
Cells can be run using Ctrl+Enter, or Shift+Enter to run and select the next cell, as is the case in JupyterLab.
However, most terminals do not distinguish between Enter, Ctrl+Enter & Shift+Enter by default, meaning that you have to use alternative key-bindings in euporie to run cells.
Fortunately it is possible to configure many terminals such that these key-bindings can be used, as outlined below.
Note
There are two commonly used formats of escape sequences which can be used to distinguish these key-bindings: FK-27 and CSI-u. The instructions below implement the CSI-u style, but euporie will recognise either.
WezTerm
Update your $HOME/.config/wezterm/wezterm.lua
file to include the following:
local wezterm = require 'wezterm';
return {
-- ...
keys = {
{key="Enter", mods="CTRL", action=wezterm.action{SendString="\x1b[13;5u"}},
{key="Enter", mods="SHIFT", action=wezterm.action{SendString="\x1b[13;2u"}},
},
}
Kitty
Add the following to your $HOME/.config/kitty/kitty.conf
file:
map ctrl+enter send_text normal,application \x1b[13;5u
map shift+enter send_text normal,application \x1b[13;2u
Foot
Foot supports XTerm’s K27 format, so does not require any additional configuration.
XTerm
You can add the following lines to your $HOME/.Xresources
file, which enables CSI-u escape sequences.
*vt100.modifyOtherKeys: 1
*vt100.formatOtherKeys: 1
Windows Terminal
You can add the key-bindings to your settings.json
file:
{
// ...
"keybindings":
[
{ "command": { "action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" },
{ "command": { "action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" }
]
}
Alacritty
You can define the key-binding in your $HOME/.config/alacritty/alacritty.yml
file as follows:
key_bindings:
- { key: Return, mods: Control, chars: "\x1b[13;5u" }
- { key: Return, mods: Shift, chars: "\x1b[13;2u" }
Konsole
In the menu, navigate to
, then select .Change the existing entry for Return+Shift to Return+Shift+Ctrl (or whatever you prefer), then add the following entries:
Key combination |
Output |
---|---|
Return+Ctrl |
E[13;5u |
Return+Shift |
E[13;2u |
Default Key Bindings Reference
The following lists outline the default key-bindings used in euporie:
All euporie apps
Keys |
Description |
Command |
---|---|---|
Ctrl+Q |
Quit euporie. |
quit |
Ctrl+W |
Cloe the current tab. |
close-tab |
Ctrl+Pagedown |
Switch to the next tab. |
next-tab |
Ctrl+Pageup |
Switch to the previous tab. |
previous-tab |
Shift+Tab |
Focus the next control. |
focus-next |
Tab Ctrl+I |
Focus the previous control. |
focus-previous |
Ctrl+L |
Clear the screen and the previous output. |
clear-screen |
Tab Ctrl+I |
Show the completion menu and select the next completion. |
next-completion |
Shift+Tab |
Show the completion menu and select the previous completion. |
previous-completion |
Escape |
Cancel a completion. |
cancel-completion |
Enter Ctrl+M |
Accept a selected completion. |
accept-completion |
Ctrl+O |
Open a file. |
open-file |
Alt+S |
Save the current file at a new location. |
save-as |
Ctrl+Space Ctrl+@ |
Show the command palette. |
show-command-palette |
Ctrl+F F3 F7 |
Enter search mode. |
find |
Ctrl+G |
Find the next search match. |
find-next |
Ctrl+P |
Find the previous search match. |
find-previous |
Base class for interface tabs
Keys |
Description |
Command |
---|---|---|
Ctrl+S |
Save the current file. |
save-file |
F5 |
Reet the current tab, reloading contents from source. |
reset-tab |
Notebook app
Keys |
Description |
Command |
---|---|---|
Ctrl+B |
Open or close the current side-bar pane. |
toggle-side-bar-pane |
Ctrl+N |
Create a new file. |
new-notebook |
Alt+M |
Toggle the value of the “show_top_bar” configuration option. |
toggle-show-top-bar |
Interactive notebooks
Keys |
Description |
Command |
---|---|---|
Enter Ctrl+M |
Enter cell edit mode. |
enter-cell-edit-mode |
Escape |
Exit cell edit mode. |
exit-edit-mode |
Ctrl+Enter Ctrl+E |
Run or render the current cells. |
run-selected-cells |
Shift+Enter Ctrl+R |
Run or render the current cells and select the next cell. |
run-and-select-next |
Alt+Ctrl+M |
Run or render the current cells and insert a new cell below. |
run-cell-and-insert-below |
A |
Add a new cell above the current. |
add-cell-above |
B |
Add a new cell below the current. |
add-cell-below |
D, D |
Delete the current cells. |
delete-cells |
Z |
Undelete the last deleted cells. |
undelete-cells |
X |
Cut the current cells. |
cut-cells |
C |
Copy the current cells. |
copy-cells |
Alt+C |
Copy the cell’s output to the clipboard. |
copy-outputs |
V |
Pate the previously copied cells. |
paste-cells |
I, I |
Interrupt the notebook’s kernel. |
interrupt-kernel |
0, 0 |
Restart the notebook’s kernel. |
restart-kernel |
[ <Scroll-Up> |
Scroll the page up a line. |
scroll-up |
] <Scroll-Down> |
Scroll the page down a line. |
scroll-down |
{ |
Scroll the page up 5 lines. |
scroll-up-5-lines |
} |
Scroll the page down 5 lines. |
scroll-down-5-lines |
Home Ctrl+Up |
Select the first cell in the notebook. |
select-first-cell |
Pageup |
Go up 5 cells. |
select-5th-previous-cell |
Up K |
Go up one cell. |
select-previous-cell |
Down J |
Select the next cell. |
select-next-cell |
Pagedown |
Go down 5 cells. |
select-5th-next-cell |
End Ctrl+Down |
Select the last cell in the notebook. |
select-last-cell |
Ctrl+A |
Select all cells in the notebook. |
select-all-cells |
Shift+Home |
Extend the cell selection to the top of the notebook. |
extend-cell-selection-to-top |
Shift+Up Shift+K |
Extend the cell selection up a cell. |
extend-cell-selection-up |
Shift+Down Shift+J |
Extend the cell selection down a cell. |
extend-cell-selection-down |
Shift+End |
Extend the cell selection to the bottom of the notebook. |
extend-cell-selection-to-bottom |
Alt+Up |
Move selected cells up. |
move-cells-up |
Alt+Down |
Move selected cells down. |
move-cells-down |
M |
Change selected cells to markdown cells. |
cells-to-markdown |
Y |
Change selected cells to code cells. |
cells-to-code |
R |
Change selected cells to raw cells. |
cells-to-raw |
F |
Format the selected code cells. |
reformat-cells |
Shift+F |
Automatically reformat all code cells in the notebook. |
reformat-notebook |
E |
Edit cell in $EDITOR. |
edit-in-external-editor |
Shift+M |
Merge the selected cells. |
merge-cells |
Ctrl+\ |
Split the current cell at the cursor position. |
split-cell |
Up |
Move the cursor up to the previous cell. |
edit-previous-cell |
Down |
Move the cursor down to the next cell. |
edit-next-cell |
Left |
Scroll the cell output to the left. |
scroll-output-left |
Right |
Scroll the cell output to the right. |
scroll-output-right |
W |
Toggle the value of the “expand” configuration option. |
toggle-expand |
L |
Toggle line numbers when a buffer does not have focus. |
notebook-toggle-line-numbers |
Conole app
Keys |
Description |
Command |
---|---|---|
Ctrl+C |
Clear the console input. |
clear-input |
Ctrl+Enter Ctrl+E |
Run the console input. |
run-input |
Ctrl+Up |
Get the previous history entry. |
history-prev |
Ctrl+Down |
Get the next history entry. |
history-next |
Ctrl+L |
Clear the screen and the previous output. |
clear-screen |
Ctrl+D |
Signals the end of the input, causing the console to exit. |
end-of-file |
Interactive console
Keys |
Description |
Command |
---|---|---|
Ctrl+C |
Interrupt the notebook’s kernel. |
cc-interrupt-kernel |
Shift+Tab |
Display contextual help. |
show-contextual-help |
Preview app
Keys |
Description |
Command |
---|---|---|
Ctrl+C Ctrl+Q |
Quit euporie. |
quit |
Micro style editor key-bindings
Keys |
Description |
Command |
---|---|---|
<Any> |
Enter a key. |
type-key |
Right |
Move forward a character, or down a line. |
move-cursor-right |
Left |
Move back a character, or up a line. |
move-cursor-left |
Enter Ctrl+M |
Inert a new line, replacing any selection and indenting if appropriate. |
newline |
Enter Ctrl+M |
Accept an input. |
accept-line |
Backspace Ctrl+H Backspace Ctrl+H |
Delete the character behind the cursor. |
backspace |
Ctrl+Backspace Alt+Ctrl+H Alt+Ctrl+H |
Delete the word behind the cursor, using whitespace as a word boundary. |
backward-kill-word |
Shift+Up Shift+Down Shift+Right Shift+Left Alt+Shift+Left Alt+Shift+Right Ctrl+Shift+Left Ctrl+Shift+Right Shift+Home Shift+End Ctrl+Shift+Home Ctrl+Shift+End |
Start a new selection. |
start-selection |
Shift+Up Shift+Down Shift+Right Shift+Left Alt+Shift+Left Alt+Shift+Right Ctrl+Shift+Left Ctrl+Shift+Right Shift+Home Shift+End Ctrl+Shift+Home Ctrl+Shift+End |
Extend the selection. |
extend-selection |
Up Down Right Left Alt+Left Alt+Right Ctrl+Left Ctrl+Right Home End Ctrl+Home Ctrl+End |
Cancel the selection. |
cancel-selection |
<Any> |
Replace selection by what is typed. |
replace-selection |
Delete Backspace Ctrl+H Backspace Ctrl+H |
Delete the contents of the current selection. |
delete-selection |
Ctrl+Left Alt+B |
Move back to the start of the current or previous word. |
backward-word |
Ctrl+Right Alt+F |
Move forward to the end of the next word. |
forward-word |
Alt+Up |
Move the current or selected lines up by one line. |
move-lines-up |
Alt+Down |
Move the current or selected lines down by one line. |
move-lines-down |
Home Alt+Left Alt+A |
Move the cursor to the start of the line. |
go-to-start-of-line |
End Alt+Right Alt+E |
Move the cursor to the end of the line. |
go-to-end-of-line |
Ctrl+Up Ctrl+Home |
Move to the start of the buffer. |
beginning-of-buffer |
Ctrl+Down Ctrl+End |
Move to the end of the buffer. |
end-of-buffer |
Alt+{ |
Move the cursor to the start of the current paragraph. |
go-to-start-of-paragraph |
Alt+} |
Move the cursor to the end of the current paragraph. |
go-to-end-of-paragraph |
Tab Ctrl+I |
Inndent the current or selected lines. |
indent-lines |
Backspace Ctrl+H |
Unindent the current or selected lines. |
unindent-line |
Shift+Tab |
Unindent the current or selected lines. |
unindent-lines |
Ctrl+Z |
Undo the last edit. |
undo |
Ctrl+Y |
Redo the last edit. |
redo |
Ctrl+C |
Add the current selection to the clipboard. |
copy-selection |
Ctrl+X Shift+Delete |
Remove the current selection and adds it to the clipboard. |
cut-selection |
Ctrl+K |
Remove the current line adds it to the clipboard. |
cut-line |
Ctrl+D |
Duplicate the current line. |
duplicate-line |
Ctrl+D |
Duplicate the current selection. |
duplicate-selection |
Ctrl+V |
Pate the clipboard contents, replacing any current selection. |
paste-clipboard |
Ctrl+A |
Select all text. |
select-all |
Pageup |
Scroll page up. |
scroll-page-up |
Pagedown |
Scroll page down. |
scroll-page-down |
Delete |
Delete character before the cursor. |
delete |
F4 |
Toggle the case of the current word or selection. |
toggle-case |
Insert |
Toggle overwrite when using micro editing mode. |
toggle-overwrite-mode |
Ctrl+U |
Start recording a macro. |
start-macro |
Ctrl+U |
Stop recording a macro. |
end-macro |
Ctrl+J |
Re-execute the last keyboard macro defined. |
run-macro |
Right Ctrl+F |
Accept suggestion. |
accept-suggestion |
Alt+F |
Fill partial suggestion. |
fill-sugestion |
Ctrl+/ Ctrl+_ |
Comment or uncomments the current or selected lines. |
toggle-comment |
Alt+( Alt+) |
Go to matching bracket if the cursor is on a paired bracket. |
go-to-matching-bracket |
" |
Wraps the current selection with: “” |
wrap-selection-"" |
' |
Wraps the current selection with: ‘’ |
wrap-selection-'' |
( ) |
Wraps the current selection with: () |
wrap-selection-() |
{ } |
Wraps the current selection with: {} |
wrap-selection-{} |
[ ] |
Wraps the current selection with: [] |
wrap-selection-[] |
` |
Wraps the current selection with: `` |
wrap-selection-`` |
* |
Wraps the current selection with: ** |
wrap-selection-** |
_ |
Wraps the current selection with: __ |
wrap-selection-__ |
Interactive help pager
Keys |
Description |
Command |
---|---|---|
Escape Q |
Cloe the pager. |
close-pager |
Kernel input text areas
Keys |
Description |
Command |
---|---|---|
Shift+Tab |
Display contextual help. |
show-contextual-help |
Rich output displays
Keys |
Description |
Command |
---|---|---|
Left |
Scroll the display up one line. |
scroll-display-left |
Right |
Scroll the display down one line. |
scroll-display-right |
Up K |
Scroll the display up one line. |
scroll-display-up |
Down J |
Scroll the display down one line. |
scroll-display-down |
Pageup |
Scroll the display up one page. |
page-up-display |
Pagedown |
Scroll the display down one page. |
page-down-display |
Home |
Scroll the display to the top. |
go-to-start-of-display |
End |
Scroll the display down one page. |
go-to-end-of-display |
Web view displays
Keys |
Description |
Command |
---|---|---|
Left |
Scroll the display up one line. |
scroll-webview-left |
Right |
Scroll the display down one line. |
scroll-webview-right |
Up K |
Scroll the display up one line. |
scroll-webview-up |
Down J |
Scroll the display down one line. |
scroll-webview-down |
Pageup |
Scroll the display up one page. |
page-up-webview |
Pagedown |
Scroll the display down one page. |
page-down-webview |
Home |
Scroll the display to the top. |
go-to-start-of-webview |
End |
Scroll the display down one page. |
go-to-end-of-webview |
Alt+Left |
Navigate backwards in the browser history. |
webview-nav-prev |
Alt+Right |
Navigate forwards in the browser history. |
webview-nav-next |
Default Key-binding configuration
The following lists all of the default key-bindings used in euporie in the format required for custom key-bindings in the configuration file.
{
"euporie.core.app.BaseApp": {
"quit": "c-q",
"close-tab": "c-w",
"next-tab": "c-pagedown",
"previous-tab": "c-pageup",
"focus-next": "s-tab",
"focus-previous": "tab",
"clear-screen": "c-l",
"next-completion": "c-i",
"previous-completion": "s-tab",
"cancel-completion": "escape",
"accept-completion": "enter",
"open-file": "c-o",
"save-as": [
"escape",
"s"
],
"show-command-palette": "c-@",
"find": [
"c-f",
"f3",
"f7"
],
"find-next": "c-g",
"find-previous": "c-p"
},
"euporie.core.tabs.base.Tab": {
"save-file": "c-s",
"reset-tab": "f5"
},
"euporie.notebook.app.NotebookApp": {
"toggle-side-bar-pane": "c-b",
"new-notebook": "c-n",
"toggle-show-top-bar": [
"escape",
"m"
]
},
"euporie.notebook.tabs.notebook.Notebook": {
"enter-cell-edit-mode": "enter",
"exit-edit-mode": "escape",
"run-selected-cells": [
"c-enter",
"c-e"
],
"run-and-select-next": [
"s-enter",
"c-r"
],
"run-cell-and-insert-below": [
"escape",
"enter"
],
"add-cell-above": "a",
"add-cell-below": "b",
"delete-cells": [
"d",
"d"
],
"undelete-cells": "z",
"cut-cells": "x",
"copy-cells": "c",
"copy-outputs": [
"escape",
"c"
],
"paste-cells": "v",
"interrupt-kernel": [
"i",
"i"
],
"restart-kernel": [
"0",
"0"
],
"scroll-up": [
"[",
"<scroll-up>"
],
"scroll-down": [
"]",
"<scroll-down>"
],
"scroll-up-5-lines": "{",
"scroll-down-5-lines": "}",
"select-first-cell": [
"home",
"c-up"
],
"select-5th-previous-cell": "pageup",
"select-previous-cell": [
"up",
"k"
],
"select-next-cell": [
"down",
"j"
],
"select-5th-next-cell": "pagedown",
"select-last-cell": [
"end",
"c-down"
],
"select-all-cells": "c-a",
"extend-cell-selection-to-top": "s-home",
"extend-cell-selection-up": [
"s-up",
"K"
],
"extend-cell-selection-down": [
"s-down",
"J"
],
"extend-cell-selection-to-bottom": "s-end",
"move-cells-up": [
"escape",
"up"
],
"move-cells-down": [
"escape",
"down"
],
"cells-to-markdown": "m",
"cells-to-code": "y",
"cells-to-raw": "r",
"reformat-cells": "f",
"reformat-notebook": "F",
"edit-in-external-editor": "e",
"merge-cells": "M",
"split-cell": "c-\\",
"edit-previous-cell": "up",
"edit-next-cell": "down",
"scroll-output-left": "left",
"scroll-output-right": "right",
"toggle-expand": "w",
"notebook-toggle-line-numbers": "l"
},
"euporie.console.app.ConsoleApp": {
"clear-input": "c-c",
"run-input": [
"c-enter",
"c-e"
],
"history-prev": "c-up",
"history-next": "c-down",
"clear-screen": "c-l",
"end-of-file": "c-d"
},
"euporie.console.tabs.console.Console": {
"cc-interrupt-kernel": "c-c",
"show-contextual-help": "s-tab"
},
"euporie.preview.app.PreviewApp": {
"quit": [
"c-c",
"c-q"
]
},
"euporie.core.key_binding.bindings.micro.EditMode": {
"type-key": "<any>",
"move-cursor-right": "right",
"move-cursor-left": "left",
"newline": "enter",
"accept-line": "enter",
"backspace": [
"backspace",
"c-h"
],
"backward-kill-word": [
"c-backspace",
[
"escape",
"backspace"
],
[
"escape",
"c-h"
]
],
"start-selection": [
"s-up",
"s-down",
"s-right",
"s-left",
[
"escape",
"s-left"
],
[
"escape",
"s-right"
],
"c-s-left",
"c-s-right",
"s-home",
"s-end",
"c-s-home",
"c-s-end"
],
"extend-selection": [
"s-up",
"s-down",
"s-right",
"s-left",
[
"escape",
"s-left"
],
[
"escape",
"s-right"
],
"c-s-left",
"c-s-right",
"s-home",
"s-end",
"c-s-home",
"c-s-end"
],
"cancel-selection": [
"up",
"down",
"right",
"left",
[
"escape",
"left"
],
[
"escape",
"right"
],
"c-left",
"c-right",
"home",
"end",
"c-home",
"c-end"
],
"replace-selection": "<any>",
"delete-selection": [
"delete",
"backspace",
"c-h"
],
"backward-word": [
"c-left",
[
"escape",
"b"
]
],
"forward-word": [
"c-right",
[
"escape",
"f"
]
],
"move-lines-up": [
"escape",
"up"
],
"move-lines-down": [
"escape",
"down"
],
"go-to-start-of-line": [
"home",
[
"escape",
"left"
],
[
"escape",
"a"
]
],
"go-to-end-of-line": [
"end",
[
"escape",
"right"
],
[
"escape",
"e"
]
],
"beginning-of-buffer": [
"c-up",
"c-home"
],
"end-of-buffer": [
"c-down",
"c-end"
],
"go-to-start-of-paragraph": [
"escape",
"{"
],
"go-to-end-of-paragraph": [
"escape",
"}"
],
"indent-lines": "tab",
"unindent-line": "backspace",
"unindent-lines": "s-tab",
"undo": "c-z",
"redo": "c-y",
"copy-selection": "c-c",
"cut-selection": [
"c-x",
"s-delete"
],
"cut-line": "c-k",
"duplicate-line": "c-d",
"duplicate-selection": "c-d",
"paste-clipboard": "c-v",
"select-all": "c-a",
"scroll-page-up": "pageup",
"scroll-page-down": "pagedown",
"delete": "delete",
"toggle-case": "f4",
"toggle-overwrite-mode": "insert",
"start-macro": "c-u",
"end-macro": "c-u",
"run-macro": "c-j",
"accept-suggestion": [
"right",
"c-f"
],
"fill-sugestion": [
"escape",
"f"
],
"toggle-comment": "c-_",
"go-to-matching-bracket": [
[
"escape",
"("
],
[
"escape",
")"
]
],
"wrap-selection-\"\"": "\"",
"wrap-selection-''": "'",
"wrap-selection-()": [
"(",
")"
],
"wrap-selection-{}": [
"{",
"}"
],
"wrap-selection-[]": [
"[",
"]"
],
"wrap-selection-``": "`",
"wrap-selection-**": "*",
"wrap-selection-__": "_"
},
"euporie.core.widgets.pager.Pager": {
"close-pager": [
"escape",
"q"
]
},
"euporie.core.widgets.inputs.KernelInput": {
"show-contextual-help": "s-tab"
},
"euporie.core.widgets.display.Display": {
"scroll-display-left": "left",
"scroll-display-right": "right",
"scroll-display-up": [
"up",
"k"
],
"scroll-display-down": [
"down",
"j"
],
"page-up-display": "pageup",
"page-down-display": "pagedown",
"go-to-start-of-display": "home",
"go-to-end-of-display": "end"
},
"euporie.web.widgets.webview.WebViewControl": {
"scroll-webview-left": "left",
"scroll-webview-right": "right",
"scroll-webview-up": [
"up",
"k"
],
"scroll-webview-down": [
"down",
"j"
],
"page-up-webview": "pageup",
"page-down-webview": "pagedown",
"go-to-start-of-webview": "home",
"go-to-end-of-webview": "end",
"webview-nav-prev": [
"escape",
"left"
],
"webview-nav-next": [
"escape",
"right"
]
}
}