@@ -928,9 +928,30 @@ pub(super) fn goto_line_number(
931+// Fetch the current value of a config option and output as status.
933+ cx: &mut compositor::Context,
935+ _event: PromptEvent,
936+) -> anyhow::Result<()> {
937+ if args.len() != 1 {
938+ anyhow::bail!("Bad arguments. Usage: `:get key`");
941+ let key = &args[0].to_lowercase();
942+ let key_error = || anyhow::anyhow!("Unknown key `{}`", key);
944+ let config = serde_json::to_value(&cx.editor.config().clone()).unwrap();
945+ let pointer = format!("/{}", key.replace('.', "/"));
946+ let value = config.pointer(&pointer).ok_or_else(key_error)?;
948+ cx.editor.set_status(value.to_string());
931/// Change config at runtime. Access nested values by dot syntax, for
952/// Change config at runtime. Access nested values by dot syntax, for
932/// example to disable smart case search, use `:set search.smart-case false`.
953/// example to disable smart case search, use `:set search.smart-case false`.
933−fn setting(
954+fn set_option(
934 cx: &mut compositor::Context,
955 cx: &mut compositor::Context,
935 args: &[Cow<str>],
956 args: &[Cow<str>],
936 _event: PromptEvent,
957 _event: PromptEvent,
@@ -1487,8 +1508,15 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
1487 TypableCommand {
1508 TypableCommand {
1488 name: "set-option",
1509 name: "set-option",
1489 aliases: &["set"],
1510 aliases: &["set"],
1490− doc: "Set a config option at runtime",
1511+ doc: "Set a config option at runtime.",
1491− fun: setting,
1512+ fun: set_option,
1513+ completer: Some(completers::setting),
1516+ name: "get-option",
1518+ doc: "Get the current value of a config option.",
1492 completer: Some(completers::setting),
1520 completer: Some(completers::setting),
1494 TypableCommand {
1522 TypableCommand {