aboutsummaryrefslogtreecommitdiff
path: root/common/config/nvim/lua/plugins/dashboard.lua
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2025-09-24 04:19:28 +0200
committersrdusr <trevorgray@srdusr.com>2025-09-24 04:19:28 +0200
commite95332b121672abaf9fd02692d81869b1e46c02d (patch)
tree9dc0def690d7941b18783733045ba091112e9452 /common/config/nvim/lua/plugins/dashboard.lua
parent0f6cee92221dc517bd756083e260dd9373851b82 (diff)
parent7ed2303648bf83bb081d9bd863660ebf2344ce47 (diff)
downloaddotfiles-e95332b121672abaf9fd02692d81869b1e46c02d.tar.gz
dotfiles-e95332b121672abaf9fd02692d81869b1e46c02d.zip
Merge commit '7ed2303648bf83bb081d9bd863660ebf2344ce47'
Diffstat (limited to 'common/config/nvim/lua/plugins/dashboard.lua')
-rwxr-xr-x[-rw-r--r--]common/config/nvim/lua/plugins/dashboard.lua114
1 files changed, 75 insertions, 39 deletions
diff --git a/common/config/nvim/lua/plugins/dashboard.lua b/common/config/nvim/lua/plugins/dashboard.lua
index f02242c..43a3461 100644..100755
--- a/common/config/nvim/lua/plugins/dashboard.lua
+++ b/common/config/nvim/lua/plugins/dashboard.lua
@@ -1,11 +1,31 @@
-local db = require('dashboard')
-local messages = require('plugins.messages')
+local M = {}
-function GetRandomMessage()
- -- Get a random index from the messages array
- local randomIndex = math.random(1, #messages)
- return messages[randomIndex]
-end
+--- Setup and configure dashboard.nvim
+-- This function initializes and configures the dashboard plugin
+-- @return boolean True if setup was successful, false otherwise
+function M.setup()
+ local ok, db = pcall(require, 'dashboard')
+ if not ok then
+ return false
+ end
+
+ local messages = {
+ "The only way to do great work is to love what you do. - Steve Jobs",
+ "Code is like humor. When you have to explain it, it's bad. - Cory House",
+ "First, solve the problem. Then, write the code. - John Johnson",
+ "Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler",
+ "The most disastrous thing that you can ever learn is your first programming language. - Alan Kay",
+ "The most important property of a program is whether it accomplishes the intention of its user. - C.A.R. Hoare",
+ "The best error message is the one that never shows up. - Thomas Fuchs",
+ "The most important skill for a programmer is the ability to effectively communicate ideas. - Gastón Jorquera",
+ "The only way to learn a new programming language is by writing programs in it. - Dennis Ritchie",
+ "The most damaging phrase in the language is 'We've always done it this way!' - Grace Hopper"
+ }
+
+ local function get_random_message()
+ local random_index = math.random(1, #messages)
+ return messages[random_index]
+ end
--vim.api.nvim_create_autocmd("VimEnter", {
-- callback = function()
@@ -16,10 +36,11 @@ end
-- end,
--})
-db.setup({
- theme = 'hyper',
+ -- Configure dashboard
+ db.setup({
+ theme = "hyper",
config = {
- mru = { limit = 10, label = '' },
+ mru = { limit = 20, label = "" },
project = { limit = 10 },
header = {
[[ ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗]],
@@ -31,46 +52,47 @@ db.setup({
},
disable_move = false,
shortcut = {
- { desc = ' Plugins', group = 'Number', action = 'PackerStatus', key = 'p' },
- --{ desc = " Plugins", group = "@property", action = "PackerStatus", key = "p" },
+ { desc = " Plugins", group = "Number", action = "PackerStatus", key = "p" },
+ {
+ desc = " Files",
+ group = "Number",
+ action = "Telescope find_files",
+ key = "f",
+ },
{
- desc = ' Files',
- group = 'Number',
- --group = "Label",
- action = 'Telescope find_files',
- key = 'f',
+ desc = " TODO",
+ group = "Number",
+ action = ":edit ~/documents/main/inbox/tasks/TODO.md",
+ key = "t",
},
{
- desc = ' Text',
- group = 'Number',
- --group = "Label",
- action = 'enew',
- key = 't',
+ desc = " New",
+ group = "Number",
+ action = "enew",
+ key = "e",
},
{
- desc = ' Grep',
- group = 'Number',
- --group = "Label",
- action = 'Telescope live_grep',
- key = 'g',
+ desc = " Grep",
+ group = "Number",
+ action = "Telescope live_grep",
+ key = "g",
},
{
- desc = ' Scheme',
- group = 'Number',
- --group = "Label",
- action = 'Telescope colorscheme',
- key = 's',
+ desc = " Scheme",
+ group = "Number",
+ action = "Telescope colorscheme",
+ key = "s",
},
{
- desc = ' Config',
- group = 'Number',
- --group = "Label",
- action = ':edit ~/.config/nvim/init.lua',
- key = 'c',
+ desc = " Config",
+ group = "Number",
+ action = ":edit ~/.config/nvim/init.lua",
+ key = "c",
},
},
footer = function()
- return { '', GetRandomMessage() }
+ return { "", "" }
+ --return { "", GetRandomMessage() }
end,
},
hide = {
@@ -80,7 +102,16 @@ db.setup({
},
})
---highlights
+-- Set keymaps only when dashboard is active
+vim.api.nvim_create_autocmd("FileType", {
+ group = vim.api.nvim_create_augroup("DashboardMappings", { clear = true }),
+ pattern = "dashboard",
+ callback = function()
+ vim.keymap.set("n", "e", "<Cmd>DashboardNewFile<CR>", { buffer = true })
+ vim.keymap.set("n", "q", "<Cmd>q!<CR>", { buffer = true })
+ vim.keymap.set("n", "<C-o>", "<C-o><C-o>", { buffer = true }) -- Allow Ctrl + o to act normally
+ end,
+})
---- General
--DashboardHeader DashboardFooter
---- Hyper theme
@@ -88,3 +119,8 @@ db.setup({
--DashboardMruTitle DashboardMruIcon DashboardFiles DashboardShotCutIcon
---- Doome theme
--DashboardDesc DashboardKey DashboardIcon DashboardShotCut
+
+ return true
+end
+
+return M