From 3117163053f28fb8d5e419dba525a1cc9636a48c Mon Sep 17 00:00:00 2001 From: armandogaliati Date: Thu, 6 Jun 2024 15:41:47 -0300 Subject: [PATCH] added dashboard --- init.lua | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 830fc70e..e279939c 100644 --- a/init.lua +++ b/init.lua @@ -849,6 +849,69 @@ require('lazy').setup({ vim.cmd.hi 'Comment gui=none' end, }, + { + 'nvimdev/dashboard-nvim', + lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin. + opts = function() + local logo = [[ +███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ +████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ +██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ +██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ +██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ +╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + logo = string.rep('\n', 8) .. logo .. '\n\n' + + local opts = { + theme = 'doom', + hide = { + -- this is taken care of by lualine + -- enabling this messes up the actual laststatus setting after loading a file + statusline = false, + }, + config = { + header = vim.split(logo, '\n'), + -- stylua: ignore + center = { + { action = "Telescope find_files", desc = " Find File", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, + { action = "Telescope oldfiles", desc = " Recent Files", icon = " ", key = "r" }, + { action = "Telescope live_grep", desc = " Find Text", icon = " ", key = "g" }, + { action = [[lua Telescope config_files()()]], desc = " Config", icon = " ", key = "c" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, + }, + footer = function() + local stats = require('lazy').stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { '⚡ Neovim loaded ' .. stats.loaded .. '/' .. stats.count .. ' plugins in ' .. ms .. 'ms' } + end, + }, + } + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(' ', 43 - #button.desc) + button.key_format = ' %s' + end + + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == 'lazy' then + vim.cmd.close() + vim.api.nvim_create_autocmd('User', { + pattern = 'DashboardLoaded', + callback = function() + require('lazy').show() + end, + }) + end + + return opts + end, + }, -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, @@ -966,6 +1029,6 @@ require('lazy').setup({ }, }, }) -require('lspconfig').pyright.setup {} + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et