@@ -76,9 +76,6 @@ vim.opt.hlsearch = true
7676vim .keymap .set (' n' , ' <Esc>' , ' <cmd>nohlsearch<CR>' )
7777
7878-- Diagnostic keymaps
79- vim .keymap .set (' n' , ' [d' , vim .diagnostic .goto_prev , { desc = ' Go to previous [D]iagnostic message' })
80- vim .keymap .set (' n' , ' ]d' , vim .diagnostic .goto_next , { desc = ' Go to next [D]iagnostic message' })
81- vim .keymap .set (' n' , ' <leader>e' , vim .diagnostic .open_float , { desc = ' Show diagnostic [E]rror messages' })
8279vim .keymap .set (' n' , ' <leader>q' , vim .diagnostic .setloclist , { desc = ' Open diagnostic [Q]uickfix list' })
8380
8481-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
@@ -124,9 +121,12 @@ vim.api.nvim_create_autocmd('TextYankPost', {
124121-- [[ Install `lazy.nvim` plugin manager ]]
125122-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
126123local lazypath = vim .fn .stdpath ' data' .. ' /lazy/lazy.nvim'
127- if not vim .loop .fs_stat (lazypath ) then
124+ if not vim .uv .fs_stat (lazypath ) then
128125 local lazyrepo = ' https://github.com/folke/lazy.nvim.git'
129- vim .fn .system { ' git' , ' clone' , ' --filter=blob:none' , ' --branch=stable' , lazyrepo , lazypath }
126+ local out = vim .fn .system { ' git' , ' clone' , ' --filter=blob:none' , ' --branch=stable' , lazyrepo , lazypath }
127+ if vim .v .shell_error ~= 0 then
128+ error (' Error cloning lazy.nvim:\n ' .. out )
129+ end
130130end --- @diagnostic disable-next-line : undefined-field
131131vim .opt .rtp :prepend (lazypath )
132132
@@ -238,11 +238,6 @@ require('lazy').setup({
238238 --
239239 -- Use `opts = {}` to force a plugin to be loaded.
240240 --
241- -- This is equivalent to:
242- -- require('Comment').setup({})
243-
244- -- "gc" to comment visual regions/lines
245- { ' numToStr/Comment.nvim' , opts = {} },
246241
247242 -- Here is a more advanced example where we pass configuration
248243 -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
@@ -284,19 +279,15 @@ require('lazy').setup({
284279 require (' which-key' ).setup ()
285280
286281 -- Document existing key chains
287- require (' which-key' ).register {
288- [ ' <leader>c' ] = { name = ' [C]ode' , _ = ' which_key_ignore ' },
289- [ ' <leader>d' ] = { name = ' [D]ocument' , _ = ' which_key_ignore ' },
290- [ ' <leader>r' ] = { name = ' [R]ename' , _ = ' which_key_ignore ' },
291- [ ' <leader>s' ] = { name = ' [S]earch' , _ = ' which_key_ignore ' },
292- [ ' <leader>w' ] = { name = ' [W]orkspace' , _ = ' which_key_ignore ' },
293- [ ' <leader>t' ] = { name = ' [T]oggle' , _ = ' which_key_ignore ' },
294- [ ' <leader>h' ] = { name = ' Git [H]unk' , _ = ' which_key_ignore ' },
282+ require (' which-key' ).add {
283+ { ' <leader>c' , group = ' [C]ode' },
284+ { ' <leader>d' , group = ' [D]ocument' },
285+ { ' <leader>r' , group = ' [R]ename' },
286+ { ' <leader>s' , group = ' [S]earch' },
287+ { ' <leader>w' , group = ' [W]orkspace' },
288+ { ' <leader>t' , group = ' [T]oggle' },
289+ { ' <leader>h' , group = ' Git [H]unk' , mode = { ' n ' , ' v ' } },
295290 }
296- -- visual mode
297- require (' which-key' ).register ({
298- [' <leader>h' ] = { ' Git [H]unk' },
299- }, { mode = ' v' })
300291 end ,
301292 },
302293
@@ -424,9 +415,19 @@ require('lazy').setup({
424415 -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
425416 { ' j-hui/fidget.nvim' , opts = {} },
426417
427- -- `neodev ` configures Lua LSP for your Neovim config, runtime and plugins
418+ -- `lazydev ` configures Lua LSP for your Neovim config, runtime and plugins
428419 -- used for completion, annotations and signatures of Neovim apis
429- { ' folke/neodev.nvim' , opts = {} },
420+ {
421+ ' folke/lazydev.nvim' ,
422+ ft = ' lua' ,
423+ opts = {
424+ library = {
425+ -- Load luvit types when the `vim.uv` word is found
426+ { path = ' luvit-meta/library' , words = { ' vim%.uv' } },
427+ },
428+ },
429+ },
430+ { ' Bilal2453/luvit-meta' , lazy = true },
430431 },
431432 config = function ()
432433 -- Brief aside: **What is LSP?**
@@ -503,10 +504,6 @@ require('lazy').setup({
503504 -- or a suggestion from your LSP for this to activate.
504505 map (' <leader>ca' , vim .lsp .buf .code_action , ' [C]ode [A]ction' )
505506
506- -- Opens a popup that displays documentation about the word under your cursor
507- -- See `:help K` for why this keymap.
508- map (' K' , vim .lsp .buf .hover , ' Hover Documentation' )
509-
510507 -- WARN: This is not Goto Definition, this is Goto Declaration.
511508 -- For example, in C this would take you to the header.
512509 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
@@ -517,7 +514,7 @@ require('lazy').setup({
517514 --
518515 -- When you move your cursor, the highlights will be cleared (the second autocommand).
519516 local client = vim .lsp .get_client_by_id (event .data .client_id )
520- if client and client .server_capabilities . documentHighlightProvider then
517+ if client and client .supports_method ( vim . lsp . protocol . Methods . textDocument_documentHighlight ) then
521518 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
522519 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
523520 buffer = event .buf ,
@@ -540,13 +537,13 @@ require('lazy').setup({
540537 })
541538 end
542539
543- -- The following autocommand is used to enable inlay hints in your
540+ -- The following code creates a keymap to toggle inlay hints in your
544541 -- code, if the language server you are using supports them
545542 --
546543 -- This may be unwanted, since they displace some of your code
547- if client and client .server_capabilities . inlayHintProvider and vim .lsp .inlay_hint then
544+ if client and client .supports_method ( vim .lsp .protocol . Methods . textDocument_inlayHint ) then
548545 map (' <leader>th' , function ()
549- vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled () )
546+ vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event . buf } )
550547 end , ' [T]oggle Inlay [H]ints' )
551548 end
552549 end ,
@@ -643,7 +640,8 @@ require('lazy').setup({
643640
644641 { -- Autoformat
645642 ' stevearc/conform.nvim' ,
646- lazy = false ,
643+ event = { ' BufWritePre' },
644+ cmd = { ' ConformInfo' },
647645 keys = {
648646 {
649647 ' <leader>f' ,
@@ -781,6 +779,11 @@ require('lazy').setup({
781779 -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
782780 },
783781 sources = {
782+ {
783+ name = ' lazydev' ,
784+ -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
785+ group_index = 0 ,
786+ },
784787 { name = ' nvim_lsp' },
785788 { name = ' luasnip' },
786789 { name = ' path' },
@@ -817,7 +820,7 @@ require('lazy').setup({
817820 --
818821 -- Examples:
819822 -- - va) - [V]isually select [A]round [)]paren
820- -- - yinq - [Y]ank [I]nside [N]ext [']quote
823+ -- - yinq - [Y]ank [I]nside [N]ext [Q]uote
821824 -- - ci' - [C]hange [I]nside [']quote
822825 require (' mini.ai' ).setup { n_lines = 500 }
823826
@@ -851,7 +854,7 @@ require('lazy').setup({
851854 ' nvim-treesitter/nvim-treesitter' ,
852855 build = ' :TSUpdate' ,
853856 opts = {
854- ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' vim' , ' vimdoc' },
857+ ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline ' , ' query ' , ' vim' , ' vimdoc' },
855858 -- Autoinstall languages that are not installed
856859 auto_install = true ,
857860 highlight = {
0 commit comments