@@ -167,9 +167,6 @@ vim.opt.hlsearch = true
167167vim .keymap .set (' n' , ' <Esc>' , ' <cmd>nohlsearch<CR>' )
168168
169169-- Diagnostic keymaps
170- vim .keymap .set (' n' , ' [d' , vim .diagnostic .goto_prev , { desc = ' Go to previous [D]iagnostic message' })
171- vim .keymap .set (' n' , ' ]d' , vim .diagnostic .goto_next , { desc = ' Go to next [D]iagnostic message' })
172- vim .keymap .set (' n' , ' <leader>e' , vim .diagnostic .open_float , { desc = ' Show diagnostic [E]rror messages' })
173170vim .keymap .set (' n' , ' <leader>q' , vim .diagnostic .setloclist , { desc = ' Open diagnostic [Q]uickfix list' })
174171
175172-- NvimTree Keymap
@@ -219,9 +216,12 @@ vim.api.nvim_create_autocmd('TextYankPost', {
219216-- [[ Install `lazy.nvim` plugin manager ]]
220217-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
221218local lazypath = vim .fn .stdpath ' data' .. ' /lazy/lazy.nvim'
222- if not vim .loop .fs_stat (lazypath ) then
219+ if not vim .uv .fs_stat (lazypath ) then
223220 local lazyrepo = ' https://github.com/folke/lazy.nvim.git'
224- vim .fn .system { ' git' , ' clone' , ' --filter=blob:none' , ' --branch=stable' , lazyrepo , lazypath }
221+ local out = vim .fn .system { ' git' , ' clone' , ' --filter=blob:none' , ' --branch=stable' , lazyrepo , lazypath }
222+ if vim .v .shell_error ~= 0 then
223+ error (' Error cloning lazy.nvim:\n ' .. out )
224+ end
225225end --- @diagnostic disable-next-line : undefined-field
226226vim .opt .rtp :prepend (lazypath )
227227
@@ -326,19 +326,15 @@ require('lazy').setup({
326326 require (' which-key' ).setup ()
327327
328328 -- Document existing key chains
329- require (' which-key' ).register {
330- [ ' <leader>c' ] = { name = ' [C]ode' , _ = ' which_key_ignore ' },
331- [ ' <leader>d' ] = { name = ' [D]ocument' , _ = ' which_key_ignore ' },
332- [ ' <leader>r' ] = { name = ' [R]ename' , _ = ' which_key_ignore ' },
333- [ ' <leader>s' ] = { name = ' [S]earch' , _ = ' which_key_ignore ' },
334- [ ' <leader>w' ] = { name = ' [W]orkspace' , _ = ' which_key_ignore ' },
335- [ ' <leader>t' ] = { name = ' [T]oggle' , _ = ' which_key_ignore ' },
336- [ ' <leader>h' ] = { name = ' Git [H]unk' , _ = ' which_key_ignore ' },
329+ require (' which-key' ).add {
330+ { ' <leader>c' , group = ' [C]ode' },
331+ { ' <leader>d' , group = ' [D]ocument' },
332+ { ' <leader>r' , group = ' [R]ename' },
333+ { ' <leader>s' , group = ' [S]earch' },
334+ { ' <leader>w' , group = ' [W]orkspace' },
335+ { ' <leader>t' , group = ' [T]oggle' },
336+ { ' <leader>h' , group = ' Git [H]unk' , mode = { ' n ' , ' v ' } },
337337 }
338- -- visual mode
339- require (' which-key' ).register ({
340- [' <leader>h' ] = { ' Git [H]unk' },
341- }, { mode = ' v' })
342338 end ,
343339 },
344340
@@ -477,9 +473,19 @@ require('lazy').setup({
477473 -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
478474 { ' j-hui/fidget.nvim' , opts = {} },
479475
480- -- `neodev ` configures Lua LSP for your Neovim config, runtime and plugins
476+ -- `lazydev ` configures Lua LSP for your Neovim config, runtime and plugins
481477 -- used for completion, annotations and signatures of Neovim apis
482- { ' folke/neodev.nvim' , opts = {} },
478+ {
479+ ' folke/lazydev.nvim' ,
480+ ft = ' lua' ,
481+ opts = {
482+ library = {
483+ -- Load luvit types when the `vim.uv` word is found
484+ { path = ' luvit-meta/library' , words = { ' vim%.uv' } },
485+ },
486+ },
487+ },
488+ { ' Bilal2453/luvit-meta' , lazy = true },
483489 },
484490 config = function ()
485491 -- Brief aside: **What is LSP?**
@@ -556,10 +562,6 @@ require('lazy').setup({
556562 -- or a suggestion from your LSP for this to activate.
557563 map (' <leader>ca' , vim .lsp .buf .code_action , ' [C]ode [A]ction' )
558564
559- -- Opens a popup that displays documentation about the word under your cursor
560- -- See `:help K` for why this keymap.
561- map (' K' , vim .lsp .buf .hover , ' Hover Documentation' )
562-
563565 -- WARN: This is not Goto Definition, this is Goto Declaration.
564566 -- For example, in C this would take you to the header.
565567 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
@@ -570,7 +572,7 @@ require('lazy').setup({
570572 --
571573 -- When you move your cursor, the highlights will be cleared (the second autocommand).
572574 local client = vim .lsp .get_client_by_id (event .data .client_id )
573- if client and client .server_capabilities . documentHighlightProvider then
575+ if client and client .supports_method ( vim . lsp . protocol . Methods . textDocument_documentHighlight ) then
574576 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
575577 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
576578 buffer = event .buf ,
@@ -593,13 +595,13 @@ require('lazy').setup({
593595 })
594596 end
595597
596- -- The following autocommand is used to enable inlay hints in your
598+ -- The following code creates a keymap to toggle inlay hints in your
597599 -- code, if the language server you are using supports them
598600 --
599601 -- This may be unwanted, since they displace some of your code
600- if client and client .server_capabilities . inlayHintProvider and vim .lsp .inlay_hint then
602+ if client and client .supports_method ( vim .lsp .protocol . Methods . textDocument_inlayHint ) then
601603 map (' <leader>th' , function ()
602- vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled () )
604+ vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event . buf } )
603605 end , ' [T]oggle Inlay [H]ints' )
604606 end
605607 end ,
@@ -684,7 +686,8 @@ require('lazy').setup({
684686
685687 { -- Autoformat
686688 ' stevearc/conform.nvim' ,
687- lazy = false ,
689+ event = { ' BufWritePre' },
690+ cmd = { ' ConformInfo' },
688691 keys = {
689692 {
690693 ' <leader>f' ,
@@ -822,6 +825,11 @@ require('lazy').setup({
822825 -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
823826 },
824827 sources = {
828+ {
829+ name = ' lazydev' ,
830+ -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
831+ group_index = 0 ,
832+ },
825833 { name = ' nvim_lsp' },
826834 { name = ' luasnip' },
827835 { name = ' path' },
@@ -858,7 +866,7 @@ require('lazy').setup({
858866 --
859867 -- Examples:
860868 -- - va) - [V]isually select [A]round [)]paren
861- -- - yinq - [Y]ank [I]nside [N]ext [']quote
869+ -- - yinq - [Y]ank [I]nside [N]ext [Q]uote
862870 -- - ci' - [C]hange [I]nside [']quote
863871 require (' mini.ai' ).setup { n_lines = 500 }
864872
@@ -892,7 +900,7 @@ require('lazy').setup({
892900 ' nvim-treesitter/nvim-treesitter' ,
893901 build = ' :TSUpdate' ,
894902 opts = {
895- ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' vim' , ' vimdoc' },
903+ ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline ' , ' query ' , ' vim' , ' vimdoc' },
896904 -- Autoinstall languages that are not installed
897905 auto_install = true ,
898906 highlight = {
0 commit comments