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:
parent
8cba1ba234
commit
f005a8303d
@ -10,7 +10,7 @@
|
||||
<img alt="Windows" src="https://img.shields.io/badge/Windows-%23.svg?style=flat-square&logo=windows&color=0078D6&logoColor=white" />
|
||||
</a>
|
||||
<a href="https://github.com/neovim/neovim/releases/tag/stable">
|
||||
<img src="https://img.shields.io/badge/Neovim-0.10.4-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||
<img src="https://img.shields.io/badge/Neovim-0.11.0-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||
</a>
|
||||
<a href="https://github.com/jdhao/nvim-config/releases/latest">
|
||||
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
|
||||
|
||||
2
init.lua
2
init.lua
@ -13,7 +13,7 @@ vim.loader.enable()
|
||||
|
||||
local utils = require("utils")
|
||||
|
||||
local expected_version = "0.10.4"
|
||||
local expected_version = "0.11.0"
|
||||
utils.is_compatible_version(expected_version)
|
||||
|
||||
local config_dir = vim.fn.stdpath("config")
|
||||
|
||||
@ -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
|
||||
|
||||
@ -50,7 +50,8 @@ vim.api.nvim_create_user_command("JSONFormat", function(context)
|
||||
local cmd_str = string.format("%s,%s!python -m json.tool", line1, line2)
|
||||
vim.fn.execute(cmd_str)
|
||||
else
|
||||
vim.api.nvim_err_write(string.format("unsupported range: %s", range))
|
||||
local msg = string.format("unsupported range: %s", range)
|
||||
vim.api.nvim_echo({ { msg } }, true, { err = true })
|
||||
end
|
||||
end, {
|
||||
desc = "Format JSON string",
|
||||
|
||||
@ -124,6 +124,7 @@ set pumheight=10 " Maximum number of items to show in popup menu
|
||||
set pumblend=5 " pseudo transparency for completion menu
|
||||
|
||||
set winblend=0 " pseudo transparency for floating window
|
||||
set winborder=none
|
||||
|
||||
" Insert mode key word completion setting
|
||||
set complete+=kspell complete-=w complete-=b complete-=u complete-=t
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user