@@ -162,9 +162,6 @@ vim.opt.hlsearch = true
162162vim .keymap .set (' n' , ' <Esc>' , ' <cmd>nohlsearch<CR>' )
163163
164164-- Diagnostic keymaps
165- vim .keymap .set (' n' , ' [d' , vim .diagnostic .goto_prev , { desc = ' Go to previous [D]iagnostic message' })
166- vim .keymap .set (' n' , ' ]d' , vim .diagnostic .goto_next , { desc = ' Go to next [D]iagnostic message' })
167- vim .keymap .set (' n' , ' <leader>e' , vim .diagnostic .open_float , { desc = ' Show diagnostic [E]rror messages' })
168165vim .keymap .set (' n' , ' <leader>q' , vim .diagnostic .setloclist , { desc = ' Open diagnostic [Q]uickfix list' })
169166
170167-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
@@ -207,9 +204,12 @@ vim.api.nvim_create_autocmd('TextYankPost', {
207204-- [[ Install `lazy.nvim` plugin manager ]]
208205-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
209206local lazypath = vim .fn .stdpath ' data' .. ' /lazy/lazy.nvim'
210- if not vim .loop .fs_stat (lazypath ) then
207+ if not vim .uv .fs_stat (lazypath ) then
211208 local lazyrepo = ' https://github.com/folke/lazy.nvim.git'
212- vim .fn .system { ' git' , ' clone' , ' --filter=blob:none' , ' --branch=stable' , lazyrepo , lazypath }
209+ local out = vim .fn .system { ' git' , ' clone' , ' --filter=blob:none' , ' --branch=stable' , lazyrepo , lazypath }
210+ if vim .v .shell_error ~= 0 then
211+ error (' Error cloning lazy.nvim:\n ' .. out )
212+ end
213213end --- @diagnostic disable-next-line : undefined-field
214214vim .opt .rtp :prepend (lazypath )
215215
@@ -234,11 +234,6 @@ require('lazy').setup({
234234 --
235235 -- Use `opts = {}` to force a plugin to be loaded.
236236 --
237- -- This is equivalent to:
238- -- require('Comment').setup({})
239-
240- -- "gc" to comment visual regions/lines
241- { ' numToStr/Comment.nvim' , opts = {} },
242237
243238 -- Here is a more advanced example where we pass configuration
244239 -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
@@ -280,19 +275,15 @@ require('lazy').setup({
280275 require (' which-key' ).setup ()
281276
282277 -- Document existing key chains
283- require (' which-key' ).register {
284- [ ' <leader>c' ] = { name = ' [C]ode' , _ = ' which_key_ignore ' },
285- [ ' <leader>d' ] = { name = ' [D]ocument' , _ = ' which_key_ignore ' },
286- [ ' <leader>r' ] = { name = ' [R]ename' , _ = ' which_key_ignore ' },
287- [ ' <leader>s' ] = { name = ' [S]earch' , _ = ' which_key_ignore ' },
288- [ ' <leader>w' ] = { name = ' [W]orkspace' , _ = ' which_key_ignore ' },
289- [ ' <leader>t' ] = { name = ' [T]oggle' , _ = ' which_key_ignore ' },
290- [ ' <leader>h' ] = { name = ' Git [H]unk' , _ = ' which_key_ignore ' },
278+ require (' which-key' ).add {
279+ { ' <leader>c' , group = ' [C]ode' },
280+ { ' <leader>d' , group = ' [D]ocument' },
281+ { ' <leader>r' , group = ' [R]ename' },
282+ { ' <leader>s' , group = ' [S]earch' },
283+ { ' <leader>w' , group = ' [W]orkspace' },
284+ { ' <leader>t' , group = ' [T]oggle' },
285+ { ' <leader>h' , group = ' Git [H]unk' , mode = { ' n ' , ' v ' } },
291286 }
292- -- visual mode
293- require (' which-key' ).register ({
294- [' <leader>h' ] = { ' Git [H]unk' },
295- }, { mode = ' v' })
296287 end ,
297288 },
298289
@@ -420,9 +411,19 @@ require('lazy').setup({
420411 -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
421412 { ' j-hui/fidget.nvim' , opts = {} },
422413
423- -- `neodev ` configures Lua LSP for your Neovim config, runtime and plugins
414+ -- `lazydev ` configures Lua LSP for your Neovim config, runtime and plugins
424415 -- used for completion, annotations and signatures of Neovim apis
425- { ' folke/neodev.nvim' , opts = {} },
416+ {
417+ ' folke/lazydev.nvim' ,
418+ ft = ' lua' ,
419+ opts = {
420+ library = {
421+ -- Load luvit types when the `vim.uv` word is found
422+ { path = ' luvit-meta/library' , words = { ' vim%.uv' } },
423+ },
424+ },
425+ },
426+ { ' Bilal2453/luvit-meta' , lazy = true },
426427 },
427428 config = function ()
428429 -- Brief aside: **What is LSP?**
@@ -499,10 +500,6 @@ require('lazy').setup({
499500 -- or a suggestion from your LSP for this to activate.
500501 map (' <leader>ca' , vim .lsp .buf .code_action , ' [C]ode [A]ction' )
501502
502- -- Opens a popup that displays documentation about the word under your cursor
503- -- See `:help K` for why this keymap.
504- map (' K' , vim .lsp .buf .hover , ' Hover Documentation' )
505-
506503 -- WARN: This is not Goto Definition, this is Goto Declaration.
507504 -- For example, in C this would take you to the header.
508505 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
@@ -513,7 +510,7 @@ require('lazy').setup({
513510 --
514511 -- When you move your cursor, the highlights will be cleared (the second autocommand).
515512 local client = vim .lsp .get_client_by_id (event .data .client_id )
516- if client and client .server_capabilities . documentHighlightProvider then
513+ if client and client .supports_method ( vim . lsp . protocol . Methods . textDocument_documentHighlight ) then
517514 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
518515 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
519516 buffer = event .buf ,
@@ -536,13 +533,13 @@ require('lazy').setup({
536533 })
537534 end
538535
539- -- The following autocommand is used to enable inlay hints in your
536+ -- The following code creates a keymap to toggle inlay hints in your
540537 -- code, if the language server you are using supports them
541538 --
542539 -- This may be unwanted, since they displace some of your code
543- if client and client .server_capabilities . inlayHintProvider and vim .lsp .inlay_hint then
540+ if client and client .supports_method ( vim .lsp .protocol . Methods . textDocument_inlayHint ) then
544541 map (' <leader>th' , function ()
545- vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled () )
542+ vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event . buf } )
546543 end , ' [T]oggle Inlay [H]ints' )
547544 end
548545 end ,
@@ -627,7 +624,8 @@ require('lazy').setup({
627624
628625 { -- Autoformat
629626 ' stevearc/conform.nvim' ,
630- lazy = false ,
627+ event = { ' BufWritePre' },
628+ cmd = { ' ConformInfo' },
631629 keys = {
632630 {
633631 ' <leader>f' ,
@@ -765,6 +763,11 @@ require('lazy').setup({
765763 -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
766764 },
767765 sources = {
766+ {
767+ name = ' lazydev' ,
768+ -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
769+ group_index = 0 ,
770+ },
768771 { name = ' nvim_lsp' },
769772 { name = ' luasnip' },
770773 { name = ' path' },
@@ -801,7 +804,7 @@ require('lazy').setup({
801804 --
802805 -- Examples:
803806 -- - va) - [V]isually select [A]round [)]paren
804- -- - yinq - [Y]ank [I]nside [N]ext [']quote
807+ -- - yinq - [Y]ank [I]nside [N]ext [Q]uote
805808 -- - ci' - [C]hange [I]nside [']quote
806809 require (' mini.ai' ).setup { n_lines = 500 }
807810
@@ -835,7 +838,7 @@ require('lazy').setup({
835838 ' nvim-treesitter/nvim-treesitter' ,
836839 build = ' :TSUpdate' ,
837840 opts = {
838- ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' vim' , ' vimdoc' },
841+ ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline ' , ' query ' , ' vim' , ' vimdoc' },
839842 -- Autoinstall languages that are not installed
840843 auto_install = true ,
841844 highlight = {
0 commit comments