diff options
author | Dr. David A. Kunz | 2022-04-03 12:26:46 +0000 |
---|---|---|
committer | GitHub | 2022-04-03 12:26:46 +0000 |
commit | 9782204f739813ab5b2dd82451ef2d4695b41d22 (patch) | |
tree | df830fa3053b09861a6ab889a322c0211353c9c2 /helix-term/src/commands | |
parent | ec21de08446656b9012c39db2db3d02c7ce3dc9c (diff) |
Add typed commands buffer-next and buffer-previous (#1940)
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r-- | helix-term/src/commands/typed.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index c921f85b..4c044793 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -172,6 +172,24 @@ fn force_buffer_close_all( buffer_close_by_ids_impl(cx.editor, &document_ids, true) } +fn buffer_next( + cx: &mut compositor::Context, + _args: &[Cow<str>], + _event: PromptEvent, +) -> anyhow::Result<()> { + goto_buffer(cx.editor, Direction::Forward); + Ok(()) +} + +fn buffer_previous( + cx: &mut compositor::Context, + _args: &[Cow<str>], + _event: PromptEvent, +) -> anyhow::Result<()> { + goto_buffer(cx.editor, Direction::Backward); + Ok(()) +} + fn write_impl(cx: &mut compositor::Context, path: Option<&Cow<str>>) -> anyhow::Result<()> { let jobs = &mut cx.jobs; let doc = doc_mut!(cx.editor); @@ -1083,6 +1101,20 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ completer: None, }, TypableCommand { + name: "buffer-next", + aliases: &["bn", "bnext"], + doc: "Go to next buffer.", + fun: buffer_next, + completer: None, + }, + TypableCommand { + name: "buffer-previous", + aliases: &["bp", "bprev"], + doc: "Go to previous buffer.", + fun: buffer_previous, + completer: None, + }, + TypableCommand { name: "write", aliases: &["w"], doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)", |