diff --git a/.config/nvim/lua/lazyvim/plugins/cmp.lua b/.config/nvim/lua/lazyvim/plugins/cmp.lua index 370f8a2..7128969 100644 --- a/.config/nvim/lua/lazyvim/plugins/cmp.lua +++ b/.config/nvim/lua/lazyvim/plugins/cmp.lua @@ -7,7 +7,7 @@ return { "hrsh7th/cmp-path", "hrsh7th/cmp-emoji", "hrsh7th/cmp-buffer", - "saadparwaiz1/cmp_luasnip", + -- "saadparwaiz1/cmp_luasnip", { "zbirenbaum/copilot-cmp", dependencies = "copilot.lua", @@ -31,11 +31,11 @@ return { completion = { completeopt = "menu,menuone,noinsert", }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, + -- snippet = { + -- expand = function(args) + -- require("luasnip").lsp_expand(args.body) + -- end, + -- }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), @@ -47,7 +47,7 @@ return { }), sources = cmp.config.sources({ { name = "nvim_lsp" }, - { name = "luasnip" }, + -- { name = "luasnip" }, { name = "path" }, { name = "emoji" }, { name = "buffer" }, diff --git a/.config/nvim/lua/lazyvim/plugins/comments.lua b/.config/nvim/lua/lazyvim/plugins/comments.lua index 2dd9c01..ad2b18e 100644 --- a/.config/nvim/lua/lazyvim/plugins/comments.lua +++ b/.config/nvim/lua/lazyvim/plugins/comments.lua @@ -1,31 +1,32 @@ return { - { - "folke/todo-comments.nvim", - cmd = { "TodoTrouble", "TodoTelescope" }, - event = "BufReadPost", - config = true, + { + "folke/todo-comments.nvim", + cmd = { "TodoTrouble", "TodoTelescope" }, + event = "BufReadPost", + config = true, -- stylua: ignore keys = { - { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, - { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, - { "tt", "TodoTrouble", desc = "Todo Trouble" }, - { "tT", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo Trouble" }, - { "tf", "TodoTelescope", desc = "Todo Telescope" }, + { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, + { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, + { "tt", "TodoTrouble", desc = "Todo Trouble" }, + { "tT", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo Trouble" }, + { "tf", "TodoTelescope", desc = "Todo Telescope" }, }, - }, - { "JoosepAlviste/nvim-ts-context-commentstring" }, - { - "echasnovski/mini.comment", - event = "VeryLazy", - opts = { - hooks = { - pre = function() - require("ts_context_commentstring.internal").update_commentstring({}) - end, - }, - }, - config = function(_, opts) - require("mini.comment").setup(opts) - end, - }, + }, + { "JoosepAlviste/nvim-ts-context-commentstring" }, + { + "echasnovski/mini.comment", + event = "VeryLazy", + opts = { + hooks = { + pre = function() + require('ts_context_commentstring').setup {} + vim.g.skip_ts_context_commentstring_module = true + end, + }, + }, + config = function(_, opts) + require("mini.comment").setup(opts) + end, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua index b0f2949..eddf51a 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua @@ -1,222 +1,222 @@ return { - -- lspconfig - { - "neovim/nvim-lspconfig", - event = "BufReadPre", - dependencies = { - { "folke/neoconf.nvim", cmd = "Neoconf", config = true }, - { "folke/neodev.nvim", config = true }, - "mason.nvim", - "williamboman/mason-lspconfig.nvim", - "hrsh7th/cmp-nvim-lsp", - }, - opts = { - -- options for vim.diagnostic.config() - diagnostics = { - underline = true, - update_in_insert = true, - virtual_text = { spacing = 4, prefix = "●" }, - severity_sort = true, - }, - autoformat = true, - servers = { - lua_ls = { - mason = true, - settings = { - Lua = { - workspace = { - checkThirdParty = false, - }, - completion = { - callSnippet = "Replace", - }, - }, - }, - }, - ltex = { - mason = true, - settings = { - ltex = { - language = "en-AU", - }, - }, - }, - rust_analyzer = { - mason = false, - cmd = { - "rustup", - "run", - "stable", - "rust-analyzer", - }, - }, - omnisharp = {}, - }, - setup = { - -- additional setup can be added here. - omnisharp = function(_, _) - require("lazyvim.utils").on_attach(function(client, _) - if client.name == "omnisharp" then - ---@type string[] - local tokenModifiers = - client.server_capabilities.semanticTokensProvider.legend.tokenModifiers - for i, v in ipairs(tokenModifiers) do - tokenModifiers[i] = v:gsub(" ", "_") - end - ---@type string[] - local tokenTypes = client.server_capabilities.semanticTokensProvider.legend.tokenTypes - for i, v in ipairs(tokenTypes) do - tokenTypes[i] = v:gsub(" ", "_") - end - end - end) - return false - end, - }, - }, - config = function(_, opts) - local Util = require("lazyvim.utils") - -- setup autoformat - require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat + -- lspconfig + { + "neovim/nvim-lspconfig", + event = "BufReadPre", + dependencies = { + { "folke/neoconf.nvim", cmd = "Neoconf", config = true }, + { "folke/neodev.nvim", config = true }, + "mason.nvim", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + }, + opts = { + -- options for vim.diagnostic.config() + diagnostics = { + underline = true, + update_in_insert = true, + virtual_text = { spacing = 4, prefix = "●" }, + severity_sort = true, + }, + autoformat = true, + servers = { + lua_ls = { + mason = true, + settings = { + Lua = { + workspace = { + checkThirdParty = false, + }, + completion = { + callSnippet = "Replace", + }, + }, + }, + }, + ltex = { + mason = true, + settings = { + ltex = { + language = "en-AU", + }, + }, + }, + rust_analyzer = { + mason = false, + cmd = { + "rustup", + "run", + "stable", + "rust-analyzer", + }, + }, + omnisharp = {}, + }, + setup = { + -- additional setup can be added here. + omnisharp = function(_, _) + require("lazyvim.utils").on_attach(function(client, _) + if client.name == "omnisharp" then + ---@type string[] + local tokenModifiers = + client.server_capabilities.semanticTokensProvider.legend.tokenModifiers + for i, v in ipairs(tokenModifiers) do + tokenModifiers[i] = v:gsub(" ", "_") + end + ---@type string[] + local tokenTypes = client.server_capabilities.semanticTokensProvider.legend.tokenTypes + for i, v in ipairs(tokenTypes) do + tokenTypes[i] = v:gsub(" ", "_") + end + end + end) + return false + end, + }, + }, + config = function(_, opts) + local Util = require("lazyvim.utils") + -- setup autoformat + require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat - -- setup formatting and keymaps - Util.on_attach(function(client, buffer) - require("lazyvim.plugins.lsp.format").on_attach(client, buffer) - require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) - end) + -- setup formatting and keymaps + Util.on_attach(function(client, buffer) + require("lazyvim.plugins.lsp.format").on_attach(client, buffer) + require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) + end) - -- diagnostics - for name, icon in pairs(require("lazyvim.config.icons").diagnostics) do - name = "DiagnosticSign" .. name - vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) - end + -- diagnostics + for name, icon in pairs(require("lazyvim.config.icons").diagnostics) do + name = "DiagnosticSign" .. name + vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) + end - if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then - opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●" - or function(diagnostic) - local icons = require("lazyvim.config").icons.diagnostics - for d, icon in pairs(icons) do - if diagnostic.severity == vim.diagnostic.severity[d:upper()] then - return icon - end - end - end - end + if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then + opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●" + or function(diagnostic) + local icons = require("lazyvim.config").icons.diagnostics + for d, icon in pairs(icons) do + if diagnostic.severity == vim.diagnostic.severity[d:upper()] then + return icon + end + end + end + end - vim.diagnostic.config(vim.deepcopy(opts.diagnostics)) + vim.diagnostic.config(vim.deepcopy(opts.diagnostics)) - local servers = opts.servers - local capabilities = vim.tbl_deep_extend( - "force", - {}, - vim.lsp.protocol.make_client_capabilities(), - require("cmp_nvim_lsp").default_capabilities(), - opts.capabilities or {} - ) + local servers = opts.servers + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities(), + opts.capabilities or {} + ) - local function setup(server) - local server_opts = vim.tbl_deep_extend("force", { - capabilities = vim.deepcopy(capabilities), - }, servers[server] or {}) + local function setup(server) + local server_opts = vim.tbl_deep_extend("force", { + capabilities = vim.deepcopy(capabilities), + }, servers[server] or {}) - if opts.setup[server] then - if opts.setup[server](server, server_opts) then - return - end - elseif opts.setup["*"] then - if opts.setup["*"](server, server_opts) then - return - end - end - require("lspconfig")[server].setup(server_opts) - end + if opts.setup[server] then + if opts.setup[server](server, server_opts) then + return + end + elseif opts.setup["*"] then + if opts.setup["*"](server, server_opts) then + return + end + end + require("lspconfig")[server].setup(server_opts) + end - -- get all the servers that are available thourgh mason-lspconfig - local have_mason, mlsp = pcall(require, "mason-lspconfig") - local all_mslp_servers = {} - if have_mason then - all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package) - end + -- get all the servers that are available thourgh mason-lspconfig + local have_mason, mlsp = pcall(require, "mason-lspconfig") + local all_mslp_servers = {} + if have_mason then + all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package) + end - local ensure_installed = {} ---@type string[] - for server, server_opts in pairs(servers) do - if server_opts then - server_opts = server_opts == true and {} or server_opts - -- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig - if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then - setup(server) - else - ensure_installed[#ensure_installed + 1] = server - end - end - end + local ensure_installed = {} ---@type string[] + for server, server_opts in pairs(servers) do + if server_opts then + server_opts = server_opts == true and {} or server_opts + -- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig + if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then + setup(server) + else + ensure_installed[#ensure_installed + 1] = server + end + end + end - if have_mason then - mlsp.setup({ ensure_installed = ensure_installed }) - mlsp.setup_handlers({ setup }) - end - end, - }, + if have_mason then + mlsp.setup({ ensure_installed = ensure_installed }) + mlsp.setup_handlers({ setup }) + end + end, + }, - -- formatting - { - "stevearc/conform.nvim", - opts = { - formatters_by_ft = { - lua = { "stylua" }, - -- Conform will run multiple formatters sequentially - python = { "isort", "black" }, - -- Use a sub-list to run only the first available formatter - typescript = { { "prettierd", "prettier" } }, - cs = { "csharpier" }, - }, - formatters = { - csharpier = { - command = "dotnet-csharpier", - args = { "--write-stdout" }, - }, - }, - }, - }, + -- formatting + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + lua = { "stylua" }, + -- Conform will run multiple formatters sequentially + python = { "isort", "black" }, + -- Use a sub-list to run only the first available formatter + typescript = { { "prettierd", "prettier" } }, + cs = { "csharpier" }, + }, + formatters = { + csharpier = { + command = "dotnet-csharpier", + args = { "--write-stdout" }, + }, + }, + }, + }, - -- cmdline tools and lsp servers - { - "williamboman/mason.nvim", - cmd = "Mason", - keys = { { "lM", "Mason", desc = "Mason" } }, - opts = { - automatic_istallation = false, - ensure_installed = { - "stylua", - "shellcheck", - "shfmt", - }, - }, - config = function(_, opts) - require("mason").setup() - local mr = require("mason-registry") - for _, tool in ipairs(opts.ensure_installed) do - local p = mr.get_package(tool) - if not p:is_installed() then - p:install() - end - end - end, - }, + -- cmdline tools and lsp servers + { + "williamboman/mason.nvim", + cmd = "Mason", + keys = { { "lM", "Mason", desc = "Mason" } }, + opts = { + automatic_istallation = false, + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + }, + }, + config = function(_, opts) + require("mason").setup() + local mr = require("mason-registry") + for _, tool in ipairs(opts.ensure_installed) do + local p = mr.get_package(tool) + if not p:is_installed() then + p:install() + end + end + end, + }, - -- language specific tooling - { - "simrat39/rust-tools.nvim", - opts = { - server = { - on_attach = function(_, bufnr) - local rt = require("rust-tools") - -- Hover actions - vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) - end, - }, - }, - }, + -- language specific tooling + { + "simrat39/rust-tools.nvim", + opts = { + server = { + on_attach = function(_, bufnr) + local rt = require("rust-tools") + -- Hover actions + vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) + end, + }, + }, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua b/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua index 162d03b..a1538be 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua @@ -1,53 +1,53 @@ local M = {} function M.disable_deno_formatting(client) - if client.name == "denols" then - require("null-ls").disable({ "prettier" }) - end + if client.name == "denols" then + require("null-ls").disable({ "prettier" }) + end end function M.resolve_tsserver_deno(client) - local active_clients = vim.lsp.get_active_clients() - if client.name == "denols" then - for _, client_ in pairs(active_clients) do - -- stop tsserver if denols is already active - if client_.name == "tsserver" then - client_.stop() - end - end - elseif client.name == "tsserver" then - for _, client_ in pairs(active_clients) do - -- prevent tsserver from starting if denols is already active - if client_.name == "denols" then - client.stop() - end - end - end + local active_clients = vim.lsp.get_active_clients() + if client.name == "denols" then + for _, client_ in pairs(active_clients) do + -- stop tsserver if denols is already active + if client_.name == "tsserver" then + client_.stop() + end + end + elseif client.name == "tsserver" then + for _, client_ in pairs(active_clients) do + -- prevent tsserver from starting if denols is already active + if client_.name == "denols" then + client.stop() + end + end + end end function M.disable_others_when_zk(client) - local active_clients = vim.lsp.get_active_clients() - if client.name == "zk" then - for _, client_ in pairs(active_clients) do - -- stop ltex if zk is already active - if client_.name == "ltex" then - client_.stop() - end - end - elseif client.name == "ltex" then - for _, client_ in pairs(active_clients) do - -- prevent ltex from starting if zk is already active - if client_.name == "zk" then - client.stop() - end - end - end + local active_clients = vim.lsp.get_active_clients() + if client.name == "zk" then + for _, client_ in pairs(active_clients) do + -- stop ltex if zk is already active + if client_.name == "ltex" then + client_.stop() + end + end + elseif client.name == "ltex" then + for _, client_ in pairs(active_clients) do + -- prevent ltex from starting if zk is already active + if client_.name == "zk" then + client.stop() + end + end + end end function M.on_attach(client, bufnr) - M.disable_deno_formatting(client) - M.resolve_tsserver_deno(client) - M.disable_others_when_zk(client) + -- M.disable_deno_formatting(client) + -- M.resolve_tsserver_deno(client) + M.disable_others_when_zk(client) end return M diff --git a/.config/nvim/lua/lazyvim/plugins/snippets.lua b/.config/nvim/lua/lazyvim/plugins/snippets.lua index 001364d..215dc00 100644 --- a/.config/nvim/lua/lazyvim/plugins/snippets.lua +++ b/.config/nvim/lua/lazyvim/plugins/snippets.lua @@ -1,21 +1,21 @@ return { - { - "L3MON4D3/LuaSnip", - dependencies = { - "rafamadriz/friendly-snippets", - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - end, - }, - opts = { - history = true, - delete_check_events = "TextChanged", - }, - -- stylua: ignore - keys = { - { "", function() return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" end, expr = true, silent = true, mode = "i", }, - { "", function() require("luasnip").jump(1) end, mode = "s", }, - { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" }, }, - }, - }, + -- { + -- "L3MON4D3/LuaSnip", + -- dependencies = { + -- "rafamadriz/friendly-snippets", + -- config = function() + -- require("luasnip.loaders.from_vscode").lazy_load() + -- end, + -- }, + -- opts = { + -- history = true, + -- delete_check_events = "TextChanged", + -- }, + -- -- stylua: ignore + -- keys = { + -- { "", function() return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" end, expr = true, silent = true, mode = "i", }, + -- { "", function() require("luasnip").jump(1) end, mode = "s", }, + -- { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" }, }, + -- }, + -- }, } diff --git a/.config/nvim/lua/lazyvim/plugins/treesitter.lua b/.config/nvim/lua/lazyvim/plugins/treesitter.lua index e9181f2..d079212 100644 --- a/.config/nvim/lua/lazyvim/plugins/treesitter.lua +++ b/.config/nvim/lua/lazyvim/plugins/treesitter.lua @@ -1,42 +1,41 @@ return { - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - dependencies = { - "treesitter-context", - }, - opts = { - matchup = { enable = true }, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - autopairs = { enable = true }, - indent = { enable = true }, - context_commentstring = { enable = true, enable_autocmd = false }, - ensure_installed = { - "c_sharp", - "lua", - "c", - "vim", - "javascript", - "regex", - "markdown_inline", - "typescript", - "html", - "jsonc", - "go", - }, - auto_install = true, - }, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - end, - }, - { - "nvim-treesitter/nvim-treesitter-context", - name = "treesitter-context", - lazy = true, - opts = {}, - }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + dependencies = { + "treesitter-context", + }, + opts = { + matchup = { enable = true }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + autopairs = { enable = true }, + indent = { enable = true }, + ensure_installed = { + "c_sharp", + "lua", + "c", + "vim", + "javascript", + "regex", + "markdown_inline", + "typescript", + "html", + "jsonc", + "go", + }, + auto_install = true, + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, + }, + { + "nvim-treesitter/nvim-treesitter-context", + name = "treesitter-context", + lazy = true, + opts = {}, + }, }