feat: Nvim | update to NvChad 3
This commit is contained in:
@@ -1,252 +1,293 @@
|
||||
-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false
|
||||
-- List of all default plugins & their definitions
|
||||
local default_plugins = {
|
||||
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
return {
|
||||
-- Formatting
|
||||
{
|
||||
"NvChad/base46",
|
||||
branch = "v2.0",
|
||||
build = function()
|
||||
require("base46").load_all_highlights()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/ui",
|
||||
branch = "v2.0",
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
{
|
||||
"zbirenbaum/nvterm",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "nvterm"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require "base46.term"
|
||||
require("nvterm").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
event = "User FilePost",
|
||||
config = function(_, opts)
|
||||
require("colorizer").setup(opts)
|
||||
|
||||
-- execute colorizer as soon as possible
|
||||
vim.defer_fn(function()
|
||||
require("colorizer").attach_to_buffer(0)
|
||||
end, 0)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
opts = function()
|
||||
return { override = require "nvchad.icons.devicons" }
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "devicons")
|
||||
require("nvim-web-devicons").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
version = "2.20.7",
|
||||
event = "User FilePost",
|
||||
opts = function()
|
||||
return require("plugins.configs.others").blankline
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("core.utils").load_mappings "blankline"
|
||||
dofile(vim.g.base46_cache .. "blankline")
|
||||
require("indent_blankline").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||
build = ":TSUpdate",
|
||||
opts = function()
|
||||
return require "plugins.configs.treesitter"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "syntax")
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- git stuff
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "User FilePost",
|
||||
opts = function()
|
||||
return require("plugins.configs.others").gitsigns
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "git")
|
||||
require("gitsigns").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- lsp stuff
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
|
||||
opts = function()
|
||||
return require "plugins.configs.mason"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "mason")
|
||||
require("mason").setup(opts)
|
||||
|
||||
-- custom nvchad cmd to install all mason binaries listed
|
||||
vim.api.nvim_create_user_command("MasonInstallAll", function()
|
||||
if opts.ensure_installed and #opts.ensure_installed > 0 then
|
||||
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
|
||||
end
|
||||
end, {})
|
||||
|
||||
vim.g.mason_binaries_list = opts.ensure_installed
|
||||
end,
|
||||
"stevearc/conform.nvim",
|
||||
event = "BufWritePre",
|
||||
opts = require "configs.conform",
|
||||
},
|
||||
|
||||
-- LSP
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = "User FilePost",
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "configs.lspconfig"
|
||||
end,
|
||||
},
|
||||
|
||||
-- load luasnips + cmp related in insert mode only
|
||||
-- Treesitter
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{
|
||||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
|
||||
config = function(_, opts)
|
||||
require("plugins.configs.others").luasnip(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- autopairing of (){}[] etc
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-autopairs").setup(opts)
|
||||
|
||||
-- setup cmp for autopairs
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
|
||||
-- cmp sources plugins
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
},
|
||||
opts = function()
|
||||
return require "plugins.configs.cmp"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("cmp").setup(opts)
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, {
|
||||
"lua",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
})
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
|
||||
-- lazydev
|
||||
{ "folke/lazydev.nvim", ft = "lua", opts = {} },
|
||||
|
||||
-- grpc-nvim
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
keys = {
|
||||
{ "gcc", mode = "n", desc = "Comment toggle current line" },
|
||||
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
|
||||
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
|
||||
{ "gbc", mode = "n", desc = "Comment toggle current block" },
|
||||
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
|
||||
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
|
||||
},
|
||||
init = function()
|
||||
require("core.utils").load_mappings "comment"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("Comment").setup(opts)
|
||||
end,
|
||||
"hudclark/grpc-nvim",
|
||||
dependencies = "nvim-lua/plenary.nvim",
|
||||
},
|
||||
|
||||
-- file managing , picker etc
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||
init = function()
|
||||
require("core.utils").load_mappings "nvimtree"
|
||||
end,
|
||||
opts = function()
|
||||
return require "plugins.configs.nvimtree"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "nvimtree")
|
||||
require("nvim-tree").setup(opts)
|
||||
end,
|
||||
},
|
||||
-- git-worktree
|
||||
{ "ThePrimeagen/git-worktree.nvim" },
|
||||
|
||||
-- Telescope extension
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
cmd = "Telescope",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "telescope"
|
||||
end,
|
||||
opts = function()
|
||||
return require "plugins.configs.telescope"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "telescope")
|
||||
local telescope = require "telescope"
|
||||
telescope.setup(opts)
|
||||
|
||||
-- load extensions
|
||||
for _, ext in ipairs(opts.extensions_list) do
|
||||
telescope.load_extension(ext)
|
||||
end
|
||||
opts = function(_, opts)
|
||||
opts.extensions_list = opts.extensions_list or {}
|
||||
table.insert(opts.extensions_list, "git_worktree")
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
|
||||
-- Only load whichkey after all the gui
|
||||
-- noice
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
keys = { "<leader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
inc_rename = false,
|
||||
lsp_doc_border = false,
|
||||
},
|
||||
messages = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
},
|
||||
|
||||
-- trouble
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
opts = {},
|
||||
cmd = "Trouble",
|
||||
},
|
||||
|
||||
-- Mason
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, {
|
||||
"rust-analyzer",
|
||||
"typescript-language-server",
|
||||
"prettier",
|
||||
"js-debug-adapter",
|
||||
"terraform-ls",
|
||||
"gopls",
|
||||
"pyright",
|
||||
"mypy",
|
||||
"ruff",
|
||||
"black",
|
||||
"lua-language-server",
|
||||
"nil",
|
||||
"phpactor",
|
||||
})
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
|
||||
-- copilot
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
keymap = {
|
||||
accept = "<C-o>",
|
||||
},
|
||||
},
|
||||
panel = { enabled = false },
|
||||
},
|
||||
},
|
||||
|
||||
-- rust.vim
|
||||
{
|
||||
"rust-lang/rust.vim",
|
||||
ft = "rust",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "whichkey"
|
||||
vim.g.rustfmt_autosave = 1
|
||||
end,
|
||||
cmd = "WhichKey",
|
||||
},
|
||||
|
||||
-- rust-tools
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
ft = "rust",
|
||||
dependencies = { "neovim/nvim-lspconfig", "nvim-lua/plenary.nvim" },
|
||||
opts = function()
|
||||
local nvlsp = require "nvchad.configs.lspconfig"
|
||||
return {
|
||||
server = {
|
||||
tools = {
|
||||
hover_actions = {
|
||||
auto_focus = true,
|
||||
},
|
||||
},
|
||||
on_attach = nvlsp.on_attach,
|
||||
capabilities = nvlsp.capabilities,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- lazygit
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
},
|
||||
|
||||
-- lazydocker
|
||||
{
|
||||
"crnvl96/lazydocker.nvim",
|
||||
opts = {},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
},
|
||||
|
||||
-- crates
|
||||
{
|
||||
"saecki/crates.nvim",
|
||||
event = { "BufRead Cargo.toml" },
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "whichkey")
|
||||
require("which-key").setup(opts)
|
||||
local crates = require "crates"
|
||||
crates.setup(opts)
|
||||
local cmp = require "cmp"
|
||||
local sources = vim.deepcopy(cmp.get_config().sources or {})
|
||||
table.insert(sources, { name = "crates" })
|
||||
cmp.setup.buffer { sources = sources }
|
||||
crates.show()
|
||||
end,
|
||||
},
|
||||
|
||||
-- cmp override
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function(_, opts)
|
||||
local cmp = require "cmp"
|
||||
opts.completion.completeopt = "menu,menuone,noselect"
|
||||
opts.mapping["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = false,
|
||||
}
|
||||
table.insert(opts.sources, { name = "crates" })
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
|
||||
-- cloak
|
||||
{
|
||||
"laytan/cloak.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
enabled = true,
|
||||
cloak_character = "*",
|
||||
highlight_group = "Comment",
|
||||
patterns = {
|
||||
{
|
||||
file_pattern = {
|
||||
".env*",
|
||||
"wrangler.toml",
|
||||
".dev.vars",
|
||||
},
|
||||
cloak_pattern = "=.+",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- avante
|
||||
{
|
||||
"yetone/avante.nvim",
|
||||
build = vim.fn.has "win32" ~= 0
|
||||
and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false"
|
||||
or "make",
|
||||
event = "VeryLazy",
|
||||
version = false,
|
||||
opts = {
|
||||
instructions_file = "avante.md",
|
||||
provider = "claude",
|
||||
providers = {
|
||||
claude = {
|
||||
endpoint = "https://api.anthropic.com",
|
||||
model = "claude-sonnet-4-20250514",
|
||||
timeout = 30000,
|
||||
extra_request_body = {
|
||||
temperature = 0.75,
|
||||
max_tokens = 20480,
|
||||
},
|
||||
},
|
||||
moonshot = {
|
||||
endpoint = "https://api.moonshot.ai/v1",
|
||||
model = "kimi-k2-0711-preview",
|
||||
timeout = 30000,
|
||||
extra_request_body = {
|
||||
temperature = 0.75,
|
||||
max_tokens = 32768,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"echasnovski/mini.pick",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"ibhagwan/fzf-lua",
|
||||
"stevearc/dressing.nvim",
|
||||
"folke/snacks.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"zbirenbaum/copilot.lua",
|
||||
{
|
||||
"HakonHarnes/img-clip.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
default = {
|
||||
embed_image_as_base64 = false,
|
||||
prompt_for_file_name = false,
|
||||
drag_and_drop = {
|
||||
insert_mode = true,
|
||||
},
|
||||
use_absolute_path = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
opts = {
|
||||
file_types = { "markdown", "Avante" },
|
||||
},
|
||||
ft = { "markdown", "Avante" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
if #config.plugins > 0 then
|
||||
table.insert(default_plugins, { import = config.plugins })
|
||||
end
|
||||
|
||||
require("lazy").setup(default_plugins, config.lazy_nvim)
|
||||
|
||||
Reference in New Issue
Block a user