diff --git a/lua/taken/plugins/flash.lua b/lua/taken/plugins/flash.lua new file mode 100644 index 0000000..c4ebe3a --- /dev/null +++ b/lua/taken/plugins/flash.lua @@ -0,0 +1,21 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, + config = function() + require("flash").setup({ + modes = { + char = { + jump_labels = true, + }, + }, + }) + end, +} diff --git a/lua/taken/plugins/lsp/lspconfig.lua b/lua/taken/plugins/lsp/lspconfig.lua index ae35132..fe290fd 100644 --- a/lua/taken/plugins/lsp/lspconfig.lua +++ b/lua/taken/plugins/lsp/lspconfig.lua @@ -11,7 +11,6 @@ return { }, event = { "BufReadPre", "BufNewFile" }, config = function() - require("lspconfig") local tserrortranslator = require("ts-error-translator") local on_attach = require("taken.utils.on_attach") local get_python_path = require("taken.utils.lsp").get_python_path @@ -29,18 +28,6 @@ return { [vim.diagnostic.severity.HINT] = "ﴞ ", [vim.diagnostic.severity.INFO] = " ", }, - -- linehl = { - -- [vim.diagnostic.severity.ERROR] = "DiagnosticSignError", - -- [vim.diagnostic.severity.WARN] = "DiagnosticSignWarn", - -- [vim.diagnostic.severity.HINT] = "DiagnosticSignHint", - -- [vim.diagnostic.severity.INFO] = "DiagnosticSignInfo", - -- }, - -- numhl = { - -- [vim.diagnostic.severity.ERROR] = "DiagnosticSignError", - -- [vim.diagnostic.severity.WARN] = "DiagnosticSignWarn", - -- [vim.diagnostic.severity.HINT] = "DiagnosticSignHint", - -- [vim.diagnostic.severity.INFO] = "DiagnosticSignInfo", - -- }, }) local defaultLsps = { @@ -52,6 +39,7 @@ return { "bashls", "marksman", "eslint", + -- "emmylua_ls", } vim.lsp.config("*", { @@ -59,96 +47,96 @@ return { on_attach = on_attach, }) - -- vim.lsp.config("emmylua_ls", { - -- capabilities = capabilities, - -- on_attach = on_attach, - -- }) - - -- lua - vim.lsp.config("lua_ls", { - capabilities = capabilities, - on_attach = on_attach, - settings = { - Lua = { - hint = { - enable = true, - }, - runtime = { - version = "LuaJIT", - }, - diagnostics = { - globals = { "vim" }, - }, - completion = { - callSnippet = "Replace", - }, - format = { - enable = false, + local lsps = { + { + lsp = "lua_ls", + config = { + capabilities = capabilities, + on_attach = on_attach, + settings = { + Lua = { + hint = { + enable = true, + }, + runtime = { + version = "LuaJIT", + }, + diagnostics = { + globals = { "vim" }, + }, + completion = { + callSnippet = "Replace", + }, + format = { + enable = false, + }, + }, }, }, }, - }) - - -- python - vim.lsp.config("pyright", { - capabilities = capabilities, - on_attach = on_attach, - before_init = function(_, config) - local python_path = get_python_path(config.root_dir) - if python_path == nil then - return - end - config.settings.python.pythonPath = get_python_path(config.root_dir) - end, - }) - - -- typescript - vim.lsp.config("ts_ls", { - capabilities = capabilities, - on_attach = on_attach, - settings = { - typescript = { - inlayHints = { - includeInlayParameterNameHints = "all", - includeInlayParameterNameHintsWhenArgumentMatchesName = true, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayVariableTypeHintsWhenTypeMatchesName = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, + { + lsp = "pyright", + config = { + capabilities = capabilities, + on_attach = on_attach, + before_init = function(_, config) + local python_path = get_python_path(config.root_dir) + if python_path == nil then + return + end + config.settings.python.pythonPath = get_python_path(config.root_dir) + end, }, - javascript = { - inlayHints = { - includeInlayParameterNameHints = "all", - includeInlayParameterNameHintsWhenArgumentMatchesName = true, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayVariableTypeHintsWhenTypeMatchesName = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, + }, + { + lsp = "ts_ls", + config = { + capabilities = capabilities, + on_attach = on_attach, + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = true, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayVariableTypeHintsWhenTypeMatchesName = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = true, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayVariableTypeHintsWhenTypeMatchesName = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, }, }, }, - }) - - -- powershell - vim.lsp.config("powershell_es", { - capabilities = capabilities, - on_attach = on_attach, - bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services", - }) + { + lsp = "powershell_es", + config = { + capabilities = capabilities, + on_attach = on_attach, + bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services", + }, + }, + } vim.lsp.enable(defaultLsps) - vim.lsp.enable({ - "lua_ls", - -- "emmylua_ls", - "pyright", - "ts_ls", - "powershell_es", - }) + + for _, l in ipairs(lsps) do + vim.lsp.config(l.lsp, l.config) + vim.lsp.enable(l.lsp) + end tserrortranslator.setup() end, diff --git a/lua/taken/plugins/lsp/mason.lua b/lua/taken/plugins/lsp/mason.lua index 833ad62..585d563 100644 --- a/lua/taken/plugins/lsp/mason.lua +++ b/lua/taken/plugins/lsp/mason.lua @@ -10,7 +10,6 @@ return { local mason = require("mason") local mason_lspconfig = require("mason-lspconfig") local mason_tool_installer = require("mason-tool-installer") - -- local mason_null_ls = require("mason-null-ls") mason.setup({ ui = { @@ -54,14 +53,5 @@ return { }, automatic_installation = true, }) - - -- mason_null_ls.setup({ - -- ensure_installed = { - -- "stylua", - -- "prettier", - -- "dprint", - -- }, - -- automatic_installation = true, - -- }) end, }