on master help sign in
feat(commands): add log-open command (#2422)
a5bc69camaihoefner
book/src/generated/typable-cmd.md+1
@@ -63,5 +63,6 @@
63| `:tree-sitter-subtree`, `:ts-subtree` | Display tree sitter subtree under cursor, primarily for debugging queries. |
63| `:tree-sitter-subtree`, `:ts-subtree` | Display tree sitter subtree under cursor, primarily for debugging queries. |
64| `:config-reload` | Refreshes helix's config. |
64| `:config-reload` | Refreshes helix's config. |
65| `:config-open` | Open the helix config.toml file. |
65| `:config-open` | Open the helix config.toml file. |
66+| `:log-open` | Open the helix log file. |
66| `:pipe` | Pipe each selection to the shell command. |
67| `:pipe` | Pipe each selection to the shell command. |
67| `:run-shell-command`, `:sh` | Run a shell command |
68| `:run-shell-command`, `:sh` | Run a shell command |
helix-term/src/commands/typed.rs+16
@@ -1146,6 +1146,15 @@ fn open_config(
1146 Ok(())
1146 Ok(())
1147}
1147}
1148
1148
1149+fn open_log(
1150+ cx: &mut compositor::Context,
1151+ _args: &[Cow<str>],
1152+ _event: PromptEvent,
1153+) -> anyhow::Result<()> {
1154+ cx.editor.open(helix_loader::log_file(), Action::Replace)?;
1155+ Ok(())
1156+}
1157+
1149fn refresh_config(
1158fn refresh_config(
1150 cx: &mut compositor::Context,
1159 cx: &mut compositor::Context,
1151 _args: &[Cow<str>],
1160 _args: &[Cow<str>],
@@ -1647,6 +1656,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
1647 fun: open_config,
1656 fun: open_config,
1648 completer: None,
1657 completer: None,
1649 },
1658 },
1659+ TypableCommand {
1660+ name: "log-open",
1661+ aliases: &[],
1662+ doc: "Open the helix log file.",
1663+ fun: open_log,
1664+ completer: None,
1665+ },
1650 TypableCommand {
1666 TypableCommand {
1651 name: "pipe",
1667 name: "pipe",
1652 aliases: &[],
1668 aliases: &[],