maint: warnings cleanup for nvim config

This commit is contained in:
Jeremy Wall 2024-08-26 16:57:47 -04:00
parent d7ce54ca41
commit bad316d19e

View File

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