aboutsummaryrefslogtreecommitdiff
path: root/.config/config.toml
blob: 852077246cf72a6110a4b7b4dcc477c6f8beb430 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# mojibake configuration.
#
# This file is both the runtime configuration and, via `include_str!` in
# src/config.rs, the compiled-in default set. User settings in
# $MOJIBAKE_CONFIG/config.toml override these per individual binding;
# anything not listed here keeps its default. (MJB-LLR-180, MJB-LLR-182)
#
# Key syntax: "<k>" for one key, "<g><g>" for a sequence, with the modifier
# prefixes ctrl-, alt-, shift-, e.g. "<ctrl-d>".
#
# Bindings follow the Helix default keymap: https://docs.helix-editor.com/keymap.html

# Editor settings live in their own table rather than at top level: the
# top-level struct uses `#[serde(flatten)]` for the data/config directories,
# and config-rs stringifies values it buffers through a flattened map, which
# breaks integer and boolean fields. (MJB-LLR-185)
[editor]
# Lines of context kept between the cursor and the viewport edge.
# Clamped to half the viewport height at use. (MJB-LLR-093)
scrolloff = 5

# Append a trailing newline on write when the buffer lacks one.
insert_final_newline = true

# Consulted by App before any component sees the key. A match here is consumed
# and never reaches the buffer, so these fire in every mode. (MJB-LLR-203)
[keybindings.global]
"<ctrl-c>" = "Quit"
"<ctrl-z>" = "Suspend"

[keybindings.normal]
# Movement (MJB-HLR-006)
"<h>" = "MoveCharLeft"
"<j>" = "MoveLineDown"
"<k>" = "MoveLineUp"
"<l>" = "MoveCharRight"
"<left>" = "MoveCharLeft"
"<down>" = "MoveLineDown"
"<up>" = "MoveLineUp"
"<right>" = "MoveCharRight"

# Word motions. These leave a SELECTION, not a bare cursor. (MJB-HLR-007)
"<w>" = "MoveNextWordStart"
"<b>" = "MovePrevWordStart"
"<e>" = "MoveNextWordEnd"
"<W>" = "MoveNextLongWordStart"
"<B>" = "MovePrevLongWordStart"
"<E>" = "MoveNextLongWordEnd"

# Goto mode (MJB-HLR-008)
"<g><g>" = "GotoFileStart"
"<g><e>" = "GotoLastLine"
"<g><h>" = "GotoLineStart"
"<g><l>" = "GotoLineEnd"
"<g><s>" = "GotoFirstNonWhitespace"

# Selection manipulation
"<x>" = "ExtendLineBelow"
"<;>" = "CollapseSelection"
"<alt-;>" = "FlipSelections"
"<%>" = "SelectAll"
"<v>" = "SelectMode"

# Entering insert mode (MJB-HLR-009)
"<i>" = "InsertMode"
"<a>" = "AppendMode"
"<I>" = "InsertAtLineStart"
"<A>" = "InsertAtLineEnd"
"<o>" = "OpenBelow"
"<O>" = "OpenAbove"

# Modification (MJB-HLR-010)
"<d>" = "DeleteSelection"
"<c>" = "ChangeSelection"

# Undo / redo (MJB-HLR-011)
"<u>" = "Undo"
"<U>" = "Redo"

# Scrolling and paging (MJB-HLR-013)
"<ctrl-u>" = "PageCursorHalfUp"
"<ctrl-d>" = "PageCursorHalfDown"
"<ctrl-b>" = "PageUp"
"<ctrl-f>" = "PageDown"
"<pageup>" = "PageUp"
"<pagedown>" = "PageDown"

# Command mode (MJB-HLR-016)
"<:>" = "CommandMode"

[keybindings.select]
# Select mode repeats normal-mode motions, but extends rather than replaces.
"<h>" = "ExtendCharLeft"
"<j>" = "ExtendLineDown"
"<k>" = "ExtendLineUp"
"<l>" = "ExtendCharRight"
"<w>" = "ExtendNextWordStart"
"<b>" = "ExtendPrevWordStart"
"<e>" = "ExtendNextWordEnd"
"<esc>" = "NormalMode"
"<v>" = "NormalMode"
"<d>" = "DeleteSelection"
"<c>" = "ChangeSelection"
"<;>" = "CollapseSelection"

[keybindings.insert]
# Any printable key not bound here self-inserts; that fallback is not
# expressible as a table entry. (MJB-LLR-156)
"<esc>" = "NormalMode"
"<enter>" = "InsertNewline"
"<backspace>" = "DeleteCharBackward"
"<delete>" = "DeleteCharForward"
"<tab>" = "InsertTab"
"<ctrl-h>" = "DeleteCharBackward"
"<ctrl-d>" = "DeleteCharForward"
"<ctrl-w>" = "DeleteWordBackward"
"<ctrl-u>" = "KillToLineStart"
"<left>" = "MoveCharLeft"
"<down>" = "MoveLineDown"
"<up>" = "MoveLineUp"
"<right>" = "MoveCharRight"

[keybindings.command]
# Command mode routes keys to a line editor; only these are bound. (MJB-LLR-158)
"<esc>" = "NormalMode"
"<enter>" = "CommandSubmit"
"<backspace>" = "CommandBackspace"

[styles.normal]
cursor = "black on white"
selection = "on blue"
linenr = "gray8"
statusline = "black on cyan"

[styles.insert]
cursor = "black on green"
selection = "on blue"
linenr = "gray8"
statusline = "black on green"

[styles.select]
cursor = "black on white"
selection = "on magenta"
linenr = "gray8"
statusline = "black on magenta"

[styles.command]
cursor = "black on white"
selection = "on blue"
linenr = "gray8"
statusline = "black on yellow"