summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 0219d474..fc216b24 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -670,6 +670,10 @@ pub const Options = struct {
tty_only: bool = false,
/// initial shell panes: 1 (default) or 3 for the classic two-column boot
shells: u8 = 1,
+ /// argv FILE (resolved absolute): boot with it focused as a doc pane in
+ /// the left column, a terminal on the launch directory in the right
+ file: ?[]const u8 = null,
+ file_line: usize = 0,
tty_toggle: u21 = 'b',
/// load a dump of another instance instead of spawning shells (acme -l)
load_path: ?[]const u8 = null,
@@ -749,7 +753,21 @@ pub const Pardes = struct {
syntax.compileStartupQueries();
const p = try gpa.create(Pardes);
p.* = .{ .gpa = gpa, .opts = opts, .screen_w = opts.cols, .screen_h = opts.rows, .scratch = .init(gpa) };
- if (opts.tty_only) {
+ if (opts.file) |path| {
+ // FILE argv boot: the doc focused in the left column, a terminal
+ // on the launch directory in the right (files left, shells right)
+ _ = if (look.isImagePath(path))
+ try p.openImageView(0, path, !p.kitty_ok)
+ else
+ try p.openFileView(0, path, opts.file_line);
+ const sh = try p.newPane(1);
+ sh.greet = true;
+ p.ncol = 2;
+ p.col_n[0] = 1;
+ p.col_terms[0][0] = 0;
+ p.col_n[1] = 1;
+ p.col_terms[1][0] = 1;
+ } else if (opts.tty_only) {
_ = try p.newPane(0);
p.panes[0].?.mode = .tty;
p.ncol = 1;