diff --git a/nix/base-system/init.lua b/nix/base-system/init.lua index 7932c6d..6ba36bd 100644 --- a/nix/base-system/init.lua +++ b/nix/base-system/init.lua @@ -232,16 +232,18 @@ vim.api.nvim_create_autocmd('LspAttach', { vim.keymap.set({ "n", "v" }, "a", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "f", vim.lsp.buf.format, opts) local client = vim.lsp.get_client_by_id(args.data.client_id) - if client.server_capabilities.codelens then +---@diagnostic disable-next-line: undefined-field + if client and client.server_capabilities.codelens then vim.lsp.codelens.refresh() end end, }) vim.api.nvim_create_autocmd({ 'BufEnter', 'InsertLeave', 'CursorHold' }, { - callback = function(_) - local clients = vim.lsp.get_active_clients() + callback = function(args) + local clients = vim.lsp.get_clients({bufnr=args.buf}) for cid = 1, #clients do +---@diagnostic disable-next-line: undefined-field if clients[cid].server_capabilities.codelens then vim.lsp.codelens.refresh() break @@ -272,7 +274,7 @@ vim.diagnostic.config({ severity_sort = false, float = { border = 'rounded', - source = 'always', + source = true, header = '', prefix = '', }, @@ -292,7 +294,7 @@ autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) -- updatetime: set updatetime for CursorHold vim.opt.completeopt = { 'menuone', 'noselect', 'noinsert' } vim.opt.shortmess = vim.opt.shortmess + { c = true } -vim.api.nvim_set_option('updatetime', 300) +vim.api.nvim_set_option_value('updatetime', 300, { scope = "global" }) vim.opt.sessionoptions = { 'buffers', 'curdir', 'skiprtp', 'localoptions', 'terminal', 'tabpages' } -- Fixed column for diagnostics to appear -- Show autodiagnostic popup on cursor hover_range @@ -452,7 +454,7 @@ end) -- Neogit integration -- See https://github.com/NeogitOrg/neogit for configuration information. local neogit = require('neogit') -neogit.setup() +neogit.setup {} vim.keymap.set("n", "mg", function() neogit.open() @@ -529,7 +531,7 @@ lean.setup { vim.keymap.set({ "n", "v" }, "ti", function() vim.cmd("LeanInfoviewToggle") end, opts) vim.keymap.set({ "n", "v" }, "sg", function() vim.cmd("LeanGoal") end, opts) vim.keymap.set({ "n", "v" }, "stg", function() vim.cmd("LeanTermGoal") end, opts) - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + vim.api.nvim_set_option_value('omnifunc', 'v:lua.vim.lsp.omnifunc', {scope = "local", buf=bufnr}) end }, mappings = true, @@ -546,7 +548,6 @@ vim.keymap.set("n", "sl", telescope_builtins.lsp_workspace_symbols) vim.keymap.set("n", "dl", telescope_builtins.diagnostics) vim.keymap.set("n", "rg", telescope_builtins.live_grep) vim.keymap.set("n", "bl", function() telescope_builtins.buffers({ - }) end) -- harpoon keymaps