summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/builtins.zig68
1 files changed, 49 insertions, 19 deletions
diff --git a/core/builtins.zig b/core/builtins.zig
index 5c29bf59..64ebe5f0 100644
--- a/core/builtins.zig
+++ b/core/builtins.zig
@@ -962,9 +962,11 @@ pub const ClipReplace = struct {
// ---- panes and columns ----
-/// acme's Get: the pane's file read again, its unsaved edits refused once
-/// as Del refuses them. `Get file` loads that file into the pane instead,
-/// the pane taking its name.
+/// Read this pane's file again from disk; refused once over unsaved edits, as
+/// Del is.
+///
+/// `Get <file>` loads that file into the pane instead, the pane taking its
+/// name. In a directory's pane, it reads the directory again.
pub const Get = struct {
pub const takes_arg = true;
pub fn run(c: Ctx) void {
@@ -1099,7 +1101,8 @@ pub const Plumb = struct {
/// Open a second pane on this pane's file: the same text, undo and unsaved
/// state.
///
-/// Each pane keeps a scroll and a cursor of its own.
+/// Each pane keeps a scroll and a cursor of its own. Only a file's pane takes
+/// it.
pub const Zerox = struct {
// acme's Zerox (File.zerox).
pub fn run(c: Ctx) void {
@@ -1113,6 +1116,11 @@ pub const Zerox = struct {
};
/// Write the pane's text to its file, or to the file its argument names.
+///
+/// `Save <path>` writes it there. Bare, a pane with no file of its own (a
+/// +New, a list, a terminal) asks for a path; a file at a revision is
+/// read-only, written only to a path. Over a file changed on disk since it
+/// was read, it warns once.
pub const Save = struct {
pub const takes_arg = true;
pub fn run(c: Ctx) void {
@@ -1144,7 +1152,10 @@ pub const Save = struct {
}
};
-/// Open an empty scratch pane, <dir>/+New, in this pane's directory.
+/// Open an empty scratch pane, +New, in this pane's directory.
+///
+/// It takes the keyboard. Save asks it for a path to write to; past 100
+/// bytes, Exit, Del and Restore ask about its text as about a file's.
pub const New = struct {
pub const output: OutputTraits = .{ .name = config.scratch_buffer, .doc = true, .saves = true };
pub fn run(c: Ctx) void {
@@ -1152,7 +1163,10 @@ pub const New = struct {
}
};
-/// An empty column right of the keyboard's, its tag taking the keyboard.
+/// Make an empty column right of the keyboard's, its tag taking the keyboard.
+///
+/// The next pane made from there goes in it. Refused, saying why, when no
+/// column fits.
pub const Newcol = struct {
pub const scope: Scope = .session;
pub fn run(c: Ctx) void {
@@ -1160,9 +1174,13 @@ pub const Newcol = struct {
}
};
-/// Close the pane. `Del k` gives its rows to the open pane above it and
-/// `Del j` to the one below, each falling back to the other side. Focus on
-/// it goes with its rows.
+/// Close the pane.
+///
+/// `Del k` gives its rows to the pane above it, `Del j` to the one below,
+/// each falling back to the other side; bare, from the keyboard between two
+/// panes, it asks k or j on the pane's notice band. A docked pane's rows go
+/// back to the pane it answers for. Refused once while the pane holds unsaved
+/// text (listed in +Unsaved); Del again, nothing edited since, closes it.
pub const Del = struct {
pub const takes_arg = true;
pub fn run(c: Ctx) void {
@@ -1305,7 +1323,11 @@ pub const Diff = struct {
pub const run = @import("hunks.zig").word;
};
-/// Cycle the pane's input modes: terminals add raw tty mode to normal/insert.
+/// Step this pane to its next input mode: normal, insert, and in a terminal
+/// raw.
+///
+/// From the last it goes back to normal. The keyboard goes to the pane's
+/// text.
pub const Mode = struct {
pub fn run(c: Ctx) void {
if (c.pane.file == null and !c.pane.isTerminal()) return c.p.reportFailure(c.id, "Mode: only a text or terminal pane has modes");
@@ -1313,7 +1335,8 @@ pub const Mode = struct {
}
};
-/// Switch this terminal between raw program input and normal editor mode.
+/// Switch this terminal between raw mode, its keys the program's, and normal
+/// mode.
pub const Togglettymode = struct {
pub const needs: PaneKind = .terminal;
pub fn run(c: Ctx) void {
@@ -1358,7 +1381,7 @@ pub const Redo = struct {
}
};
-/// Fold a pane to its tag, or restore its share of the column.
+/// Fold this pane to its tag, or give it its share of the column again.
pub const Collapse = struct {
pub fn run(c: Ctx) void {
layout.toggleCollapse(c.p, c.id);
@@ -1376,7 +1399,11 @@ pub const Undock = struct {
}
};
-/// Close this column and its panes, refusing once over unsaved text.
+/// Close this column and its panes.
+///
+/// The column is the one whose tag it ran from, else the pane's. Refused once
+/// while a pane in it holds unsaved text, the notice saying how many; Delcol
+/// again, nothing edited since, closes them.
pub const Delcol = struct {
pub fn run(c: Ctx) void {
// The column of the tag it came from, else the pane's: a pane ctl's
@@ -1389,14 +1416,14 @@ pub const Delcol = struct {
}
};
-/// Close the pane, giving its rows to the pane above it.
+/// Close the pane, giving its rows to the pane above it, as `Del k` does.
pub const DelAbove = struct {
pub fn run(c: Ctx) void {
Del.run(.{ .p = c.p, .pane = c.pane, .id = c.id, .txt = c.txt, .arg = "k" });
}
};
-/// Close the pane, giving its rows to the pane below it.
+/// Close the pane, giving its rows to the pane below it, as `Del j` does.
pub const DelBelow = struct {
pub fn run(c: Ctx) void {
Del.run(.{ .p = c.p, .pane = c.pane, .id = c.id, .txt = c.txt, .arg = "j" });
@@ -1508,8 +1535,10 @@ pub const Repl = struct {
}
};
-/// Fold the active pane's column into the one on its right, keeping its panes.
-/// The horizontal mirror of the vertical stacking `New` does.
+/// Fold the keyboard's column into the one on its right, keeping its panes.
+///
+/// Refused for the last column, and where the joined column could not give
+/// each pane its tag and 2 rows.
pub const Joincol = struct {
pub const scope: Scope = .session;
pub fn run(c: Ctx) void {
@@ -1787,7 +1816,7 @@ pub const Left = struct {
}
};
-/// Move the keyboard to the pane below, off a tag onto the pane under it.
+/// Move the keyboard to the pane below, or off a tag onto the pane under it.
pub const Down = struct {
pub fn run(c: Ctx) void {
if (c.p.view().header != null) {
@@ -1806,7 +1835,8 @@ pub const Down = struct {
}
};
-/// Move the keyboard to the pane above, and from a column's top pane to its tag.
+/// Move the keyboard to the pane above, and from a column's top pane to its
+/// tag.
pub const Up = struct {
pub fn run(c: Ctx) void {
if (c.p.view().header != null) {