Neovim 0.10 updates (#936)
* Neovim 0.10 updates Provide the buffer for which to enable inlay hints Co-authored-by: Matt Mirus <matt@mattmirus.com> * refactor: replace vim.loop with vim.uv * Upgrade folke/neodev (sunsetting) to folke/lazydev * Update checkhealth for 0.10 release --------- Co-authored-by: Matt Mirus <matt@mattmirus.com> Co-authored-by: mrr11k <me+github@mrr11k.dev> Co-authored-by: Seb Tomasini <sebt@qgates.com>
This commit is contained in:
parent
07a9f446a3
commit
7513ec8a7d
29
init.lua
29
init.lua
|
@ -162,9 +162,6 @@ vim.opt.hlsearch = true
|
|||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
|
@ -207,7 +204,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
if not vim.uv.fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||
if vim.v.shell_error ~= 0 then
|
||||
|
@ -237,11 +234,6 @@ require('lazy').setup({
|
|||
--
|
||||
-- Use `opts = {}` to force a plugin to be loaded.
|
||||
--
|
||||
-- This is equivalent to:
|
||||
-- require('Comment').setup({})
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
{ 'numToStr/Comment.nvim', opts = {} },
|
||||
|
||||
-- Here is a more advanced example where we pass configuration
|
||||
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||
|
@ -419,9 +411,9 @@ require('lazy').setup({
|
|||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
{ 'folke/neodev.nvim', opts = {} },
|
||||
{ 'folke/lazydev.nvim', ft = 'lua', opts = {} },
|
||||
},
|
||||
config = function()
|
||||
-- Brief aside: **What is LSP?**
|
||||
|
@ -498,10 +490,6 @@ require('lazy').setup({
|
|||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
-- Opens a popup that displays documentation about the word under your cursor
|
||||
-- See `:help K` for why this keymap.
|
||||
map('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
@ -512,7 +500,7 @@ require('lazy').setup({
|
|||
--
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.server_capabilities.documentHighlightProvider then
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
|
@ -539,9 +527,9 @@ require('lazy').setup({
|
|||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
|
@ -765,6 +753,11 @@ require('lazy').setup({
|
|||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
},
|
||||
sources = {
|
||||
{
|
||||
name = 'lazydev',
|
||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
group_index = 0,
|
||||
},
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
--]]
|
||||
|
||||
local check_version = function()
|
||||
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
|
||||
if not vim.version.cmp then
|
||||
local verstr = tostring(vim.version())
|
||||
if not vim.version.ge then
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
return
|
||||
end
|
||||
|
||||
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
|
||||
if vim.version.ge(vim.version(), '0.10-dev') then
|
||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||
else
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
|
|
Loading…
Reference in New Issue
Block a user