Make CursorPageUp and CursorPageDown default

This commit also fixes the documentation for PageUp and PageDown.

See #149
This commit is contained in:
Zachary Yedidia
2016-05-31 19:45:19 -04:00
parent 312595ba4f
commit cd6389c49e
3 changed files with 127 additions and 148 deletions

View File

@@ -104,8 +104,8 @@ var bindingKeys = map[string]Key{
"DownLeft": Key{tcell.KeyDownLeft, tcell.ModNone, 0},
"DownRight": Key{tcell.KeyDownRight, tcell.ModNone, 0},
"Center": Key{tcell.KeyCenter, tcell.ModNone, 0},
"PgUp": Key{tcell.KeyPgUp, tcell.ModNone, 0},
"PgDn": Key{tcell.KeyPgDn, tcell.ModNone, 0},
"PageUp": Key{tcell.KeyPgUp, tcell.ModNone, 0},
"PageDown": Key{tcell.KeyPgDn, tcell.ModNone, 0},
"Home": Key{tcell.KeyHome, tcell.ModNone, 0},
"End": Key{tcell.KeyEnd, tcell.ModNone, 0},
"Insert": Key{tcell.KeyInsert, tcell.ModNone, 0},
@@ -219,6 +219,10 @@ var bindingKeys = map[string]Key{
"Escape": Key{tcell.KeyEscape, tcell.ModNone, 0},
"Enter": Key{tcell.KeyEnter, tcell.ModNone, 0},
"Backspace2": Key{tcell.KeyBackspace2, tcell.ModNone, 0},
// I renamed these keys to PageUp and PageDown but I don't want to break someone's keybindings
"PgUp": Key{tcell.KeyPgUp, tcell.ModNone, 0},
"PgDown": Key{tcell.KeyPgDn, tcell.ModNone, 0},
}
// The Key struct holds the data for a keypress (keycode + modifiers)
@@ -331,8 +335,8 @@ func DefaultBindings() map[string]string {
"CtrlA": "SelectAll",
"Home": "Start",
"End": "End",
"PgUp": "PageUp",
"PgDn": "PageDown",
"PageUp": "CursorPageUp",
"PageDown": "CursorPageDown",
"CtrlG": "ToggleHelp",
"CtrlR": "ToggleRuler",
"CtrlL": "JumpLine",

File diff suppressed because one or more lines are too long

View File

@@ -18,52 +18,8 @@ You can move the cursor around with the arrow keys and mouse.
### Keybindings
These are the default keybindings, along with their actions.
* Ctrl-q: Quit
* Ctrl-e: Execute a command
* Ctrl-g: Toggle help text
* Ctrl-b: Run a shell command
* Ctrl-s: Save
* Ctrl-o: Open file
* Ctrl-z: Undo
* Ctrl-y: Redo
* Ctrl-f: Find
* Ctrl-n: Find next
* Ctrl-p: Find previous
* Ctrl-a: Select all
* Ctrl-c: Copy
* Ctrl-x: Cut
* Ctrl-k: Cut line
* Ctrl-d: Duplicate line
* Ctrl-v: Paste
* PageUp: Page up
* PageDown: Page down
* Home: Go to beginning of line
* End: Go to end of line
* Ctrl-r: Toggle line numbers
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
ctrl up and down move the cursor the start and end of the buffer.
You can hold shift with all of these movement actions to select while moving.
The bindings may be rebound using the `~/.config/micro/bindings.json`
file. Each key is bound to an action.
For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the
following in the `bindings.json` file.
```json
{
"CtrlY": "Undo",
"CtrlZ": "Redo"
}
```
Here are the defaults:
Here are the default keybindings in json form which is also how
you can rebind them to your liking.
```json
{
@@ -91,6 +47,8 @@ Here are the defaults:
"Space": "InsertSpace",
"Backspace": "Backspace",
"Backspace2": "Backspace",
"Alt-Backspace": "DeleteWordLeft",
"Alt-Backspace2": "DeleteWordLeft",
"Tab": "InsertTab",
"CtrlO": "OpenFile",
"CtrlS": "Save",
@@ -107,8 +65,8 @@ Here are the defaults:
"CtrlA": "SelectAll",
"Home": "Start",
"End": "End",
"PgUp": "PageUp",
"PgDn": "PageDown",
"PageUp": "CursorPageUp",
"PageDown": "CursorPageDown",
"CtrlG": "ToggleHelp",
"CtrlR": "ToggleRuler",
"CtrlL": "JumpLine",
@@ -124,11 +82,28 @@ Here are the defaults:
"Alt-a": "StartOfLine",
"Alt-e": "EndOfLine",
"Alt-p": "CursorUp",
"Alt-n": "CursorDown",
"Alt-n": "CursorDown"
}
```
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
ctrl up and down move the cursor the start and end of the buffer.
You can hold shift with all of these movement actions to select while moving.
The bindings may be rebound using the `~/.config/micro/bindings.json`
file. Each key is bound to an action.
For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the
following in the `bindings.json` file.
```json
{
"CtrlY": "Undo",
"CtrlZ": "Redo"
}
```
### Possible commands