Merge branch 'main' of git.andr3h3nriqu3s.com:andr3/nvim-config

This commit is contained in:
Andre Herniques
2023-05-15 13:59:09 +01:00
3 changed files with 80 additions and 36 deletions

View File

@@ -1,7 +1,11 @@
require 'andr3.lsp_adds.prettier'
require 'andr3.lsp_adds.null-ls'
-- Items
-- Signature
require 'lsp_signature'.setup({ });
-- Items {{{
require('vim.lsp.protocol').CompletionItemKind = {
'', -- Text
'', -- Method
@@ -29,8 +33,34 @@ require('vim.lsp.protocol').CompletionItemKind = {
'', -- Operator
'', -- TypeParameter
}
--- }}}
vim.diagnostic.config({ virtual_text = { prefix = '🅰', } })
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
-- Enable underline, use default values
underline = true,
-- Enable virtual text, override spacing to 4
virtual_text = {
spacing = 4,
prefix = '~',
},
-- Use a function to dynamically turn signs off
-- and on, using buffer local variables
signs = function(bufnr, client_id)
local ok, result = pcall(vim.api.nvim_buf_get_var, bufnr, 'show_signs')
-- No buffer local variable set, so just enable by default
if not ok then
return true
end
return result
end,
-- Disable a feature
update_in_insert = false,
}
)
-- vim.diagnostic.config({ virtual_text = { prefix = '🅰', } })
local warn = "😞";
local signs = { Error = "☣️ ", Warn = warn, Hint = "❤️ ", Info = "🆓" }
@@ -151,8 +181,9 @@ keymap("n", "<leader>sf", "<cmd>Lspsaga lsp_finder<CR>", { silent = true })
keymap({"n","v"}, "<leader>ca", function () saga.code_action() end, {})
keymap("n", "gr", "<cmd>Lspsaga rename<CR>", { silent = true })
keymap("n", "gd", "<cmd>Lspsaga peek_definition<CR>", { silent = true })
keymap("n", "<leader>cd", "<cmd>Lspsaga show_line_diagnostics<CR>", { silent = true })
--keymap("n", "<leader>cd", "<cmd>Lspsaga show_line_diagnostics<CR>", { silent = true })
keymap("n", "<leader>cd", "<cmd>Lspsaga show_cursor_diagnostics<CR>", { silent = true })
keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', { silent = true })
keymap("n", "[e", "<cmd>Lspsaga diagnostic_jump_prev<CR>", { silent = true })
keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>", { silent = true })
@@ -250,6 +281,13 @@ vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
require "lsp_signature".on_attach({
bind = true,
handler_opts = {
border = "rounded"
}
}, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')