diff options
Diffstat (limited to 'lib/editor.ml')
-rw-r--r-- | lib/editor.ml | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/editor.ml b/lib/editor.ml index 959b3af..9078a09 100644 --- a/lib/editor.ml +++ b/lib/editor.ml | |||
@@ -186,15 +186,16 @@ let handle_insert_command = | |||
186 | let open Command in | 186 | let open Command in |
187 | let open Action in | 187 | let open Action in |
188 | function | 188 | function |
189 | | Simple Arrow_down -> Buffer.Action.down |> on_focused_buffer | ||
190 | | Simple Arrow_left -> Buffer.Action.left |> on_focused_buffer | ||
191 | | Simple Arrow_right -> Buffer.Action.right |> on_focused_buffer | ||
192 | | Simple Arrow_up -> Buffer.Action.up |> on_focused_buffer | ||
193 | | Simple Backspace -> Buffer.Action.delete_before ~n:1 |> on_focused_buffer | 189 | | Simple Backspace -> Buffer.Action.delete_before ~n:1 |> on_focused_buffer |
190 | | Simple Arrow_down -> Buffer.Action.move_down |> on_focused_buffer | ||
191 | | Simple Arrow_left -> Buffer.Action.move_left |> on_focused_buffer | ||
192 | | Simple Arrow_right -> Buffer.Action.move_right |> on_focused_buffer | ||
193 | | Simple Arrow_up -> Buffer.Action.move_up |> on_focused_buffer | ||
194 | | Simple (Ctrl 'Q') -> quit 0 | 194 | | Simple (Ctrl 'Q') -> quit 0 |
195 | | Simple Delete -> Buffer.Action.delete_after ~n:1 |> on_focused_buffer | 195 | | Simple Delete -> Buffer.Action.delete_after ~n:1 |> on_focused_buffer |
196 | | Simple Enter -> Buffer.Action.newline |> on_focused_buffer | 196 | | Simple Enter -> Buffer.Action.newline |> on_focused_buffer |
197 | | Simple Esc -> (Buffer.Action.left |> on_focused_buffer) *> set_mode Normal | 197 | | Simple Esc -> |
198 | (Buffer.Action.move_left |> on_focused_buffer) *> set_mode Normal | ||
198 | | Type k -> Buffer.Action.insert k |> on_focused_buffer | 199 | | Type k -> Buffer.Action.insert k |> on_focused_buffer |
199 | | _ -> noop | 200 | | _ -> noop |
200 | 201 | ||
@@ -203,16 +204,19 @@ let handle_normal_command = | |||
203 | let open Action in | 204 | let open Action in |
204 | function | 205 | function |
205 | (* Movements *) | 206 | (* Movements *) |
206 | | Chord (_, n, Noop, _, Down) -> Buffer.Action.down ?n |> on_focused_buffer | 207 | | Chord (_, n, Noop, _, Down) -> |
207 | | Chord (_, n, Noop, _, Left) -> Buffer.Action.left ?n |> on_focused_buffer | 208 | Buffer.Action.move_down ?n |> on_focused_buffer |
208 | | Chord (_, n, Noop, _, Right) -> Buffer.Action.right ?n |> on_focused_buffer | 209 | | Chord (_, n, Noop, _, Left) -> |
209 | | Chord (_, n, Noop, _, Up) -> Buffer.Action.up ?n |> on_focused_buffer | 210 | Buffer.Action.move_left ?n |> on_focused_buffer |
211 | | Chord (_, n, Noop, _, Right) -> | ||
212 | Buffer.Action.move_right ?n |> on_focused_buffer | ||
213 | | Chord (_, n, Noop, _, Up) -> Buffer.Action.move_up ?n |> on_focused_buffer | ||
210 | | Simple (Ctrl 'Q') -> quit 0 | 214 | | Simple (Ctrl 'Q') -> quit 0 |
211 | (* | Key '0' -> Buffer.Action.bol |> on_focused_buffer_or_new *) | 215 | (* | Key '0' -> Buffer.Action.bol |> on_focused_buffer_or_new *) |
212 | | Simple (Key 'A') -> | 216 | | Simple (Key 'A') -> |
213 | (Buffer.Action.eol |> on_focused_buffer_or_new) *> set_mode Insert | 217 | (Buffer.Action.eol |> on_focused_buffer_or_new) *> set_mode Insert |
214 | | Simple (Key 'a') -> | 218 | | Simple (Key 'a') -> |
215 | (Buffer.Action.right |> on_focused_buffer_or_new) *> set_mode Insert | 219 | (Buffer.Action.move_right |> on_focused_buffer_or_new) *> set_mode Insert |
216 | (* | Key 'G' -> Buffer.Action.eof |> on_focused_buffer_or_new *) | 220 | (* | Key 'G' -> Buffer.Action.eof |> on_focused_buffer_or_new *) |
217 | (* | Key 'I' -> noop *) | 221 | (* | Key 'I' -> noop *) |
218 | | Simple (Key 'i') -> (Fn.id |> on_focused_buffer_or_new) *> set_mode Insert | 222 | | Simple (Key 'i') -> (Fn.id |> on_focused_buffer_or_new) *> set_mode Insert |