]> git.lizzy.rs Git - micro.git/commitdiff
Improve keybinding label consistency
authorZachary Yedidia <zyedidia@gmail.com>
Thu, 18 Jun 2020 03:11:50 +0000 (23:11 -0400)
committerZachary Yedidia <zyedidia@gmail.com>
Thu, 18 Jun 2020 03:11:50 +0000 (23:11 -0400)
The old notation (for example `CtrlG`) causes confusion when combined
with new notation needed for alt (`Alt-g`) due to Alt being case
sensitive. Previously both formats were supported, but the documentation
and defaults used a combination. This commit only uses the new notation
for consistency.

Ref #1470

internal/action/defaults_darwin.go
internal/action/defaults_other.go
runtime/help/colors.md
runtime/help/commands.md
runtime/help/help.md
runtime/help/keybindings.md
runtime/help/tutorial.md

index b80e07d770a64bf60151cccba5d9776a7aab33bb..100081357f4f0c26ca7409dba84a3de0f1108039 100644 (file)
@@ -30,28 +30,28 @@ func DefaultBindings() map[string]string {
                "Alt-{":          "ParagraphPrevious",
                "Alt-}":          "ParagraphNext",
                "Enter":          "InsertNewline",
-               "CtrlH":          "Backspace",
+               "Ctrl-h":         "Backspace",
                "Backspace":      "Backspace",
                "Alt-CtrlH":      "DeleteWordLeft",
                "Alt-Backspace":  "DeleteWordLeft",
                "Tab":            "Autocomplete|IndentSelection|InsertTab",
                "Backtab":        "CycleAutocompleteBack|OutdentSelection|OutdentLine",
-               "CtrlO":          "OpenFile",
-               "CtrlS":          "Save",
-               "CtrlF":          "Find",
-               "CtrlN":          "FindNext",
-               "CtrlP":          "FindPrevious",
-               "CtrlZ":          "Undo",
-               "CtrlY":          "Redo",
-               "CtrlC":          "CopyLine|Copy",
-               "CtrlX":          "Cut",
-               "CtrlK":          "CutLine",
-               "CtrlD":          "DuplicateLine",
-               "CtrlV":          "Paste",
-               "CtrlA":          "SelectAll",
-               "CtrlT":          "AddTab",
-               "Alt,":           "PreviousTab",
-               "Alt.":           "NextTab",
+               "Ctrl-o":         "OpenFile",
+               "Ctrl-s":         "Save",
+               "Ctrl-f":         "Find",
+               "Ctrl-n":         "FindNext",
+               "Ctrl-p":         "FindPrevious",
+               "Ctrl-z":         "Undo",
+               "Ctrl-y":         "Redo",
+               "Ctrl-c":         "CopyLine|Copy",
+               "Ctrl-x":         "Cut",
+               "Ctrl-k":         "CutLine",
+               "Ctrl-d":         "DuplicateLine",
+               "Ctrl-v":         "Paste",
+               "Ctrl-a":         "SelectAll",
+               "Ctrl-t":         "AddTab",
+               "Alt-,":          "PreviousTab",
+               "Alt-.":          "NextTab",
                "Home":           "StartOfTextToggle",
                "End":            "EndOfLine",
                "CtrlHome":       "CursorStart",
@@ -60,17 +60,17 @@ func DefaultBindings() map[string]string {
                "PageDown":       "CursorPageDown",
                "CtrlPageUp":     "PreviousTab",
                "CtrlPageDown":   "NextTab",
-               "CtrlG":          "ToggleHelp",
+               "Ctrl-g":         "ToggleHelp",
                "Alt-g":          "ToggleKeyMenu",
-               "CtrlR":          "ToggleRuler",
-               "CtrlL":          "command-edit:goto ",
+               "Ctrl-r":         "ToggleRuler",
+               "Ctrl-l":         "command-edit:goto ",
                "Delete":         "Delete",
-               "CtrlB":          "ShellMode",
-               "CtrlQ":          "Quit",
-               "CtrlE":          "CommandMode",
-               "CtrlW":          "NextSplit",
-               "CtrlU":          "ToggleMacro",
-               "CtrlJ":          "PlayMacro",
+               "Ctrl-b":         "ShellMode",
+               "Ctrl-q":         "Quit",
+               "Ctrl-e":         "CommandMode",
+               "Ctrl-w":         "NextSplit",
+               "Ctrl-u":         "ToggleMacro",
+               "Ctrl-j":         "PlayMacro",
                "Insert":         "ToggleOverwriteMode",
 
                // Emacs-style keybindings
index fca4a8d7ca80bcab8851d7b4f462db2291180255..bb4e8e7de4960ffdf636a0f51eed7dadd49b93ac 100644 (file)
@@ -32,28 +32,28 @@ func DefaultBindings() map[string]string {
                "Alt-{":          "ParagraphPrevious",
                "Alt-}":          "ParagraphNext",
                "Enter":          "InsertNewline",
-               "CtrlH":          "Backspace",
+               "Ctrl-h":         "Backspace",
                "Backspace":      "Backspace",
                "Alt-CtrlH":      "DeleteWordLeft",
                "Alt-Backspace":  "DeleteWordLeft",
                "Tab":            "Autocomplete|IndentSelection|InsertTab",
                "Backtab":        "CycleAutocompleteBack|OutdentSelection|OutdentLine",
-               "CtrlO":          "OpenFile",
-               "CtrlS":          "Save",
-               "CtrlF":          "Find",
-               "CtrlN":          "FindNext",
-               "CtrlP":          "FindPrevious",
-               "CtrlZ":          "Undo",
-               "CtrlY":          "Redo",
-               "CtrlC":          "CopyLine|Copy",
-               "CtrlX":          "Cut",
-               "CtrlK":          "CutLine",
-               "CtrlD":          "DuplicateLine",
-               "CtrlV":          "Paste",
-               "CtrlA":          "SelectAll",
-               "CtrlT":          "AddTab",
-               "Alt,":           "PreviousTab",
-               "Alt.":           "NextTab",
+               "Ctrl-o":         "OpenFile",
+               "Ctrl-s":         "Save",
+               "Ctrl-f":         "Find",
+               "Ctrl-n":         "FindNext",
+               "Ctrl-p":         "FindPrevious",
+               "Ctrl-z":         "Undo",
+               "Ctrl-y":         "Redo",
+               "Ctrl-c":         "CopyLine|Copy",
+               "Ctrl-x":         "Cut",
+               "Ctrl-k":         "CutLine",
+               "Ctrl-d":         "DuplicateLine",
+               "Ctrl-v":         "Paste",
+               "Ctrl-a":         "SelectAll",
+               "Ctrl-t":         "AddTab",
+               "Alt-,":          "PreviousTab",
+               "Alt-.":          "NextTab",
                "Home":           "StartOfTextToggle",
                "End":            "EndOfLine",
                "CtrlHome":       "CursorStart",
@@ -62,17 +62,17 @@ func DefaultBindings() map[string]string {
                "PageDown":       "CursorPageDown",
                "CtrlPageUp":     "PreviousTab",
                "CtrlPageDown":   "NextTab",
-               "CtrlG":          "ToggleHelp",
+               "Ctrl-g":         "ToggleHelp",
                "Alt-g":          "ToggleKeyMenu",
-               "CtrlR":          "ToggleRuler",
-               "CtrlL":          "command-edit:goto ",
+               "Ctrl-r":         "ToggleRuler",
+               "Ctrl-l":         "command-edit:goto ",
                "Delete":         "Delete",
-               "CtrlB":          "ShellMode",
-               "CtrlQ":          "Quit",
-               "CtrlE":          "CommandMode",
-               "CtrlW":          "NextSplit",
-               "CtrlU":          "ToggleMacro",
-               "CtrlJ":          "PlayMacro",
+               "Ctrl-b":         "ShellMode",
+               "Ctrl-q":         "Quit",
+               "Ctrl-e":         "CommandMode",
+               "Ctrl-w":         "NextSplit",
+               "Ctrl-u":         "ToggleMacro",
+               "Ctrl-j":         "PlayMacro",
                "Insert":         "ToggleOverwriteMode",
 
                // Emacs-style keybindings
index 7186cdfecd26d1c7b490d2b128e26de7ffd0176d..9ebb8689f223b1c5e1a0830440549c65e596dbc1 100644 (file)
@@ -8,7 +8,7 @@ This help page aims to cover two aspects of micro's syntax highlighting engine:
 
 ## Colorschemes
 
-To change your colorscheme, press CtrlE in micro to bring up the command
+To change your colorscheme, press Ctrl-e in micro to bring up the command
 prompt, and type:
 
 ```
index 9f43085cf3bb24a1c550a403679331d9a8592cf0..771f06a2c218b336a2cbdcc1d2e3e2aa23557aef 100644 (file)
@@ -1,6 +1,6 @@
 # Command bar
 
-The command bar is opened by pressing CtrlE. It is a single-line buffer,
+The command bar is opened by pressing Ctrl-e. It is a single-line buffer,
 meaning that all keybindings from a normal buffer are supported (as well
 as mouse and selection).
 
@@ -13,7 +13,7 @@ does not look up environment variables.
 # Commands
 
 Micro provides the following commands that can be executed at the command-bar
-by pressing `CtrlE` and entering the command. Arguments are placed in single
+by pressing `Ctrl-e` and entering the command. Arguments are placed in single
 quotes here but these are not necessary when entering the command in micro.
 
 * `bind 'key' 'action'`: creates a keybinding from key to action. See the
@@ -109,7 +109,7 @@ quotes here but these are not necessary when entering the command in micro.
    is most useful for debugging keybindings.
 
 * `showkey`: Show the action(s) bound to a given key. For example
-   running `> showkey CtrlC` will display `Copy`.
+   running `> showkey Ctrl-c` will display `Copy`.
 
 * `term exec?`: Open a terminal emulator running the given executable. If no
    executable is given, this will open the default shell in the terminal
index 576f7218b80e0be241e288c9863a152e6a6dc06f..39be5d80891862fdfea47b996426006953e73941 100644 (file)
@@ -4,9 +4,9 @@ Micro is a terminal-based text editor that aims to be easy to use and
 intuitive, while also taking advantage of the full capabilities of modern
 terminals.
 
-To open the command bar, press CtrlE. This enables a `>` prompt for typing
+To open the command bar, press Ctrl-e. This enables a `>` prompt for typing
 commands. From now on when the documentation says to run a command such as `>
-help`, this means press CtrlE and type `help` (and press enter to execute the
+help`, this means press Ctrl-e and type `help` (and press enter to execute the
 command).
 
 For a list of the default keybindings run `> help defaultkeys`.
@@ -14,7 +14,7 @@ For more information on keybindings see `> help keybindings`.
 
 ## Quick-start
 
-Press Ctrl-q to quit, and Ctrl-s to save. Press CtrlE to start typing commands
+Press Ctrl-q to quit, and Ctrl-s to save. Press Ctrl-e to start typing commands
 and you can see which commands are available by pressing tab, or by viewing the
 help topic `> help commands`.
 
@@ -34,7 +34,7 @@ Press Ctrl-w to move between splits, and type `> vsplit filename` or
 
 Micro has a built-in help system which can be accessed with the `help` command.
 
-To use it, press CtrlE to access command mode and type in `help` followed by a
+To use it, press Ctrl-e to access command mode and type in `help` followed by a
 topic. Typing `help` followed by nothing will open this page.
 
 Here are the possible help topics that you can read:
index 5852e59346846d586ef85399932365863c89e81a..8daa387b9dfbbf42a34f325f0f8a118f6f8c17f0 100644 (file)
@@ -30,11 +30,17 @@ following in the `bindings.json` file.
 
 ```json
 {
-       "CtrlY": "Undo",
-       "CtrlZ": "Redo"
+       "Ctrl-y": "Undo",
+       "Ctrl-z": "Redo"
 }
 ```
 
+**Note:** The syntax `<Modifier><key>` is equivalent to `<Modifier>-<key>`. In
+addition, Ctrl-Shift bindings are not supported by terminals, and are the same
+as simply Ctrl bindings. This means that `CtrlG`, `Ctrl-G`, and `Ctrl-g` all
+mean the same thing. However, for Alt this is not the case: `AltG` and `Alt-G`
+mean `Alt-Shift-g`, while `Alt-g` does not require the Shift modifier.
+
 In addition to editing your `~/.config/micro/bindings.json`, you can run
 `>bind <keycombo> <action>` For a list of bindable actions, see below.
 
@@ -85,15 +91,15 @@ your working directory in the infobar.
 You can also bind an "editable" command with `command-edit:`. This means that 
 micro won't immediately execute the command when you press the binding, but
 instead just place the string in the infobar in command mode. For example, 
-you could rebind `CtrlG` to `> help`:
+you could rebind `Ctrl-g` to `> help`:
 
 ```json
 {
-    "CtrlG": "command-edit:help "
+    "Ctrl-g": "command-edit:help "
 }
 ```
 
-Now when you press `CtrlG`, `help` will appear in the command bar and your
+Now when you press `Ctrl-g`, `help` will appear in the command bar and your
 cursor will be placed after it (note the space in the json that controls the
 cursor placement).
 
@@ -357,32 +363,32 @@ F62
 F63
 F64
 CtrlSpace
-CtrlA
-CtrlB
-CtrlC
-CtrlD
-CtrlE
-CtrlF
-CtrlG
-CtrlH
-CtrlI
-CtrlJ
-CtrlK
-CtrlL
-CtrlM
-CtrlN
-CtrlO
-CtrlP
-CtrlQ
-CtrlR
-CtrlS
-CtrlT
-CtrlU
-CtrlV
-CtrlW
-CtrlX
-CtrlY
-CtrlZ
+Ctrl-a
+Ctrl-b
+Ctrl-c
+Ctrl-d
+Ctrl-e
+Ctrl-f
+Ctrl-g
+Ctrl-h
+Ctrl-i
+Ctrl-j
+Ctrl-k
+Ctrl-l
+Ctrl-m
+Ctrl-n
+Ctrl-o
+Ctrl-p
+Ctrl-q
+Ctrl-r
+Ctrl-s
+Ctrl-t
+Ctrl-u
+Ctrl-v
+Ctrl-w
+Ctrl-x
+Ctrl-y
+Ctrl-z
 CtrlLeftSq
 CtrlBackslash
 CtrlRightSq
@@ -450,28 +456,28 @@ conventions for text editing defaults.
     "Alt-{":          "ParagraphPrevious",
     "Alt-}":          "ParagraphNext",
     "Enter":          "InsertNewline",
-    "CtrlH":          "Backspace",
+    "Ctrl-h":          "Backspace",
     "Backspace":      "Backspace",
     "Alt-CtrlH":      "DeleteWordLeft",
     "Alt-Backspace":  "DeleteWordLeft",
     "Tab":            "Autocomplete|IndentSelection|InsertTab",
     "Backtab":        "OutdentSelection|OutdentLine",
-    "CtrlO":          "OpenFile",
-    "CtrlS":          "Save",
-    "CtrlF":          "Find",
-    "CtrlN":          "FindNext",
-    "CtrlP":          "FindPrevious",
-    "CtrlZ":          "Undo",
-    "CtrlY":          "Redo",
-    "CtrlC":          "CopyLine|Copy",
-    "CtrlX":          "Cut",
-    "CtrlK":          "CutLine",
-    "CtrlD":          "DuplicateLine",
-    "CtrlV":          "Paste",
-    "CtrlA":          "SelectAll",
-    "CtrlT":          "AddTab",
-    "Alt,":           "PreviousTab",
-    "Alt.":           "NextTab",
+    "Ctrl-o":          "OpenFile",
+    "Ctrl-s":          "Save",
+    "Ctrl-f":          "Find",
+    "Ctrl-n":          "FindNext",
+    "Ctrl-p":          "FindPrevious",
+    "Ctrl-z":          "Undo",
+    "Ctrl-y":          "Redo",
+    "Ctrl-c":          "CopyLine|Copy",
+    "Ctrl-x":          "Cut",
+    "Ctrl-k":          "CutLine",
+    "Ctrl-d":          "DuplicateLine",
+    "Ctrl-v":          "Paste",
+    "Ctrl-a":          "SelectAll",
+    "Ctrl-t":          "AddTab",
+    "Alt-,":           "PreviousTab",
+    "Alt-.":           "NextTab",
     "Home":           "StartOfText",
     "End":            "EndOfLine",
     "CtrlHome":       "CursorStart",
@@ -480,17 +486,17 @@ conventions for text editing defaults.
     "PageDown":       "CursorPageDown",
     "CtrlPageUp":     "PreviousTab",
     "CtrlPageDown":   "NextTab",
-    "CtrlG":          "ToggleHelp",
+    "Ctrl-g":          "ToggleHelp",
     "Alt-g":          "ToggleKeyMenu",
-    "CtrlR":          "ToggleRuler",
-    "CtrlL":          "command-edit:goto ",
+    "Ctrl-r":          "ToggleRuler",
+    "Ctrl-l":          "command-edit:goto ",
     "Delete":         "Delete",
-    "CtrlB":          "ShellMode",
-    "CtrlQ":          "Quit",
-    "CtrlE":          "CommandMode",
-    "CtrlW":          "NextSplit",
-    "CtrlU":          "ToggleMacro",
-    "CtrlJ":          "PlayMacro",
+    "Ctrl-b":          "ShellMode",
+    "Ctrl-q":          "Quit",
+    "Ctrl-e":          "CommandMode",
+    "Ctrl-w":          "NextSplit",
+    "Ctrl-u":          "ToggleMacro",
+    "Ctrl-j":          "PlayMacro",
     "Insert":         "ToggleOverwriteMode",
 
     // Emacs-style keybindings
@@ -526,7 +532,7 @@ conventions for text editing defaults.
 
 ## Final notes
 
-Note: On some old terminal emulators and on Windows machines, `CtrlH` should be
+Note: On some old terminal emulators and on Windows machines, `Ctrl-h` should be
 used for backspace.
 
 Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a` or
index 2245fc368e7312f5c2de4d4c173b75b8335ae6da..faf78918d7f52b9af4a44451f8e48f3516a032ad 100644 (file)
@@ -16,8 +16,8 @@ the settings and their values. To change an option, you can either change the
 value in the `settings.json` file, or you can type it in directly while using
 micro.
 
-Press CtrlE to go to command mode, and type `set option value` (in the
-future, I will use `> set option value` to indicate pressing CtrlE). The change
+Press Ctrl-e to go to command mode, and type `set option value` (in the
+future, I will use `> set option value` to indicate pressing Ctrl-e). The change
 will take effect immediately and will also be saved to the `settings.json` file
 so that the setting will stick even after you close micro.
 
@@ -48,12 +48,12 @@ If you would like to know more about all the available options, see the
 Keybindings work in much the same way as options. You configure them using the
 `~/.config/micro/bindings.json` file.
 
-For example if you would like to bind `CtrlR` to redo you could put the
+For example if you would like to bind `Ctrl-r` to redo you could put the
 following in `bindings.json`:
 
 ```json
 {
-    "CtrlR": "redo"
+    "Ctrl-r": "redo"
 }
 ```
 
@@ -74,7 +74,7 @@ micro starts and is essentially a one-file plugin. The plugin name is
 `initlua`.
 
 This example will show you how to use the `init.lua` file by creating a binding
-to `CtrlR` which will execute the bash command `go run` on the current file,
+to `Ctrl-r` which will execute the bash command `go run` on the current file,
 given that the current file is a Go file.
 
 You can do that by putting the following in `init.lua`:
@@ -84,9 +84,9 @@ local config = import("micro/config")
 local shell = import("micro/shell")
 
 function init()
-    -- true means overwrite any existing binding to CtrlR
+    -- true means overwrite any existing binding to Ctrl-r
     -- this will modify the bindings.json file
-    config.TryBindKey("CtrlR", "lua:initlua.gorun", true)
+    config.TryBindKey("Ctrl-r", "lua:initlua.gorun", true)
 end
 
 function gorun(bp)
@@ -104,7 +104,7 @@ the `bindings.json` file:
 
 ```json
 {
-    "CtrlR": "lua:initlua.gorun"
+    "Ctrl-r": "lua:initlua.gorun"
 }
 ```