@@ -49,7 +49,6 @@ vim.opt.signcolumn = 'yes'
4949vim .opt .updatetime = 250
5050
5151-- Decrease mapped sequence wait time
52- -- Displays which-key popup sooner
5352vim .opt .timeoutlen = 300
5453
5554-- Configure how new splits should be opened
@@ -183,12 +182,22 @@ require('lazy').setup({
183182 -- with the first argument being the link and the following
184183 -- keys can be used to configure plugin behavior/loading/etc.
185184 --
186- -- Use `opts = {}` to force a plugin to be loaded.
185+ -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
187186 --
188187
188+ -- Alternatively, use `config = function() ... end` for full control over the configuration.
189+ -- If you prefer to call `setup` explicitly, use:
190+ -- {
191+ -- 'lewis6991/gitsigns.nvim',
192+ -- config = function()
193+ -- require('gitsigns').setup({
194+ -- -- Your gitsigns configuration here
195+ -- })
196+ -- end,
197+ -- }
198+ --
189199 -- Here is a more advanced example where we pass configuration
190- -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
191- -- require('gitsigns').setup({ ... })
200+ -- options to `gitsigns.nvim`.
192201 --
193202 -- See `:help gitsigns` to understand what the configuration keys do
194203 { -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -215,19 +224,21 @@ require('lazy').setup({
215224 -- which loads which-key before all the UI elements are loaded. Events can be
216225 -- normal autocommands events (`:help autocmd-events`).
217226 --
218- -- Then, because we use the `config` key, the configuration only runs
219- -- after the plugin has been loaded:
220- -- config = function() ... end
227+ -- Then, because we use the `opts` key (recommended), the configuration runs
228+ -- after the plugin has been loaded as `require(MODULE).setup(opts)`.
221229
222230 { -- Useful plugin to show you pending keybinds.
223231 ' folke/which-key.nvim' ,
224232 event = ' VimEnter' , -- Sets the loading event to 'VimEnter'
225233 opts = {
234+ -- delay between pressing a key and opening which-key (milliseconds)
235+ -- this setting is independent of vim.opt.timeoutlen
236+ delay = 0 ,
226237 icons = {
227238 -- set icon mappings to true if you have a Nerd Font
228239 mappings = vim .g .have_nerd_font ,
229240 -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
230- -- default whick -key.nvim defined Nerd Font icons, otherwise define a string table
241+ -- default which -key.nvim defined Nerd Font icons, otherwise define a string table
231242 keys = vim .g .have_nerd_font and {} or {
232243 Up = ' <Up> ' ,
233244 Down = ' <Down> ' ,
@@ -414,22 +425,22 @@ require('lazy').setup({
414425 opts = {
415426 library = {
416427 -- Load luvit types when the `vim.uv` word is found
417- { path = ' luvit-meta /library' , words = { ' vim%.uv' } },
428+ { path = ' ${3rd}/luv /library' , words = { ' vim%.uv' } },
418429 },
419430 },
420431 },
421- { ' Bilal2453/luvit-meta' , lazy = true },
422432 {
423433 -- Main LSP Configuration
424434 ' neovim/nvim-lspconfig' ,
425435 dependencies = {
426436 -- Automatically install LSPs and related tools to stdpath for Neovim
427- { ' williamboman/mason.nvim' , config = true }, -- NOTE: Must be loaded before dependants
437+ -- Mason must be loaded before its dependents so we need to set it up here.
438+ -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
439+ { ' williamboman/mason.nvim' , opts = {} },
428440 ' williamboman/mason-lspconfig.nvim' ,
429441 ' WhoIsSethDaniel/mason-tool-installer.nvim' ,
430442
431443 -- Useful status updates for LSP.
432- -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
433444 { ' j-hui/fidget.nvim' , opts = {} },
434445
435446 -- Allows extra capabilities provided by nvim-cmp
@@ -515,13 +526,26 @@ require('lazy').setup({
515526 -- For example, in C this would take you to the header.
516527 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
517528
529+ -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
530+ --- @param client vim.lsp.Client
531+ --- @param method vim.lsp.protocol.Method
532+ --- @param bufnr ? integer some lsp support methods only in specific files
533+ --- @return boolean
534+ local function client_supports_method (client , method , bufnr )
535+ if vim .fn .has ' nvim-0.11' == 1 then
536+ return client :supports_method (method , bufnr )
537+ else
538+ return client .supports_method (method , { bufnr = bufnr })
539+ end
540+ end
541+
518542 -- The following two autocommands are used to highlight references of the
519543 -- word under your cursor when your cursor rests there for a little while.
520544 -- See `:help CursorHold` for information about when this is executed
521545 --
522546 -- When you move your cursor, the highlights will be cleared (the second autocommand).
523547 local client = vim .lsp .get_client_by_id (event .data .client_id )
524- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_documentHighlight ) then
548+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_documentHighlight , event . buf ) then
525549 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
526550 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
527551 buffer = event .buf ,
@@ -548,22 +572,42 @@ require('lazy').setup({
548572 -- code, if the language server you are using supports them
549573 --
550574 -- This may be unwanted, since they displace some of your code
551- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_inlayHint ) then
575+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_inlayHint , event . buf ) then
552576 map (' <leader>th' , function ()
553577 vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event .buf })
554578 end , ' [T]oggle Inlay [H]ints' )
555579 end
556580 end ,
557581 })
558582
559- -- Change diagnostic symbols in the sign column (gutter)
560- -- if vim.g.have_nerd_font then
561- -- local signs = { Error = '', Warn = '', Hint = '', Info = '' }
562- -- for type, icon in pairs(signs) do
563- -- local hl = 'DiagnosticSign' .. type
564- -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
565- -- end
566- -- end
583+ -- Diagnostic Config
584+ -- See :help vim.diagnostic.Opts
585+ vim .diagnostic .config {
586+ severity_sort = true ,
587+ float = { border = ' rounded' , source = ' if_many' },
588+ underline = { severity = vim .diagnostic .severity .ERROR },
589+ signs = vim .g .have_nerd_font and {
590+ text = {
591+ [vim .diagnostic .severity .ERROR ] = ' ' ,
592+ [vim .diagnostic .severity .WARN ] = ' ' ,
593+ [vim .diagnostic .severity .INFO ] = ' ' ,
594+ [vim .diagnostic .severity .HINT ] = ' ' ,
595+ },
596+ } or {},
597+ virtual_text = {
598+ source = ' if_many' ,
599+ spacing = 2 ,
600+ format = function (diagnostic )
601+ local diagnostic_message = {
602+ [vim .diagnostic .severity .ERROR ] = diagnostic .message ,
603+ [vim .diagnostic .severity .WARN ] = diagnostic .message ,
604+ [vim .diagnostic .severity .INFO ] = diagnostic .message ,
605+ [vim .diagnostic .severity .HINT ] = diagnostic .message ,
606+ }
607+ return diagnostic_message [diagnostic .severity ]
608+ end ,
609+ },
610+ }
567611
568612 -- LSP servers and clients are able to communicate to each other what features they support.
569613 -- By default, Neovim doesn't support everything that is in the LSP specification.
@@ -596,8 +640,8 @@ require('lazy').setup({
596640 --
597641
598642 lua_ls = {
599- -- cmd = {...},
600- -- filetypes = { ...},
643+ -- cmd = { ... },
644+ -- filetypes = { ... },
601645 -- capabilities = {},
602646 settings = {
603647 Lua = {
@@ -612,13 +656,16 @@ require('lazy').setup({
612656 }
613657
614658 -- Ensure the servers and tools above are installed
615- -- To check the current status of installed tools and/or manually install
616- -- other tools, you can run
659+ --
660+ -- To check the current status of installed tools and/or manually install
661+ -- other tools, you can run
617662 -- :Mason
618663 --
619- -- You can press `g?` for help in this menu.
620- require (' mason' ).setup ()
621-
664+ -- You can press `g?` for help in this menu.
665+ --
666+ -- `mason` had to be setup earlier: to configure its options see the
667+ -- `dependencies` table for `nvim-lspconfig` above.
668+ --
622669 -- You can add other tools here that you want Mason to install
623670 -- for you, so that they are available from within Neovim.
624671 local ensure_installed = vim .tbl_keys (servers or {})
@@ -645,6 +692,8 @@ require('lazy').setup({
645692 require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
646693
647694 require (' mason-lspconfig' ).setup {
695+ ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
696+ automatic_installation = false ,
648697 handlers = {
649698 function (server_name )
650699 local server = servers [server_name ] or {}
@@ -736,6 +785,7 @@ require('lazy').setup({
736785 -- into multiple repos for maintenance purposes.
737786 ' hrsh7th/cmp-nvim-lsp' ,
738787 ' hrsh7th/cmp-path' ,
788+ ' hrsh7th/cmp-nvim-lsp-signature-help' ,
739789 },
740790 config = function ()
741791 -- See `:help cmp`
@@ -812,6 +862,7 @@ require('lazy').setup({
812862 { name = ' nvim_lsp' },
813863 { name = ' luasnip' },
814864 { name = ' path' },
865+ { name = ' nvim_lsp_signature_help' },
815866 },
816867 }
817868 end ,
@@ -824,7 +875,8 @@ require('lazy').setup({
824875 -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
825876 ' folke/tokyonight.nvim' ,
826877 priority = 1000 , -- Make sure to load this before all the other start plugins.
827- init = function ()
878+ config = function ()
879+ --- @diagnostic disable-next-line : missing-fields
828880 require (' tokyonight' ).setup {
829881 transparent = true ,
830882 styles = {
0 commit comments