From b45fe90dd456089c3b375d0495ae494cdcc3a278 Mon Sep 17 00:00:00 2001 From: jaredgoldman Date: Wed, 10 Apr 2024 19:18:57 -0400 Subject: [PATCH] feat: suppress vim linting --- init.lua | 1 - lua/config/dashboard.lua | 65 +++++++++++++++++++++++++++++++++++++ lua/lsp.lua | 6 ++++ lua/plugins.lua | 69 ++++------------------------------------ requirements.md | 3 +- 5 files changed, 79 insertions(+), 65 deletions(-) create mode 100644 lua/config/dashboard.lua diff --git a/init.lua b/init.lua index ff9b8f0..6f5dc94 100644 --- a/init.lua +++ b/init.lua @@ -13,6 +13,5 @@ require("config.harpoon") require("config.autopairs") require("config.autotags") require("config.conform") --- require("config.dashboard") require("options") require("keymaps") diff --git a/lua/config/dashboard.lua b/lua/config/dashboard.lua new file mode 100644 index 0000000..17eefd2 --- /dev/null +++ b/lua/config/dashboard.lua @@ -0,0 +1,65 @@ +local M = {} + +M.dashboard_config = function() + local logo = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + 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 = LazyVim.telescope("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 LazyVim.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 = "qa", 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 + +return M diff --git a/lua/lsp.lua b/lua/lsp.lua index 6712300..ad9ae93 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -61,5 +61,11 @@ for _, lsp in ipairs(servers) do lspconfig[lsp].setup({ on_attach = on_attach, capabilities = capabilities, + -- For suppressing vim error messages in config + settings = { + Lua = { + diagnostics = { globals = { "vim" } }, + }, + }, }) end diff --git a/lua/plugins.lua b/lua/plugins.lua index 8f52a19..c611181 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,3 +1,4 @@ +local dashboard = require("config.dashboard") local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then @@ -14,77 +15,20 @@ end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ + -- Dashboard { "nvimdev/dashboard-nvim", event = "VimEnter", - opts = function() - local logo = [[ - ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z - ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z - ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z - ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z - ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ - ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ - ]] - - 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 = LazyVim.telescope("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 LazyVim.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 = "qa", 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, + opts = dashboard.dashboard_config, }, + -- Theming "tanvirtin/monokai.nvim", + "yorickpeterse/nvim-grey", + { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, { "onsails/lspkind.nvim", event = { "VimEnter" }, }, - { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, -- Auto-completion engine { "hrsh7th/nvim-cmp", @@ -144,5 +88,4 @@ require("lazy").setup({ opts = {}, }, "f-person/git-blame.nvim", - "yorickpeterse/nvim-grey", }) diff --git a/requirements.md b/requirements.md index 995bfab..18b1be5 100644 --- a/requirements.md +++ b/requirements.md @@ -10,5 +10,6 @@ - extended history x - auto-pairs x - lua vim linting x -- dashboard +- dashboard x +- suppress vim global warnings x - debugger