From 09a17e4fa3d0aa67e399c02c484a768d85acaac6 Mon Sep 17 00:00:00 2001 From: Ben Lee-Cohen Date: Tue, 3 May 2022 22:17:08 -0400 Subject: [PATCH] Making the 'set-option' command help more descriptive. (#2365) * Making the 'set-option' command help more descriptive. * Adding the generated docs * Making the message multi-line * Replace newline with break in generated docs --- book/src/generated/typable-cmd.md | 2 +- helix-term/src/commands/typed.rs | 2 +- xtask/src/main.rs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 426598e3d..17d10c996 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -55,7 +55,7 @@ | `:tutor` | Open the tutorial. | | `:goto`, `:g` | Go to line number. | | `:set-language`, `:lang` | Set the language of current buffer. | -| `:set-option`, `:set` | Set a config option at runtime. | +| `:set-option`, `:set` | Set a config option at runtime.
For example to disable smart case search, use `:set search.smart-case false`. | | `:get-option`, `:get` | Get the current value of a config option. | | `:sort` | Sort ranges in selection. | | `:rsort` | Sort ranges in selection in reverse order. | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 68aa7703c..68b64bb8d 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1594,7 +1594,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "set-option", aliases: &["set"], - doc: "Set a config option at runtime.", + doc: "Set a config option at runtime.\nFor example to disable smart case search, use `:set search.smart-case false`.", fun: set_option, completer: Some(completers::setting), }, diff --git a/xtask/src/main.rs b/xtask/src/main.rs index ad120f4f1..a4c69d701 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -106,7 +106,9 @@ pub mod md_gen { .collect::>() .join(", "); - md.push_str(&md_table_row(&[names.to_owned(), cmd.doc.to_owned()])); + let doc = cmd.doc.replace("\n", "
"); + + md.push_str(&md_table_row(&[names.to_owned(), doc.to_owned()])); } Ok(md)