migrate to dotter
This commit is contained in:
parent
c5618f2f2c
commit
23b6c0a596
265 changed files with 62 additions and 3125 deletions
34
configs/nvim/lua/aleidk/autocmds.lua
Normal file
34
configs/nvim/lua/aleidk/autocmds.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
|
||||
vim.bo[args.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp'
|
||||
|
||||
-- Prefer LSP folding if client supports it
|
||||
if client:supports_method('textDocument/foldingRange') then
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
||||
end
|
||||
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>la", vim.lsp.buf.code_action, { buffer = args.buf, desc = "Code Action" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>ld", vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>lc", function()
|
||||
local curpos = vim.fn.getcurpos()
|
||||
local diagnostics = vim.diagnostic.get(0, { lnum = curpos[2] - 1 })
|
||||
|
||||
if #diagnostics == 0 then
|
||||
vim.notify("No diagnostic under cursor")
|
||||
return
|
||||
end
|
||||
|
||||
local diagnostic = diagnostics[1]
|
||||
local msg = string.format("%s [%s]: %s", diagnostic.source, diagnostic.code, diagnostic.message)
|
||||
vim.fn.setreg("+", msg)
|
||||
vim.notify("Diagnostic saved to clipboard:\n\n" .. msg)
|
||||
end, { buffer = args.buf, desc = "Copy diagnostic to clipboard" })
|
||||
end,
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue