aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorJan Hrastnik2020-10-07 22:02:32 +0000
committerBlaž Hrastnik2020-10-16 02:53:31 +0000
commit0c0c2c71034e264204a2ce6d4fd7a17ddbc2245f (patch)
tree477321145126d7c2c4be3252e331c6574a5f400d /helix-view/src
parent16828d322a13be5b6f9adb680742cdc2570fbf17 (diff)
modified editor.render() to prepare for command mode rendering
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/commands.rs4
-rw-r--r--helix-view/src/keymap.rs7
2 files changed, 11 insertions, 0 deletions
diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs
index 09c6b2fc..0e3f7ce8 100644
--- a/helix-view/src/commands.rs
+++ b/helix-view/src/commands.rs
@@ -304,6 +304,10 @@ pub fn append_mode(view: &mut View, _count: usize) {
})
}
+pub fn command_mode(view: &mut View, _count: usize) {
+ view.state.mode = Mode::Command;
+}
+
// TODO: I, A, o and O can share a lot of the primitives.
// calculate line numbers for each selection range
diff --git a/helix-view/src/keymap.rs b/helix-view/src/keymap.rs
index c3a4b8e7..96a37e6b 100644
--- a/helix-view/src/keymap.rs
+++ b/helix-view/src/keymap.rs
@@ -163,6 +163,7 @@ pub fn default() -> Keymaps {
vec![key!('p')] => commands::paste,
vec![key!('>')] => commands::indent,
vec![key!('<')] => commands::unindent,
+ vec![key!(':')] => commands::command_mode,
vec![Key {
code: KeyCode::Esc,
modifiers: Modifiers::NONE
@@ -207,6 +208,12 @@ pub fn default() -> Keymaps {
}] => commands::normal_mode as Command,
vec![key!('g')] => commands::move_file_start as Command,
vec![key!('e')] => commands::move_file_end as Command,
+ ),
+ state::Mode::Command => hashmap!(
+ vec![Key {
+ code: KeyCode::Esc,
+ modifiers: Modifiers::NONE
+ }] => commands::normal_mode as Command,
)
)
}