From c537adbcddc58cba623c08f722f08aa7e3ea84f1 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 13 Feb 2025 12:06:59 +0100 Subject: [PATCH] feat: add --new-file command line parameter --- src/main.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 4edf23f..ef2d734 100644 --- a/src/main.zig +++ b/src/main.zig @@ -73,6 +73,7 @@ pub fn main() anyerror!void { .exec = "Execute a command on startup", .literal = "Disable :LINE and +LINE syntax", .scratch = "Open a scratch (temporary) buffer on start", + .new_file = "Create a new untitled file on start", .version = "Show build version and exit", }; @@ -87,6 +88,7 @@ pub fn main() anyerror!void { .exec = 'e', .literal = 'L', .scratch = 'S', + .new_file = 'n', .version = 'v', }; @@ -109,6 +111,7 @@ pub fn main() anyerror!void { exec: ?[]const u8, literal: bool, scratch: bool, + new_file: bool, version: bool, }; @@ -319,7 +322,9 @@ pub fn main() anyerror!void { try tui_proc.send(.{ "cmd", "show_home" }); } - if (args.scratch) { + if (args.new_file) { + try tui_proc.send(.{ "cmd", "create_new_file", .{} }); + } else if (args.scratch) { try tui_proc.send(.{ "cmd", "create_scratch_buffer", .{} }); }