on master help sign in
feat(commands): add log-open command (#2422)
commita5bc69c2b5c6821129b635227e9f152e92f08ddc authoramaihoefner <alexander.maihoefner@protonmail.com> dateWed 11 May 2022, 03:18 (4 years ago) parent0477d02
2 files changed+17
book/src/generated/typable-cmd.md+1 helix-term/src/commands/typed.rs+16
book/src/generated/typable-cmd.md+1
@@ -63,5 +63,6 @@
6363| `:tree-sitter-subtree`, `:ts-subtree` | Display tree sitter subtree under cursor, primarily for debugging queries. |
6464| `:config-reload` | Refreshes helix's config. |
6565| `:config-open` | Open the helix config.toml file. |
66+| `:log-open` | Open the helix log file. |
6667| `:pipe` | Pipe each selection to the shell command. |
6768| `:run-shell-command`, `:sh` | Run a shell command |
helix-term/src/commands/typed.rs+16
@@ -1146,6 +1146,15 @@ fn open_config(
11461146 Ok(())
11471147}
11481148
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+
11491158fn refresh_config(
11501159 cx: &mut compositor::Context,
11511160 _args: &[Cow<str>],
@@ -1647,6 +1656,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
16471656 fun: open_config,
16481657 completer: None,
16491658 },
1659+ TypableCommand {
1660+ name: "log-open",
1661+ aliases: &[],
1662+ doc: "Open the helix log file.",
1663+ fun: open_log,
1664+ completer: None,
1665+ },
16501666 TypableCommand {
16511667 name: "pipe",
16521668 aliases: &[],