aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmnikar2021-09-13 08:48:12 +0000
committerGitHub2021-09-13 08:48:12 +0000
commit3e12b0099342be12db1db64e36ca4ff29613f122 (patch)
treef66cecc2ee05b7ed715dcf20caef6be89b53693e
parent1540b37f3455326f9b0052f137f9e565f936dc12 (diff)
Add `no_op` command (#743)
* Add `no_op` command * Document `no_op` in `remapping.md`
-rw-r--r--book/src/remapping.md2
-rw-r--r--helix-term/src/commands.rs3
2 files changed, 5 insertions, 0 deletions
diff --git a/book/src/remapping.md b/book/src/remapping.md
index 3f25e364..81f45da3 100644
--- a/book/src/remapping.md
+++ b/book/src/remapping.md
@@ -49,4 +49,6 @@ Control, Shift and Alt modifiers are encoded respectively with the prefixes
| Null | `"null"` |
| Escape | `"esc"` |
+Keys can be disabled by binding them to the `no_op` command.
+
Commands can be found in the source code at [`helix-term/src/commands.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs)
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index fb885740..c5409494 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -162,6 +162,7 @@ impl Command {
#[rustfmt::skip]
commands!(
+ no_op, "Do nothing",
move_char_left, "Move left",
move_char_right, "Move right",
move_line_up, "Move up",
@@ -361,6 +362,8 @@ impl PartialEq for Command {
}
}
+fn no_op(_cx: &mut Context) {}
+
fn move_impl<F>(cx: &mut Context, move_fn: F, dir: Direction, behaviour: Movement)
where
F: Fn(RopeSlice, Range, Direction, usize, Movement) -> Range,