]> git.lizzy.rs Git - micro.git/blobdiff - runtime/help/keybindings.md
Syntax Highlight Overhaul (#568)
[micro.git] / runtime / help / keybindings.md
index a34ed57b77510f6eada5a4ee72214abcd91ad77a..70246e1a5bc6a5a250b03f64ed9dcf32f26a5b03 100644 (file)
@@ -1,90 +1,15 @@
 # Keybindings
 
-Here are the default keybindings in json form which is also how
-you can rebind them to your liking.
+Micro has a plethora of hotkeys that make it easy and powerful to use and all
+hotkeys are fully customizable to your liking.
+Custom keybindings are stored internally in micro if changed with the `>bind` command or
+you can also be added in the file `~/.config/micro/bindings.json` as discussed below.
+For a list of the default keybindings in the json format used by micro, please see
+the end of this file. For a more user-friendly list with explanations of what the default
+hotkeys are and what they do, please see `>help defaultkeys`
 
-```json
-{
-    "Up":             "CursorUp",
-    "Down":           "CursorDown",
-    "Right":          "CursorRight",
-    "Left":           "CursorLeft",
-    "ShiftUp":        "SelectUp",
-    "ShiftDown":      "SelectDown",
-    "ShiftLeft":      "SelectLeft",
-    "ShiftRight":     "SelectRight",
-    "AltLeft":        "WordLeft",
-    "AltRight":       "WordRight",
-    "AltShiftRight":  "SelectWordRight",
-    "AltShiftLeft":   "SelectWordLeft",
-    "AltUp"           "MoveLinesUp",
-    "AltDown"         "MoveLinesDown",
-    "CtrlLeft":       "StartOfLine",
-    "CtrlRight":      "EndOfLine",
-    "CtrlShiftLeft":  "SelectToStartOfLine",
-    "CtrlShiftRight": "SelectToEndOfLine",
-    "CtrlUp":         "CursorStart",
-    "CtrlDown":       "CursorEnd",
-    "CtrlShiftUp":    "SelectToStart",
-    "CtrlShiftDown":  "SelectToEnd",
-    "Enter":          "InsertNewline",
-    "Space":          "InsertSpace",
-    "CtrlH":          "Backspace",
-    "Backspace":      "Backspace",
-    "Alt-CtrlH":      "DeleteWordLeft",
-    "Alt-Backspace":  "DeleteWordLeft",
-    "Tab":            "IndentSelection,InsertTab",
-    "Backtab":        "OutdentSelection",
-    "CtrlO":          "OpenFile",
-    "CtrlS":          "Save",
-    "CtrlF":          "Find",
-    "CtrlN":          "FindNext",
-    "CtrlP":          "FindPrevious",
-    "CtrlZ":          "Undo",
-    "CtrlY":          "Redo",
-    "CtrlC":          "Copy",
-    "CtrlX":          "Cut",
-    "CtrlK":          "CutLine",
-    "CtrlD":          "DuplicateLine",
-    "CtrlV":          "Paste",
-    "CtrlA":          "SelectAll",
-    "CtrlT":          "AddTab",
-    "CtrlRightSq":    "PreviousTab",
-    "CtrlBackslash":  "NextTab",
-    "Home":           "StartOfLine",
-    "End":            "EndOfLine",
-    "CtrlHome":       "CursorStart",
-    "CtrlEnd":        "CursorEnd",
-    "PageUp":         "CursorPageUp",
-    "PageDown":       "CursorPageDown",
-    "CtrlG":          "ToggleHelp",
-    "CtrlR":          "ToggleRuler",
-    "CtrlL":          "JumpLine",
-    "Delete":         "Delete",
-    "CtrlB":          "ShellMode",
-    "CtrlQ":          "Quit",
-    "CtrlE":          "CommandMode",
-    "CtrlW":          "NextSplit",
-    "CtrlU":          "ToggleMacro",
-    "CtrlJ":          "PlayMacro",
-
-    // Emacs-style keybindings
-    "Alt-f": "WordRight",
-    "Alt-b": "WordLeft",
-    "Alt-a": "StartOfLine",
-    "Alt-e": "EndOfLine",
-    "Alt-p": "CursorUp",
-    "Alt-n": "CursorDown",
-
-    // Integration with file managers
-    "F1":  "ToggleHelp",
-    "F2":  "Save",
-    "F4":  "Quit",
-    "F7":  "Find",
-    "F10": "Quit",
-    "Esc": "Quit",
-}
-```
+If `~/.config/micro/bindings.json` does not exist, you can simply create it.
+Micro will know what to do with it.
 
 You can use the alt keys + arrows to move word by word.
 Ctrl left and right move the cursor to the start and end of the line, and
@@ -107,6 +32,9 @@ following in the `bindings.json` file.
 }
 ```
 
+In addition to editing your `~/.config/micro/bindings.json`, you can run
+`>bind <keycombo> <action>` For a list of bindable actions, see below.
+
 You can also chain commands when rebinding. For example, if you want Alt-s to save
 and quit you can bind it like so:
 
@@ -116,6 +44,11 @@ and quit you can bind it like so:
 }
 ```
 
