mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Nvim version bump (#385)
* update nvim version to 0.11.0 * replace deprecated nvim_err_write/nvim_err_writeln call * replace deprecated func for diagnostic and lsp * use vim.hl instead * use new way to define diagnostic signs
This commit is contained in:
@@ -16,7 +16,7 @@ local activate_hlslens = function(direction)
|
||||
if not status then
|
||||
local start_idx, _ = string.find(msg, "E486", 1, true)
|
||||
local msg_part = string.sub(msg, start_idx)
|
||||
api.nvim_err_writeln(msg_part)
|
||||
api.nvim_echo({ { msg_part } }, true, { err = true })
|
||||
return
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@ local check_cursor_word = function()
|
||||
local result = cursor_word == ""
|
||||
if result then
|
||||
local msg = "E348: No string under cursor"
|
||||
api.nvim_err_writeln(msg)
|
||||
api.nvim_echo({ { msg } }, true, { err = true })
|
||||
end
|
||||
|
||||
return result, cursor_word
|
||||
|
||||
@@ -30,12 +30,18 @@ local custom_attach = function(client, bufnr)
|
||||
|
||||
map("n", "gd", vim.lsp.buf.definition, { desc = "go to definition" })
|
||||
map("n", "<C-]>", vim.lsp.buf.definition)
|
||||
map("n", "K", vim.lsp.buf.hover)
|
||||
map("n", "K", function()
|
||||
vim.lsp.buf.hover { border = "rounded" }
|
||||
end)
|
||||
map("n", "<C-k>", vim.lsp.buf.signature_help)
|
||||
map("n", "<space>rn", vim.lsp.buf.rename, { desc = "varialbe rename" })
|
||||
map("n", "gr", vim.lsp.buf.references, { desc = "show references" })
|
||||
map("n", "[d", diagnostic.goto_prev, { desc = "previous diagnostic" })
|
||||
map("n", "]d", diagnostic.goto_next, { desc = "next diagnostic" })
|
||||
map("n", "[d", function()
|
||||
diagnostic.jump { count = -1, float = true }
|
||||
end, { desc = "previous diagnostic" })
|
||||
map("n", "]d", function()
|
||||
diagnostic.jump { count = 1, float = true }
|
||||
end, { desc = "next diagnostic" })
|
||||
-- this puts diagnostics from opened files to quickfix
|
||||
map("n", "<space>qw", diagnostic.setqflist, { desc = "put window diagnostics to qf" })
|
||||
-- this puts diagnostics from current buffer to quickfix
|
||||
@@ -278,28 +284,17 @@ if utils.executable("lua-language-server") then
|
||||
}
|
||||
end
|
||||
|
||||
-- Change diagnostic signs.
|
||||
fn.sign_define("DiagnosticSignError", { text = "🆇", texthl = "DiagnosticSignError" })
|
||||
fn.sign_define("DiagnosticSignWarn", { text = "⚠️", texthl = "DiagnosticSignWarn" })
|
||||
fn.sign_define("DiagnosticSignInfo", { text = "ℹ️", texthl = "DiagnosticSignInfo" })
|
||||
fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||
|
||||
-- global config for diagnostic
|
||||
diagnostic.config {
|
||||
underline = false,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
signs = {
|
||||
text = {
|
||||
[diagnostic.severity.ERROR] = "🆇",
|
||||
[diagnostic.severity.WARN] = "⚠️",
|
||||
[diagnostic.severity.INFO] = "ℹ️",
|
||||
[diagnostic.severity.HINT] = "",
|
||||
},
|
||||
},
|
||||
severity_sort = true,
|
||||
}
|
||||
|
||||
-- lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, {
|
||||
-- underline = false,
|
||||
-- virtual_text = false,
|
||||
-- signs = true,
|
||||
-- update_in_insert = false,
|
||||
-- })
|
||||
|
||||
-- Change border of documentation hover window, See https://github.com/neovim/neovim/pull/13998.
|
||||
lsp.handlers["textDocument/hover"] = lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||
pattern = "*",
|
||||
group = yank_group,
|
||||
callback = function()
|
||||
vim.highlight.on_yank { higroup = "YankColor", timeout = 300 }
|
||||
vim.hl.on_yank { higroup = "YankColor", timeout = 300 }
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ if utils.executable("python3") then
|
||||
vim.g.python3_host_prog = fn.exepath("python3")
|
||||
end
|
||||
else
|
||||
api.nvim_err_writeln("Python3 executable not found! You must install Python3 and set its PATH correctly!")
|
||||
local msg = "Python3 executable not found! You must install Python3 and set its PATH correctly!"
|
||||
api.nvim_echo({ { msg } }, true, { err = true })
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ function M.is_compatible_version(expected_version)
|
||||
|
||||
if expect_ver == nil then
|
||||
local msg = string.format("Unsupported version string: %s", expected_version)
|
||||
vim.api.nvim_err_writeln(msg)
|
||||
vim.api.nvim_echo({ { msg } }, true, { err = true })
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -73,7 +73,7 @@ function M.is_compatible_version(expected_version)
|
||||
expected_version,
|
||||
_ver
|
||||
)
|
||||
vim.api.nvim_err_writeln(msg)
|
||||
vim.api.nvim_echo({ { msg } }, true, { err = true })
|
||||
end
|
||||
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user