diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md
index 6e6beab4b40f..b4a40de736c4 100644
--- a/book/src/generated/typable-cmd.md
+++ b/book/src/generated/typable-cmd.md
@@ -55,6 +55,7 @@
| `:tutor` | Open the tutorial. |
| `:goto`, `:g` | Go to line number. |
| `:set-language`, `:lang` | Set the language of current buffer. |
+| `:show-language` | Show the language of current buffer. |
| `: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. |
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 4e1ac0da9a9c..1b48b8fb1f44 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -1261,6 +1261,25 @@ fn language(
Ok(())
}
+fn show_current_language(
+ cx: &mut compositor::Context,
+ _args: &[Cow],
+ event: PromptEvent,
+) -> anyhow::Result<()> {
+ if event != PromptEvent::Validate {
+ return Ok(());
+ }
+
+ let doc = doc_mut!(cx.editor);
+ let lang = if let Some(lang) = doc.language_id() {
+ Cow::Owned(format!("Current language of buffer: {}", lang))
+ } else {
+ Cow::Borrowed("No language for current buffer")
+ };
+ cx.editor.set_status(lang);
+ Ok(())
+}
+
fn sort(cx: &mut compositor::Context, args: &[Cow], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
@@ -1906,6 +1925,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
fun: language,
completer: Some(completers::language),
},
+ TypableCommand {
+ name: "show-language",
+ aliases: &[],
+ doc: "Show the language of current buffer.",
+ fun: show_current_language,
+ completer: None,
+ },
TypableCommand {
name: "set-option",
aliases: &["set"],