+# Unbinding keys
+
+It is also possible to disable any of the default key bindings by use of the 
+`UnbindKey` action in the user's `bindings.json` file.
+
 # Bindable actions and bindable keys
 
 The list of default keybindings contains most of the possible actions and keys
@@ -197,6 +130,7 @@ HSplit
 PreviousSplit
 ToggleMacro
 PlayMacro
+UnbindKey
 ```
 
 Here is the list of all possible keys you can bind:
@@ -327,6 +261,93 @@ Escape
 Enter
 ```
 
+# Default keybinding configuration.
+
+```json
+{
+    "Up":             "CursorUp",
+    "Down":           "CursorDown",
+    "Right":          "CursorRight",
+    "Left":           "CursorLeft",
+    "ShiftUp":        "SelectUp",
+    "ShiftDown":      "SelectDown",
+    "ShiftLeft":      "SelectLeft",
+    "ShiftRight":     "SelectRight",
+    "AltLeft":        "WordLeft",
+    "AltRight":       "WordRight",
+    "AltShiftRight":  "SelectWordRight",
+    "AltShiftLeft":   "SelectWordLeft",
+    "AltUp":          "MoveLinesUp",
+    "AltDown":        "MoveLinesDown",
+    "CtrlLeft":       "StartOfLine",
+    "CtrlRight":      "EndOfLine",
+    "CtrlShiftLeft":  "SelectToStartOfLine",
+    "CtrlShiftRight": "SelectToEndOfLine",
+    "CtrlUp":         "CursorStart",
+    "CtrlDown":       "CursorEnd",
+    "CtrlShiftUp":    "SelectToStart",
+    "CtrlShiftDown":  "SelectToEnd",
+    "Enter":          "InsertNewline",
+    "Space":          "InsertSpace",
+    "CtrlH":          "Backspace",
+    "Backspace":      "Backspace",
+    "Alt-CtrlH":      "DeleteWordLeft",
+    "Alt-Backspace":  "DeleteWordLeft",
+    "Tab":            "IndentSelection,InsertTab",
+    "Backtab":        "OutdentSelection",
+    "CtrlO":          "OpenFile",
+    "CtrlS":          "Save",
+    "CtrlF":          "Find",
+    "CtrlN":          "FindNext",
+    "CtrlP":          "FindPrevious",
+    "CtrlZ":          "Undo",
+    "CtrlY":          "Redo",
+    "CtrlC":          "Copy",
+    "CtrlX":          "Cut",
+    "CtrlK":          "CutLine",
+    "CtrlD":          "DuplicateLine",
+    "CtrlV":          "Paste",
+    "CtrlA":          "SelectAll",
+    "CtrlT":          "AddTab",
+    "Alt,":           "PreviousTab",
+    "Alt.":           "NextTab",
+    "Home":           "StartOfLine",
+    "End":            "EndOfLine",
+    "CtrlHome":       "CursorStart",
+    "CtrlEnd":        "CursorEnd",
+    "PageUp":         "CursorPageUp",
+    "PageDown":       "CursorPageDown",
+    "CtrlG":          "ToggleHelp",
+    "CtrlR":          "ToggleRuler",
+    "CtrlL":          "JumpLine",
+    "Delete":         "Delete",
+    "CtrlB":          "ShellMode",
+    "CtrlQ":          "Quit",
+    "CtrlE":          "CommandMode",
+    "CtrlW":          "NextSplit",
+    "CtrlU":          "ToggleMacro",
+    "CtrlJ":          "PlayMacro",
+
+    // Emacs-style keybindings
+    "Alt-f": "WordRight",
+    "Alt-b": "WordLeft",
+    "Alt-a": "StartOfLine",
+    "Alt-e": "EndOfLine",
+    "Alt-p": "CursorUp",
+    "Alt-n": "CursorDown",
+
+    // Integration with file managers
+    "F1":  "ToggleHelp",
+    "F2":  "Save",
+    "F3":  "Find",
+    "F4":  "Quit",
+    "F7":  "Find",
+    "F10": "Quit",
+    "Esc": "Escape",
+}
+```
+
+#Final notes
 Note: On some old terminal emulators and on Windows machines, `CtrlH` should be used
 for backspace.