From a0d54522045755812e81121a5bbf3f115bf76a5a Mon Sep 17 00:00:00 2001 From: Brahmajit Das Date: Wed, 4 Jun 2025 03:18:34 +0530 Subject: moving lsp config, removing lsp-config dependency (v.11.0+) and removing LspAttach from lsp config Signed-off-by: Brahmajit Das --- plugin/lsp.lua | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 plugin/lsp.lua (limited to 'plugin') diff --git a/plugin/lsp.lua b/plugin/lsp.lua new file mode 100644 index 0000000..e1bae06 --- /dev/null +++ b/plugin/lsp.lua @@ -0,0 +1,53 @@ +vim.lsp.enable({ + "lua_ls" +}) + +local signs = { Error = "󰅚 ", Warn = " ", Hint = " ", Info = " " } +vim.diagnostic.config({ + signs = { + enable = true, + text = { + ["ERROR"] = signs.Error, + ["WARN"] = signs.Warn, + ["HINT"] = signs.Hint, + ["INFO"] = signs.Info, + }, + texthl = { + ["ERROR"] = "DiagnosticDefault", + ["WARN"] = "DiagnosticDefault", + ["HINT"] = "DiagnosticDefault", + ["INFO"] = "DiagnosticDefault", + }, + numhl = { + ["ERROR"] = "DiagnosticDefault", + ["WARN"] = "DiagnosticDefault", + ["HINT"] = "DiagnosticDefault", + ["INFO"] = "DiagnosticDefault", + }, + } +}) + +vim.o.updatetime = 250 +-- vim.cmd [[autocmd! CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false, scope="cursor"}) +-- vim.cmd [[autocmd! CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]] +vim.cmd [[autocmd! ColorScheme * highlight NormalFloat guibg=#4c4f69]] +vim.cmd [[autocmd! ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]] + +local border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" }, +} + +-- To instead override globally +local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview +function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) + opts = opts or {} + opts.border = opts.border or border + return orig_util_open_floating_preview(contents, syntax, opts, ...) +end -- cgit v1.2.3