Skip to content

Commit

Permalink
feat(commands): add log-open command (helix-editor#2422)
Browse files Browse the repository at this point in the history
  • Loading branch information
amaihoefner authored and mtoohey31 committed Jun 15, 2022
1 parent 520aa95 commit 2f7d807
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/typable-cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@
| `:tree-sitter-subtree`, `:ts-subtree` | Display tree sitter subtree under cursor, primarily for debugging queries. |
| `:config-reload` | Refreshes helix's config. |
| `:config-open` | Open the helix config.toml file. |
| `:log-open` | Open the helix log file. |
| `:pipe` | Pipe each selection to the shell command. |
| `:run-shell-command`, `:sh` | Run a shell command |
16 changes: 16 additions & 0 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,15 @@ fn open_config(
Ok(())
}

fn open_log(
cx: &mut compositor::Context,
_args: &[Cow<str>],
_event: PromptEvent,
) -> anyhow::Result<()> {
cx.editor.open(helix_loader::log_file(), Action::Replace)?;
Ok(())
}

fn refresh_config(
cx: &mut compositor::Context,
_args: &[Cow<str>],
Expand Down Expand Up @@ -1647,6 +1656,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
fun: open_config,
completer: None,
},
TypableCommand {
name: "log-open",
aliases: &[],
doc: "Open the helix log file.",
fun: open_log,
completer: None,
},
TypableCommand {
name: "pipe",
aliases: &[],
Expand Down

0 comments on commit 2f7d807

Please sign in to comment.