From dfb436b54a10c84156a548dded0506d474050a43 Mon Sep 17 00:00:00 2001
From: danielwerg <35052399+danielwerg@users.noreply.github.com>
Date: Tue, 21 May 2024 21:58:43 +0300
Subject: feat(tldr): add tldr plugin (#12429)
---
plugins/tldr/README.md | 15 +++++++++++++++
plugins/tldr/tldr.plugin.zsh | 19 +++++++++++++++++++
2 files changed, 34 insertions(+)
create mode 100644 plugins/tldr/README.md
create mode 100644 plugins/tldr/tldr.plugin.zsh
(limited to 'plugins/tldr')
diff --git a/plugins/tldr/README.md b/plugins/tldr/README.md
new file mode 100644
index 000000000..fb91d9d1f
--- /dev/null
+++ b/plugins/tldr/README.md
@@ -0,0 +1,15 @@
+# tldr plugin
+
+This plugin adds a shortcut to insert tldr before the previous command.
+Heavily inspired from [Man plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/man).
+
+To use it, add `tldr` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... tldr)
+```
+
+# Keyboard Shortcuts
+| Shortcut | Description |
+|------------------------------------|----------------------------------------------------------------------------|
+| Esc + tldr | add tldr before the previous command to see the tldr page for this command |
diff --git a/plugins/tldr/tldr.plugin.zsh b/plugins/tldr/tldr.plugin.zsh
new file mode 100644
index 000000000..9f3de5f0c
--- /dev/null
+++ b/plugins/tldr/tldr.plugin.zsh
@@ -0,0 +1,19 @@
+tldr-command-line() {
+ # if there is no command typed, use the last command
+ [[ -z "$BUFFER" ]] && zle up-history
+
+ # if typed command begins with tldr, do nothing
+ [[ "$BUFFER" = tldr\ * ]] && return
+
+ # get command and possible subcommand
+ # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
+ local -a args
+ args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
+
+ BUFFER="tldr ${args[1]}"
+}
+
+zle -N tldr-command-line
+# Defined shortcut keys: [Esc]tldr
+bindkey "\e"tldr tldr-command-line
+
--
cgit v1.2.3-70-g09d2
From c1e9748909af0f26dfe45c98b1f5527c790e31c4 Mon Sep 17 00:00:00 2001
From: jayant011797
Date: Fri, 19 Sep 2025 19:21:23 +0530
Subject: docs(tldr): state that `tldr` should be installed separately (#13298)
---
plugins/tldr/README.md | 3 +++
1 file changed, 3 insertions(+)
(limited to 'plugins/tldr')
diff --git a/plugins/tldr/README.md b/plugins/tldr/README.md
index fb91d9d1f..03b1dfc73 100644
--- a/plugins/tldr/README.md
+++ b/plugins/tldr/README.md
@@ -13,3 +13,6 @@ plugins=(... tldr)
| Shortcut | Description |
|------------------------------------|----------------------------------------------------------------------------|
| Esc + tldr | add tldr before the previous command to see the tldr page for this command |
+
+## Note
+You also need to install ```tldr```.
--
cgit v1.2.3-70-g09d2