Skip to content

Commit dc66ed0

Browse files
VlaDexammirusmrr11kqgates
authored andcommitted
Rebasing upstream into personal config
Neovim 0.10 updates (nvim-lua#936) * Neovim 0.10 updates Provide the buffer for which to enable inlay hints Co-authored-by: Matt Mirus <[email protected]> * 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 <[email protected]> Co-authored-by: mrr11k <[email protected]> Co-authored-by: Seb Tomasini <[email protected]>
1 parent 681c3b5 commit dc66ed0

File tree

2 files changed

+14
-44
lines changed

2 files changed

+14
-44
lines changed

init.lua

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ vim.opt.hlsearch = true
166166
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
167167

168168
-- Diagnostic keymaps
169-
-- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
170-
-- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
171-
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
172169
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
173170

174171
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
@@ -211,7 +208,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
211208
-- [[ Install `lazy.nvim` plugin manager ]]
212209
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
213210
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
214-
if not vim.loop.fs_stat(lazypath) then
211+
if not vim.uv.fs_stat(lazypath) then
215212
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
216213
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
217214
if vim.v.shell_error ~= 0 then
@@ -241,11 +238,6 @@ require('lazy').setup({
241238
--
242239
-- Use `opts = {}` to force a plugin to be loaded.
243240
--
244-
-- This is equivalent to:
245-
-- require('Comment').setup({})
246-
247-
-- "gc" to comment visual regions/lines
248-
{ 'numToStr/Comment.nvim', opts = {} },
249241

250242
-- Here is a more advanced example where we pass configuration
251243
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
@@ -423,32 +415,9 @@ require('lazy').setup({
423415
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
424416
{ 'j-hui/fidget.nvim', opts = {} },
425417

426-
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
418+
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
427419
-- used for completion, annotations and signatures of Neovim apis
428-
429-
{
430-
'folke/lazydev.nvim',
431-
ft = 'lua', -- only load on lua files
432-
opts = {
433-
library = {
434-
-- See the configuration section for more details
435-
-- Load luvit types when the `vim.uv` word is found
436-
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
437-
},
438-
},
439-
},
440-
{ 'Bilal2453/luvit-meta', lazy = true }, -- optional `vim.uv` typings
441-
{ -- optional completion source for require statements and module annotations
442-
'hrsh7th/nvim-cmp',
443-
opts = function(_, opts)
444-
opts.sources = opts.sources or {}
445-
table.insert(opts.sources, {
446-
name = 'lazydev',
447-
group_index = 0, -- set group index to 0 to skip loading LuaLS completions
448-
})
449-
end,
450-
},
451-
-- { 'folke/neodev.nvim', opts = {} },
420+
{ 'folke/lazydev.nvim', ft = 'lua', opts = {} },
452421
},
453422
config = function()
454423
-- Brief aside: **What is LSP?**
@@ -525,10 +494,6 @@ require('lazy').setup({
525494
-- or a suggestion from your LSP for this to activate.
526495
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
527496

528-
-- Opens a popup that displays documentation about the word under your cursor
529-
-- See `:help K` for why this keymap.
530-
-- map('K', vim.lsp.buf.hover, 'Hover Documentation')
531-
532497
-- WARN: This is not Goto Definition, this is Goto Declaration.
533498
-- For example, in C this would take you to the header.
534499
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
@@ -539,7 +504,7 @@ require('lazy').setup({
539504
--
540505
-- When you move your cursor, the highlights will be cleared (the second autocommand).
541506
local client = vim.lsp.get_client_by_id(event.data.client_id)
542-
if client and client.server_capabilities.documentHighlightProvider then
507+
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
543508
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
544509
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
545510
buffer = event.buf,
@@ -566,9 +531,9 @@ require('lazy').setup({
566531
-- code, if the language server you are using supports them
567532
--
568533
-- This may be unwanted, since they displace some of your code
569-
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
534+
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
570535
map('<leader>th', function()
571-
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
536+
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
572537
end, '[T]oggle Inlay [H]ints')
573538
end
574539
end,
@@ -792,6 +757,11 @@ require('lazy').setup({
792757
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
793758
},
794759
sources = {
760+
{
761+
name = 'lazydev',
762+
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
763+
group_index = 0,
764+
},
795765
{ name = 'nvim_lsp' },
796766
{ name = 'luasnip' },
797767
{ name = 'path' },

lua/kickstart/health.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
--]]
77

88
local check_version = function()
9-
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
10-
if not vim.version.cmp then
9+
local verstr = tostring(vim.version())
10+
if not vim.version.ge then
1111
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
1212
return
1313
end
1414

15-
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
15+
if vim.version.ge(vim.version(), '0.10-dev') then
1616
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
1717
else
1818
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))

0 commit comments

Comments
 (0)