summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorbh <qn+git@excalibur.computer>2026-04-09 18:22:36 +0800
committerbh <qn+git@excalibur.computer>2026-04-09 18:22:36 +0800
commit4a0212c33216e5a2c9eec43fdbd05877565f21a7 (patch)
tree894232d877a03a84e6a9296d2be56e10f6df45e0 /lua
parent04d976831ccd9d6a3b8727138a7d8fb6d7a33450 (diff)
Allow multiline quotes in the dashboard
Diffstat (limited to 'lua')
-rw-r--r--lua/config/dashboard.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/lua/config/dashboard.lua b/lua/config/dashboard.lua
index 60c6fa1..67caabf 100644
--- a/lua/config/dashboard.lua
+++ b/lua/config/dashboard.lua
@@ -1,13 +1,17 @@
return function()
local db = require("dashboard")
--- Safe fortune function
+-- Fortune quote (supports multiline)
local function quote()
- local handle = io.popen([[while :; do f=$(fortune); [ $(printf '%s\n' "$f" | wc -l) -eq 1 ] && { printf '%s\n' "$f"; break; }; done]])
- local result = handle:read('*a')
+ local handle = io.popen("fortune -s")
+ local result = handle:read("*a")
handle:close()
- result = result:gsub('\r', ''):gsub('\n', ' ')
- return result
+ local lines = { "" }
+ for line in result:gmatch("[^\r\n]+") do
+ table.insert(lines, line)
+ end
+ table.insert(lines, "")
+ return lines
end
db.setup {
@@ -78,7 +82,7 @@ db.setup {
label = "Projects",
action = "Telescope find_files cwd="
},
- footer = { "", quote() },
+ footer = quote(),
},
}
end