@@ -136,7 +136,6 @@ vim.opt.signcolumn = 'yes'
136136vim .opt .updatetime = 250
137137
138138-- Decrease mapped sequence wait time
139- -- Displays which-key popup sooner
140139vim .opt .timeoutlen = 300
141140
142141-- Configure how new splits should be opened
@@ -236,12 +235,22 @@ require('lazy').setup({
236235 -- with the first argument being the link and the following
237236 -- keys can be used to configure plugin behavior/loading/etc.
238237 --
239- -- Use `opts = {}` to force a plugin to be loaded.
238+ -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
240239 --
241240
241+ -- Alternatively, use `config = function() ... end` for full control over the configuration.
242+ -- If you prefer to call `setup` explicitly, use:
243+ -- {
244+ -- 'lewis6991/gitsigns.nvim',
245+ -- config = function()
246+ -- require('gitsigns').setup({
247+ -- -- Your gitsigns configuration here
248+ -- })
249+ -- end,
250+ -- }
251+ --
242252 -- Here is a more advanced example where we pass configuration
243- -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
244- -- require('gitsigns').setup({ ... })
253+ -- options to `gitsigns.nvim`.
245254 --
246255 -- See `:help gitsigns` to understand what the configuration keys do
247256 { -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -268,19 +277,21 @@ require('lazy').setup({
268277 -- which loads which-key before all the UI elements are loaded. Events can be
269278 -- normal autocommands events (`:help autocmd-events`).
270279 --
271- -- Then, because we use the `config` key, the configuration only runs
272- -- after the plugin has been loaded:
273- -- config = function() ... end
280+ -- Then, because we use the `opts` key (recommended), the configuration runs
281+ -- after the plugin has been loaded as `require(MODULE).setup(opts)`.
274282
275283 { -- Useful plugin to show you pending keybinds.
276284 ' folke/which-key.nvim' ,
277285 event = ' VimEnter' , -- Sets the loading event to 'VimEnter'
278286 opts = {
287+ -- delay between pressing a key and opening which-key (milliseconds)
288+ -- this setting is independent of vim.opt.timeoutlen
289+ delay = 0 ,
279290 icons = {
280291 -- set icon mappings to true if you have a Nerd Font
281292 mappings = vim .g .have_nerd_font ,
282293 -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
283- -- default whick -key.nvim defined Nerd Font icons, otherwise define a string table
294+ -- default which -key.nvim defined Nerd Font icons, otherwise define a string table
284295 keys = vim .g .have_nerd_font and {} or {
285296 Up = ' <Up> ' ,
286297 Down = ' <Down> ' ,
@@ -454,22 +465,22 @@ require('lazy').setup({
454465 opts = {
455466 library = {
456467 -- Load luvit types when the `vim.uv` word is found
457- { path = ' luvit-meta /library' , words = { ' vim%.uv' } },
468+ { path = ' ${3rd}/luv /library' , words = { ' vim%.uv' } },
458469 },
459470 },
460471 },
461- { ' Bilal2453/luvit-meta' , lazy = true },
462472 {
463473 -- Main LSP Configuration
464474 ' neovim/nvim-lspconfig' ,
465475 dependencies = {
466476 -- Automatically install LSPs and related tools to stdpath for Neovim
467- { ' williamboman/mason.nvim' , config = true }, -- NOTE: Must be loaded before dependants
477+ -- Mason must be loaded before its dependents so we need to set it up here.
478+ -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
479+ { ' williamboman/mason.nvim' , opts = {} },
468480 ' williamboman/mason-lspconfig.nvim' ,
469481 ' WhoIsSethDaniel/mason-tool-installer.nvim' ,
470482
471483 -- Useful status updates for LSP.
472- -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
473484 { ' j-hui/fidget.nvim' , opts = {} },
474485
475486 -- Allows extra capabilities provided by nvim-cmp
@@ -557,13 +568,27 @@ require('lazy').setup({
557568
558569 -- Show LSP message
559570 map (' gM' , vim .diagnostic .open_float , ' [G]oto [M]essage' )
571+
572+ -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
573+ --- @param client vim.lsp.Client
574+ --- @param method vim.lsp.protocol.Method
575+ --- @param bufnr ? integer some lsp support methods only in specific files
576+ --- @return boolean
577+ local function client_supports_method (client , method , bufnr )
578+ if vim .fn .has ' nvim-0.11' == 1 then
579+ return client :supports_method (method , bufnr )
580+ else
581+ return client .supports_method (method , { bufnr = bufnr })
582+ end
583+ end
584+
560585 -- The following two autocommands are used to highlight references of the
561586 -- word under your cursor when your cursor rests there for a little while.
562587 -- See `:help CursorHold` for information about when this is executed
563588 --
564589 -- When you move your cursor, the highlights will be cleared (the second autocommand).
565590 local client = vim .lsp .get_client_by_id (event .data .client_id )
566- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_documentHighlight ) then
591+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_documentHighlight , event . buf ) then
567592 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
568593 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
569594 buffer = event .buf ,
@@ -590,14 +615,43 @@ require('lazy').setup({
590615 -- code, if the language server you are using supports them
591616 --
592617 -- This may be unwanted, since they displace some of your code
593- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_inlayHint ) then
618+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_inlayHint , event . buf ) then
594619 map (' <leader>th' , function ()
595620 vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event .buf })
596621 end , ' [T]oggle Inlay [H]ints' )
597622 end
598623 end ,
599624 })
600625
626+ -- Diagnostic Config
627+ -- See :help vim.diagnostic.Opts
628+ vim .diagnostic .config {
629+ severity_sort = true ,
630+ float = { border = ' rounded' , source = ' if_many' },
631+ underline = { severity = vim .diagnostic .severity .ERROR },
632+ signs = vim .g .have_nerd_font and {
633+ text = {
634+ [vim .diagnostic .severity .ERROR ] = ' ' ,
635+ [vim .diagnostic .severity .WARN ] = ' ' ,
636+ [vim .diagnostic .severity .INFO ] = ' ' ,
637+ [vim .diagnostic .severity .HINT ] = ' ' ,
638+ },
639+ } or {},
640+ virtual_text = {
641+ source = ' if_many' ,
642+ spacing = 2 ,
643+ format = function (diagnostic )
644+ local diagnostic_message = {
645+ [vim .diagnostic .severity .ERROR ] = diagnostic .message ,
646+ [vim .diagnostic .severity .WARN ] = diagnostic .message ,
647+ [vim .diagnostic .severity .INFO ] = diagnostic .message ,
648+ [vim .diagnostic .severity .HINT ] = diagnostic .message ,
649+ }
650+ return diagnostic_message [diagnostic .severity ]
651+ end ,
652+ },
653+ }
654+
601655 -- LSP servers and clients are able to communicate to each other what features they support.
602656 -- By default, Neovim doesn't support everything that is in the LSP specification.
603657 -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
@@ -630,8 +684,8 @@ require('lazy').setup({
630684 --
631685
632686 lua_ls = {
633- -- cmd = {...},
634- -- filetypes = { ...},
687+ -- cmd = { ... },
688+ -- filetypes = { ... },
635689 -- capabilities = {},
636690 settings = {
637691 Lua = {
@@ -646,13 +700,16 @@ require('lazy').setup({
646700 }
647701
648702 -- Ensure the servers and tools above are installed
649- -- To check the current status of installed tools and/or manually install
650- -- other tools, you can run
703+ --
704+ -- To check the current status of installed tools and/or manually install
705+ -- other tools, you can run
651706 -- :Mason
652707 --
653- -- You can press `g?` for help in this menu.
654- require (' mason' ).setup ()
655-
708+ -- You can press `g?` for help in this menu.
709+ --
710+ -- `mason` had to be setup earlier: to configure its options see the
711+ -- `dependencies` table for `nvim-lspconfig` above.
712+ --
656713 -- You can add other tools here that you want Mason to install
657714 -- for you, so that they are available from within Neovim.
658715 local ensure_installed = vim .tbl_keys (servers or {})
@@ -662,6 +719,8 @@ require('lazy').setup({
662719 require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
663720
664721 require (' mason-lspconfig' ).setup {
722+ ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
723+ automatic_installation = false ,
665724 handlers = {
666725 function (server_name )
667726 local server = servers [server_name ] or {}
@@ -754,6 +813,7 @@ require('lazy').setup({
754813 -- into multiple repos for maintenance purposes.
755814 ' hrsh7th/cmp-nvim-lsp' ,
756815 ' hrsh7th/cmp-path' ,
816+ ' hrsh7th/cmp-nvim-lsp-signature-help' ,
757817 },
758818 config = function ()
759819 -- See `:help cmp`
@@ -830,6 +890,7 @@ require('lazy').setup({
830890 { name = ' nvim_lsp' },
831891 { name = ' luasnip' },
832892 { name = ' path' },
893+ { name = ' nvim_lsp_signature_help' },
833894 },
834895 }
835896 end ,
@@ -842,14 +903,18 @@ require('lazy').setup({
842903 -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
843904 ' folke/tokyonight.nvim' ,
844905 priority = 1000 , -- Make sure to load this before all the other start plugins.
845- init = function ()
906+ config = function ()
907+ --- @diagnostic disable-next-line : missing-fields
908+ require (' tokyonight' ).setup {
909+ styles = {
910+ comments = { italic = false }, -- Disable italics in comments
911+ },
912+ }
913+
846914 -- Load the colorscheme here.
847915 -- Like many other themes, this one has different styles, and you could load
848916 -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
849917 vim .cmd .colorscheme ' tokyonight-night'
850-
851- -- You can configure highlights by doing something like:
852- vim .cmd .hi ' Comment gui=none'
853918 end ,
854919 },
855920
@@ -919,7 +984,7 @@ require('lazy').setup({
919984 -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
920985 },
921986
922- -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
987+ -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
923988 -- init.lua. If you want these files, they are in the repository, so you can just download them and
924989 -- place them in the correct locations.
925990
@@ -939,8 +1004,12 @@ require('lazy').setup({
9391004 -- This is the easiest way to modularize your config.
9401005 --
9411006 -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
942- -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
9431007 -- { import = 'custom.plugins' },
1008+ --
1009+ -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
1010+ -- Or use telescope!
1011+ -- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
1012+ -- you can continue same window with `<space>sr` which resumes last telescope search
9441013}, {
9451014 ui = {
9461015 -- If you are using a Nerd Font: set icons to an empty table which will use the
0 commit comments