feat: add additional configuration options to dashboard settings

This commit is contained in:
2024-09-15 07:33:17 -04:00
parent da34d98a1c
commit 04b057a757
7 changed files with 95 additions and 104 deletions
+15
View File
@@ -0,0 +1,15 @@
███ ███
████ ████
 ████ █████
█ ████ █████
██ ████ █████
███ ████ █████
████ ████ ████
█████ ████████
█████ ███████
█████ ██████
█████ █████
████ ████
███ ███
N E O V I M
+19 -4
View File
@@ -78,6 +78,21 @@ vim.g.tabline = "bufferline" ---@type string Options: [tabline]
-- │ │
-- ╰───────────────────────────╯
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ DASHBOARD ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
vim.g.dashboard = "alpha" ---@type string Options: [dashboard]
-- ╭───────────────────────────╮  alpha
-- │ │  nvim-dashboard
-- │ Dashboards: │  none
-- │ Choose a plugin from │
-- │ the list  │
-- │ │
-- ╰───────────────────────────╯
-- Dashboard logo file
vim.g.dash_logo = "logo/neovim.txt" ---@type string Options: [dash logo]
-- Dashboard header color
vim.g.DashboardHeaderColor = "#88fc9a"---@type string Options: [hex color]
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ STATUS LINE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
vim.g.statusline = "lualine" ---@type string Options: [statusline]
-- ╭───────────────────────────╮  lualine
@@ -87,7 +102,7 @@ vim.g.statusline = "lualine" ---@type string Options: [statusline]
-- │ the list  │  none
-- │ │
-- ╰───────────────────────────╯
--
-- Click git components on statusline to open LazyGit
vim.g.statusline_clickable_git = false ---@type boolean Options: <true|false>
-- Show wakatime stats on statusline
@@ -107,14 +122,14 @@ vim.g.stats_ignored_players = { ---@type string[] Options: [ignored playe
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ COLOR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-- Background color
vim.o.background = "dark" ---@type string Options: <dark|light>
-- Dashboard header color
vim.g.DashboardHeaderColor = "#88fc9a"---@type string Options: [hex color]
-- Disable Transparency
vim.g.disable_transparency = true ---@type boolean Options: <true|false>
-- Set colorcolumn
vim.opt.colorcolumn = "120" ---@type string|table Options: [column]
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Completion ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-- Cmp Window Border
vim.g.completion_round_borders_enabled = true ---@type boolean Options: <true|false>
vim.g.completion_borders = "rounded" ---@type string Options: [round|sharp|flat]
-- stylua: ignore end
+47 -84
View File
@@ -6,29 +6,35 @@
local M = {}
--- Function to setup the Alpha dashboard options
---@return table The alpha dashboard options
-- Define default path to the logo art
M.logo = vim.g.dash_logo or "logo/neovim.txt"
--- Alpha plugin configuration
M.alpha = {
--- Function to setup the Alpha dashboard options
---@return table dashboard The alpha dashboard options
opts = function()
-- Load the alpha plugin dashboard-nvim theme
local dashboard = require("alpha.themes.dashboard")
local header = {
[[ ███ ███ ]],
[[ ████ ████ ]],
[[  ████ █████ ]],
[[ █ ████ █████ ]],
[[ ██ ████ █████ ]],
[[ ███ ████ █████ ]],
[[ ████ ████ ████ ]],
[[ █████ ████████ ]],
[[ █████ ███████ ]],
[[ █████ ██████ ]],
[[ █████ █████ ]],
[[ ████ ████ ]],
[[ ███ ███ ]],
[[ ]],
[[ N E O V I M ]],
}
dashboard.section.header.val = header
--- Function to read the ASCII art from the logo file
---@param logo_path string The path to the logo file
---@return table art The ASCII art lines
local function read_ascii_art(logo_path)
local lines = {}
for line in io.lines(logo_path) do
table.insert(lines, line)
end
return lines
end
-- Read the ASCII art from the logo file
local ascii_art_lines = read_ascii_art(M.logo)
-- Add the ASCII art to the dashboard header
dashboard.section.header.val = ascii_art_lines
-- Add the dashboard buttons
-- stylua: ignore start
dashboard.section.buttons.val = {
---@diagnostic disable: param-type-mismatch
@@ -43,13 +49,17 @@ M.alpha = {
dashboard.button("l", "󰒲 " .. " Lazy", "<cmd> Lazy <cr>"),
dashboard.button("q", "" .. " Quit", "<cmd> qa <cr>"),
}
-- stylua: ignore end
for _, button in ipairs(dashboard.section.buttons.val) do
button.opts.hl = "AlphaButtons"
button.opts.hl_shortcut = "AlphaShortcut"
end
dashboard.section.header.opts.hl = "Conditional"
-- stylua: ignore end
-- Set up highlight groups for the dashboard
dashboard.section.header.opts.hl = "Conditional" or "AlphaHeader"
dashboard.section.footer.opts.hl = "AlphaFooter"
-- Set up the dashboard layout padding
local padding = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) })
if vim.fn.winheight(0) < 40 then
padding = 1
@@ -57,75 +67,28 @@ M.alpha = {
padding = 0
end
dashboard.opts.layout[1].val = padding
-- Return the dashboard options
return dashboard
end,
}
--- Dashboard-nvim plugin configuration
M.dashboard_nvim = {
-- stylua: ignore start
choices = {
{ -- Find File
action = 'lua LazyVim.pick("find_files")()',
desc = " Find File",
icon = "",
key = "f",
},
{ -- New File
action = "ene | startinsert",
desc = " New File",
icon = "",
key = "n",
},
{ -- Open Recent Files
action = 'lua LazyVim.pick("oldfiles")()',
desc = " Recent Files",
icon = "",
key = "r",
},
{ -- Find Text
action = 'lua LazyVim.pick("live_grep")()',
desc = " Find Text",
icon = "",
key = "g",
},
{ -- LazyGit
action = "LazyGit",
desc = " LazyGit",
icon = "",
key = "z",
},
{ -- Config
action = "lua LazyVim.pick.config_files()()",
desc = " Config",
icon = "",
key = "c",
},
{ -- Restore Session
action = 'lua require("persistence").load()',
desc = " Restore Session",
icon = "󰶮 ",
key = "s",
},
{ -- Remote Session
action = 'lua require("config.rootiest").load_remote()',
desc = " Remote Session",
icon = "",
key = "s",
},
{ -- Lazy
action = "Lazy",
desc = " Lazy",
icon = "󰒲 ",
key = "l",
},
{ -- Quit
action = function()
vim.api.nvim_input("<cmd>qa<cr>")
end,
desc = " Quit",
icon = "",
key = "q",
},
{ action = 'lua LazyVim.pick("find_files")()', desc = " Find File", icon = "", key = "f"},
{ action = "ene | startinsert", desc = " New File", icon = "", key = "n"},
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = "", key = "r"},
{ action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = "", key = "g"},
{ action = "LazyGit", desc = " LazyGit", icon = "", key = "z"},
{ action = "lua LazyVim.pick.config_files()()", desc = " Config", icon = "", key = "c"},
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "󰶮 ", key = "s"},
{ action = 'lua require("config.rootiest").load_remote()', desc = " Remote Session", icon = "", key = "s"},
{ action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l"},
{ action = function() vim.api.nvim_input("<cmd>qa<cr>") end, desc = " Quit", icon = "", key = "q"},
},
-- stylua: ignore end
}
return M
+2 -2
View File
@@ -49,7 +49,7 @@ return { -- cmp
end)
local border_opts = {
border = "rounded",
border = vim.g.completion_borders or "rounded",
}
local window_opts = {
completion = cmp.config.window.bordered(border_opts),
@@ -75,7 +75,7 @@ return { -- cmp
end,
},
completion = { completeopt = "menu,menuone,noinsert" },
window = vim.g.completion_round_borders_enabled and window_opts or {},
window = vim.g.completion_borders == "rounded" and window_opts or {},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
+6 -2
View File
@@ -6,8 +6,12 @@
return { -- Alpha
"goolord/alpha-nvim",
event = "VimEnter",
enabled = true,
opts = require("data").dash.alpha.opts,
enabled = require("data.func").check_global_var(
"dashboard",
"alpha",
"alpha"
),
opts = require("data.dash").alpha.opts,
config = function(_, dashboard)
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
+6 -3
View File
@@ -3,7 +3,6 @@
-- ╭─────────────────────────────────────────────────────────╮
-- │ Dashboard │
-- ╰─────────────────────────────────────────────────────────╯
local data = require("data")
return { --
-- Dashboard
@@ -65,7 +64,7 @@ return { --
file_height = logo_dimensions.height,
},
config = {
center = data.dash.dashboard_nvim.choices,
center = require("data.dash").dashboard_nvim.choices,
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
@@ -111,5 +110,9 @@ return { --
return opts
end,
enabled = false,
enabled = require("data.func").check_global_var(
"dashboard",
"nvim-dashboard",
"alpha"
),
}
-9
View File
@@ -81,12 +81,6 @@ function M.setup_indent_highlight()
},
scope = {
enabled = false,
-- show_start = true,
-- highlight = {
-- "IndentsScopeHighlight",
-- "IndentsScopeHighlight",
-- },
-- char = vim.g.scope_char or data.types.ibl.scope_char.hard,
},
exclude = {
filetypes = data.types.highlights.exclude,
@@ -115,9 +109,6 @@ function M.setup_indent_highlight()
},
})
-- Set colorcolumn
vim.cmd(":set colorcolumn=120")
-- Set NeoCodeium suggestion highlight
vim.api.nvim_set_hl(0, "NeoCodeiumSuggestion", { link = "Comment" })