From 468195ab00baa215392dbef52018e180579498b5 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Tue, 7 Oct 2025 19:40:37 -0500 Subject: [PATCH] many small fixes and improvements, i think --- lua/autocommands.lua | 2 +- lua/options.lua | 4 +- lua/plugins/cmp_autocompletion.lua | 1 + ...ficaitons.lua => fidget_notifications.lua} | 0 lua/plugins/files_nvim_tree.lua | 3 - lua/plugins/lsp.lua | 89 ++++++++++--------- lua/plugins/treesitter.lua | 11 +-- 7 files changed, 53 insertions(+), 57 deletions(-) rename lua/plugins/{fidget_notificaitons.lua => fidget_notifications.lua} (100%) diff --git a/lua/autocommands.lua b/lua/autocommands.lua index 10264fb..22ba7c4 100644 --- a/lua/autocommands.lua +++ b/lua/autocommands.lua @@ -32,7 +32,7 @@ vim.filetype.add({ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { group = group, callback = function() - if vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then + if vim.bo.buftype ~= "terminal" and vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then vim.api.nvim_command("stopinsert") end end, diff --git a/lua/options.lua b/lua/options.lua index 0098e46..37d6d80 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -14,7 +14,7 @@ vim.opt.mouse = "a" vim.opt.updatetime = 250 -- Decrease mapped sequence wait time -- Displays which-key popup sooner -vim.opt.timeoutlen = 300 +vim.opt.timeoutlen = 250 -- line numbering, relative vim.opt.number = true @@ -54,7 +54,6 @@ vim.opt.list = true vim.opt.listchars = { tab = "│ ", trail = "·", nbsp = "␣", eol = "↴" } -- Search settings -vim.opt.hlsearch = true vim.opt.incsearch = true -- Preview substitutions live, as you type @@ -71,6 +70,7 @@ vim.opt.splitright = true vim.opt.completeopt = "menu,menuone,noinsert" vim.diagnostic.config({ float = { border = "single" }, + virtual_text = false, }) -- Minimal number of screen lines to keep above and below the cursor. diff --git a/lua/plugins/cmp_autocompletion.lua b/lua/plugins/cmp_autocompletion.lua index 3d677ea..17f9270 100644 --- a/lua/plugins/cmp_autocompletion.lua +++ b/lua/plugins/cmp_autocompletion.lua @@ -46,6 +46,7 @@ return { -- Scroll the documentation window [b]ack / [f]orward [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.abort(), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.abort() diff --git a/lua/plugins/fidget_notificaitons.lua b/lua/plugins/fidget_notifications.lua similarity index 100% rename from lua/plugins/fidget_notificaitons.lua rename to lua/plugins/fidget_notifications.lua diff --git a/lua/plugins/files_nvim_tree.lua b/lua/plugins/files_nvim_tree.lua index ffd91fb..a6730a0 100644 --- a/lua/plugins/files_nvim_tree.lua +++ b/lua/plugins/files_nvim_tree.lua @@ -159,9 +159,6 @@ return { vim.keymap.set("n", "m", api.marks.toggle, opts("Toggle Bookmark")) vim.keymap.set("n", "c", api.fs.copy.absolute_path, opts("Copy Path to Clipboard")) - - vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("Close Directory")) - vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help")) end, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 45925af..c4b0cdb 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -70,11 +70,13 @@ return { end, }) - local capabilities = vim.lsp.protocol.make_client_capabilities() - U.safeRequire("cmp_nvim_lsp", function(c) - capabilities = vim.tbl_deep_extend("force", capabilities, c.default_capabilities()) - end) - local schemastore = require("schemastore") + local capabilities = vim.lsp.protocol.make_client_capabilities() + U.safeRequire("cmp_nvim_lsp", function(c) + capabilities = vim.tbl_deep_extend("force", capabilities, c.default_capabilities()) + end) + -- Export common capabilities to all servers via vim.lsp.config('*') + vim.lsp.config('*', { capabilities = capabilities }) + local schemastore = require("schemastore") -- TODO finish porting over lsp configs: https://github.com/RingOfStorms/nvim/blob/master/lua/plugins/lsp.lua local servers = { @@ -84,7 +86,6 @@ return { -- But for many setups, the LSP (`ts_ls`) will work just fine -- Note that `rust-analyzer` is done via mrcjkb/rustaceanvim plugin above, do not register it here. lua_ls = { - capabilities = capabilities, settings = { Lua = { runtime = { @@ -133,26 +134,21 @@ return { -- }, -- }, gopls = { - capabilities = capabilities, single_file_support = true, }, nil_ls = { -- nix - capabilities = capabilities, }, ts_ls = { -- typescript/javascript - capabilities = capabilities, implicitProjectConfiguration = { checkJs = true, }, }, svelte = { -- svelte - capabilities = capabilities, }, tailwindcss = { -- tailwind css - capabilities = capabilities, -- https://www.tailwind-variants.org/docs/getting-started#intellisense-setup-optional tailwindCSS = { experimental = { @@ -164,11 +160,9 @@ return { }, cssls = { -- css - capabilities = capabilities, }, jsonls = { -- json - capabilities = capabilities, settings = { json = { schemas = schemastore.json.schemas(), @@ -178,19 +172,15 @@ return { }, -- python pylsp = { - capabilities = capabilities, }, marksman = { -- markdown - capabilities = capabilities, }, taplo = { -- toml - capabilities = capabilities, }, yamlls = { -- yaml - capabilities = capabilities, settings = { yaml = { schemas = schemastore.yaml.schemas(), @@ -203,40 +193,53 @@ return { }, lemminx = { -- xml - capabilities = capabilities, }, -- ocamllsp = { -- -- ocaml -- capabilities = capabilities, -- } } - if NIX then - local lsp_servers = vim.tbl_keys(servers or {}) - for _, server_name in ipairs(lsp_servers) do - local server_opts = servers[server_name] or {} - vim.lsp.config[server_name] = server_opts + -- Remove new global default keymaps added by Nvim if you prefer your own bindings + local global_unmaps = { + { mode = 'n', lhs = 'gra' }, + { mode = 'n', lhs = 'gri' }, + { mode = 'n', lhs = 'grn' }, + { mode = 'n', lhs = 'grr' }, + { mode = 'n', lhs = 'grt' }, + { mode = 'n', lhs = 'gO' }, + { mode = 'n', lhs = 'K' }, + { mode = 'i', lhs = '' }, + } + for _, m in ipairs(global_unmaps) do + pcall(vim.keymap.del, m.mode, m.lhs) + end + + if NIX then + local lsp_servers = vim.tbl_keys(servers or {}) + for _, server_name in ipairs(lsp_servers) do + local server_opts = servers[server_name] or {} + vim.lsp.config(server_name, server_opts) vim.lsp.enable(server_name) - end - else - -- TODO test this out on a non nix setup... - require("mason").setup() - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - "stylua", -- Used to format Lua code TODO come back to this, more about linter/formatter configs - }) - require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) - require("mason-lspconfig").setup({ - handlers = { - function(server_name) - local server = servers[server_name] or {} - server.capabilities = - vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) - vim.lsp.config[server_name] = server - vim.lsp.enable(server_name) - end, - }, - }) end + else + -- TODO test this out on a non nix setup... + require("mason").setup() + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + "stylua", -- Used to format Lua code TODO come back to this, more about linter/formatter configs + }) + require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) + require("mason-lspconfig").setup({ + handlers = { + function(server_name) + local server = servers[server_name] or {} + -- let vim.lsp.config('*') provide the base capabilities; do not reassign capabilities here + vim.lsp.config(server_name, server) + vim.lsp.enable(server_name) + end, + }, + }) + end end, }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 1b8c14d..e1cfcea 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -44,14 +44,9 @@ return { end, additional_vim_regex_highlighting = false, }, - incremental_selection = { enable = true }, - ident = { enable = true }, - autotag = { enable = true }, - rainbow = { - enable = true, - extended_mode = true, - max_file_lines = nil, - }, + incremental_selection = { enable = true }, + indent = { enable = true }, + autotag = { enable = true }, }, nonNixOpts) end, config = function(_, opts)