From c0dbd6dc3f147b46d4352ac78903a7a70741cfd9 Mon Sep 17 00:00:00 2001 From: Joe Date: Sun, 13 Mar 2022 22:47:52 -0400 Subject: Add horizontal and vertical split scratch buffers (#1763) Make subcommand name more descriptive Fix vsplit completer Run cargo xtask docgen--- helix-term/src/commands/typed.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'helix-term/src/commands') diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 3301d148..7866ff9d 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -771,6 +771,26 @@ fn hsplit( Ok(()) } +fn vsplit_new( + cx: &mut compositor::Context, + _args: &[Cow], + _event: PromptEvent, +) -> anyhow::Result<()> { + cx.editor.new_file(Action::VerticalSplit); + + Ok(()) +} + +fn hsplit_new( + cx: &mut compositor::Context, + _args: &[Cow], + _event: PromptEvent, +) -> anyhow::Result<()> { + cx.editor.new_file(Action::HorizontalSplit); + + Ok(()) +} + fn debug_eval( cx: &mut compositor::Context, args: &[Cow], @@ -1293,6 +1313,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: vsplit, completer: Some(completers::filename), }, + TypableCommand { + name: "vsplit-new", + aliases: &["vnew"], + doc: "Open a scratch buffer in a vertical split.", + fun: vsplit_new, + completer: None, + }, TypableCommand { name: "hsplit", aliases: &["hs", "sp"], @@ -1300,6 +1327,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: hsplit, completer: Some(completers::filename), }, + TypableCommand { + name: "hsplit-new", + aliases: &["hnew"], + doc: "Open a scratch buffer in a horizontal split.", + fun: hsplit_new, + completer: None, + }, TypableCommand { name: "tutor", aliases: &[], -- cgit v1.2.3-70-g09d2