From 428eb00d8947d35288f6d178d2f1dce30b09835e Mon Sep 17 00:00:00 2001 From: "antoine.lenours" Date: Fri, 31 Jan 2025 09:08:33 +0100 Subject: [PATCH] Update config with new plugins and none-ls --- lua/chadrc.lua | 2 +- lua/configs/none-ls.lua | 29 +++++++++++++++++++ lua/plugins/init.lua | 64 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 lua/configs/none-ls.lua diff --git a/lua/chadrc.lua b/lua/chadrc.lua index f6df64e..9f9eecc 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -6,7 +6,7 @@ local M = {} M.base46 = { - theme = "material-deep-ocean", + theme = "catppuccin", -- hl_override = { -- Comment = { italic = true }, diff --git a/lua/configs/none-ls.lua b/lua/configs/none-ls.lua new file mode 100644 index 0000000..4f9aaf9 --- /dev/null +++ b/lua/configs/none-ls.lua @@ -0,0 +1,29 @@ +local none_ls = require("null-ls") +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + + +local opts = { + sources = { + none_ls.builtins.formatting.gofmt, + none_ls.builtins.formatting.goimports_reviser, + none_ls.builtins.formatting.golines, + none_ls.builtins.formatting.prettierd, + }, + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ + group = augroup, + buffer = bufnr, + }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer= bufnr, + callback = function() + vim.lsp.buf.format({bufnr=bufnr}) + end, + }) + end + end, +} + +return opts diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 612632a..3a7c7e3 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -13,13 +13,73 @@ return { end, }, + { + "nvimtools/none-ls.nvim", + ft = "go", + opts = function () + return require "configs.none-ls" + end, + }, + + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "gopls", + "pyright", + "typescript-language-server", + "tailwindcss-language-server", + "prettierd", + "eslint-lsp", + } + } + }, + { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = { - "vim", "lua", "vimdoc", - "html", "css" + "vim", + "lua", + "vimdoc", + "html", + "css", + "typescript", + "go", + "rust", + "python", + "tsx" }, }, }, + + { + "ray-x/go.nvim", + config = function() + require("go").setup() + end, + event = {"CmdlineEnter"}, + ft = {"go", 'gomod'}, + build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries + }, + { + "kdheepak/lazygit.nvim", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "lg", "LazyGit", desc = "LazyGit" } + } + }, + }