From 7049151967309c935a0ad0e19a91097107b8b655 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 26 Jul 2024 15:31:16 -0700 Subject: [PATCH] nvchad 2.5 config migration --- .../.config/nvim/lua/{custom => }/chadrc.lua | 11 +-- .../nvim/lua/{custom => }/configs/conform.lua | 0 nvchad/.config/nvim/lua/configs/lazy.lua | 47 +++++++++++++ nvchad/.config/nvim/lua/configs/lspconfig.lua | 22 ++++++ .../nvim/lua/custom/configs/lspconfig.lua | 18 ----- .../nvim/lua/custom/configs/overrides.lua | 66 ------------------ nvchad/.config/nvim/lua/custom/init.lua | 12 ---- .../nvim/lua/{custom => }/highlights.lua | 0 .../nvim/lua/{custom => }/mappings.lua | 0 nvchad/.config/nvim/lua/options.lua | 6 ++ .../{custom/plugins.lua => plugins/init.lua} | 68 +++++++++++++++++-- 11 files changed, 142 insertions(+), 108 deletions(-) rename nvchad/.config/nvim/lua/{custom => }/chadrc.lua (57%) rename nvchad/.config/nvim/lua/{custom => }/configs/conform.lua (100%) create mode 100644 nvchad/.config/nvim/lua/configs/lazy.lua create mode 100644 nvchad/.config/nvim/lua/configs/lspconfig.lua delete mode 100644 nvchad/.config/nvim/lua/custom/configs/lspconfig.lua delete mode 100644 nvchad/.config/nvim/lua/custom/configs/overrides.lua delete mode 100644 nvchad/.config/nvim/lua/custom/init.lua rename nvchad/.config/nvim/lua/{custom => }/highlights.lua (100%) rename nvchad/.config/nvim/lua/{custom => }/mappings.lua (100%) create mode 100644 nvchad/.config/nvim/lua/options.lua rename nvchad/.config/nvim/lua/{custom/plugins.lua => plugins/init.lua} (66%) diff --git a/nvchad/.config/nvim/lua/custom/chadrc.lua b/nvchad/.config/nvim/lua/chadrc.lua similarity index 57% rename from nvchad/.config/nvim/lua/custom/chadrc.lua rename to nvchad/.config/nvim/lua/chadrc.lua index 4da4317..34ea3a1 100644 --- a/nvchad/.config/nvim/lua/custom/chadrc.lua +++ b/nvchad/.config/nvim/lua/chadrc.lua @@ -1,8 +1,11 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua + ---@type ChadrcConfig local M = {} -- Path to overriding theme and highlights files -local highlights = require "custom.highlights" +local highlights = require "highlights" M.ui = { theme = "gruvchad", @@ -12,11 +15,9 @@ M.ui = { hl_add = highlights.add, } -M.plugins = "custom.plugins" +M.plugins = "plugins" -- check core.mappings for table structure -M.mappings = require "custom.mappings" - - +M.mappings = require "mappings" return M diff --git a/nvchad/.config/nvim/lua/custom/configs/conform.lua b/nvchad/.config/nvim/lua/configs/conform.lua similarity index 100% rename from nvchad/.config/nvim/lua/custom/configs/conform.lua rename to nvchad/.config/nvim/lua/configs/conform.lua diff --git a/nvchad/.config/nvim/lua/configs/lazy.lua b/nvchad/.config/nvim/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/nvchad/.config/nvim/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/nvchad/.config/nvim/lua/configs/lspconfig.lua b/nvchad/.config/nvim/lua/configs/lspconfig.lua new file mode 100644 index 0000000..95c3a03 --- /dev/null +++ b/nvchad/.config/nvim/lua/configs/lspconfig.lua @@ -0,0 +1,22 @@ +local on_attach = require("nvchad.configs.lspconfig").on_attach +local on_init = require("nvchad.configs.lspconfig").on_init +local capabilities = require("nvchad.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" +local servers = { "html", "cssls", "tsserver", "clangd", "ghdl_ls", "hls", "tailwindcss", "pyright", "julials" } + +-- lsps with default config +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, + } +end + +-- typescript +lspconfig.tsserver.setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, +} diff --git a/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua b/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua deleted file mode 100644 index 80b18d5..0000000 --- a/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua +++ /dev/null @@ -1,18 +0,0 @@ -local on_attach = require("plugins.configs.lspconfig").on_attach -local capabilities = require("plugins.configs.lspconfig").capabilities - -local lspconfig = require("lspconfig") - --- if you just want default config for the servers then put them in a table -local servers = { "html", "cssls", "tsserver", "clangd", "ghdl_ls", "hls", "tailwindcss", "pyright", "julials" } - -for _, lsp in ipairs(servers) do - lspconfig[lsp].setup({ - on_attach = on_attach, - capabilities = capabilities, - }) -end - --- --- lspconfig.pyright.setup { blabla} --- diff --git a/nvchad/.config/nvim/lua/custom/configs/overrides.lua b/nvchad/.config/nvim/lua/custom/configs/overrides.lua deleted file mode 100644 index 462b1e5..0000000 --- a/nvchad/.config/nvim/lua/custom/configs/overrides.lua +++ /dev/null @@ -1,66 +0,0 @@ -local M = {} - -M.treesitter = { - ensure_installed = { - "vim", - "lua", - "html", - "css", - "javascript", - "typescript", - "tsx", - "c", - "markdown", - "markdown_inline", - "prisma", - "haskell", - "python", - "zig", - }, - indent = { - enable = true, - -- disable = { - -- "python" - -- }, - }, -} - -M.mason = { - ensure_installed = { - -- lua stuff - "lua-language-server", - "stylua", - - -- web dev stuff - "css-lsp", - "html-lsp", - "typescript-language-server", - "deno", - "prettier", - - -- c/cpp stuff - "clangd", - "clang-format", - - -- Fun/joke langs - "hls", - }, -} - --- git support in nvimtree -M.nvimtree = { - git = { - enable = true, - }, - - renderer = { - highlight_git = true, - icons = { - show = { - git = true, - }, - }, - }, -} - -return M diff --git a/nvchad/.config/nvim/lua/custom/init.lua b/nvchad/.config/nvim/lua/custom/init.lua deleted file mode 100644 index 044d0d9..0000000 --- a/nvchad/.config/nvim/lua/custom/init.lua +++ /dev/null @@ -1,12 +0,0 @@ --- local autocmd = vim.api.nvim_create_autocmd - --- Auto resize panes when resizing nvim window --- autocmd("VimResized", { --- pattern = "*", --- command = "tabdo wincmd =", --- }) -vim.filetype.add({ - extension = { - mdx = 'mdx' - } -}) diff --git a/nvchad/.config/nvim/lua/custom/highlights.lua b/nvchad/.config/nvim/lua/highlights.lua similarity index 100% rename from nvchad/.config/nvim/lua/custom/highlights.lua rename to nvchad/.config/nvim/lua/highlights.lua diff --git a/nvchad/.config/nvim/lua/custom/mappings.lua b/nvchad/.config/nvim/lua/mappings.lua similarity index 100% rename from nvchad/.config/nvim/lua/custom/mappings.lua rename to nvchad/.config/nvim/lua/mappings.lua diff --git a/nvchad/.config/nvim/lua/options.lua b/nvchad/.config/nvim/lua/options.lua new file mode 100644 index 0000000..738f20b --- /dev/null +++ b/nvchad/.config/nvim/lua/options.lua @@ -0,0 +1,6 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! diff --git a/nvchad/.config/nvim/lua/custom/plugins.lua b/nvchad/.config/nvim/lua/plugins/init.lua similarity index 66% rename from nvchad/.config/nvim/lua/custom/plugins.lua rename to nvchad/.config/nvim/lua/plugins/init.lua index 3640cb6..cb954f6 100644 --- a/nvchad/.config/nvim/lua/custom/plugins.lua +++ b/nvchad/.config/nvim/lua/plugins/init.lua @@ -1,5 +1,3 @@ -local overrides = require("custom.configs.overrides") - ---@type NvPluginSpec[] local plugins = { @@ -8,15 +6,35 @@ local plugins = { { "neovim/nvim-lspconfig", config = function() - require("plugins.configs.lspconfig") - require("custom.configs.lspconfig") + -- require "plugins.configs.lspconfig" + require "configs.lspconfig" end, -- Override to setup mason-lspconfig }, -- override plugin configs { "williamboman/mason.nvim", - opts = overrides.mason, + opts = { + ensure_installed = { + -- lua stuff + "lua-language-server", + "stylua", + + -- web dev stuff + "css-lsp", + "html-lsp", + "typescript-language-server", + "deno", + "prettier", + + -- c/cpp stuff + "clangd", + "clang-format", + + -- Fun/joke langs + "hls", + }, + }, }, -- { @@ -24,7 +42,20 @@ local plugins = { -- opts = overrides.treesitter, }, { "nvim-tree/nvim-tree.lua", - opts = overrides.nvimtree, + opts = { + git = { + enable = true, + }, + + renderer = { + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, + }, }, -- Install a plugin @@ -63,7 +94,30 @@ local plugins = { dependencies = { "JoosepAlviste/nvim-ts-context-commentstring", }, - opts = overrides.treesitter, + opts = { + ensure_installed = { + "vim", + "lua", + "html", + "css", + "javascript", + "typescript", + "tsx", + "c", + "markdown", + "markdown_inline", + "prisma", + "haskell", + "python", + "zig", + }, + indent = { + enable = true, + -- disable = { + -- "python" + -- }, + }, + }, -- config = function(_, opts) -- dofile(vim.g.base46_cache .. "syntax") -- require("nvim-treesitter.configs").setup(opts)