nvim/lua/init.lua

39 lines
1.2 KiB
Lua
Raw Normal View History

2022-07-25 20:09:29 +00:00
vim.o.foldmethod = 'expr'
vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
2022-02-06 10:28:49 +00:00
2022-01-22 21:36:03 +00:00
vim.diagnostic.config({
2022-07-25 20:09:29 +00:00
virtual_text = false,
signs = true,
underline = false,
update_in_insert = false,
severity_sort = true,
float = {
2022-10-05 19:29:01 +00:00
border = "single",
2022-07-25 20:09:29 +00:00
source = "always" -- Or "if_many"
}
2022-01-22 21:36:03 +00:00
})
2022-07-25 20:09:29 +00:00
local signs = {Error = "", Warn = "", Hint = "", Info = ""}
2022-01-22 21:36:03 +00:00
for type, icon in pairs(signs) do
2022-07-25 20:09:29 +00:00
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, {text = icon, texthl = hl, numhl = hl})
2022-01-22 21:36:03 +00:00
end
local border = {
2022-07-25 20:09:29 +00:00
{"", "FloatBorder"}, {"", "FloatBorder"}, {"", "FloatBorder"},
{"", "FloatBorder"}, {"", "FloatBorder"}, {"", "FloatBorder"},
{"", "FloatBorder"}, {"", "FloatBorder"}
2022-01-22 21:36:03 +00:00
}
2022-10-05 19:29:01 +00:00
vim.lsp.handlers["textDocument/hover"] =
vim.lsp.with(vim.lsp.handlers.hover, {border = "single"})
vim.lsp.handlers["textDocument/signatureHelp"] =
vim.lsp.with(vim.lsp.handlers.signature_help, {border = "single"})
2022-01-22 21:36:03 +00:00
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
2022-07-25 20:09:29 +00:00
opts = opts or {}
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
2022-01-22 21:36:03 +00:00
end