@@ -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
@@ -239,12 +238,22 @@ require('lazy').setup({
239238
240239 --
241240 --
242- -- Use `opts = {}` to force a plugin to be loaded.
241+ -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
243242 --
244243
244+ -- Alternatively, use `config = function() ... end` for full control over the configuration.
245+ -- If you prefer to call `setup` explicitly, use:
246+ -- {
247+ -- 'lewis6991/gitsigns.nvim',
248+ -- config = function()
249+ -- require('gitsigns').setup({
250+ -- -- Your gitsigns configuration here
251+ -- })
252+ -- end,
253+ -- }
254+ --
245255 -- Here is a more advanced example where we pass configuration
246- -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
247- -- require('gitsigns').setup({ ... })
256+ -- options to `gitsigns.nvim`.
248257 --
249258 -- See `:help gitsigns` to understand what the configuration keys do
250259 { -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -271,19 +280,21 @@ require('lazy').setup({
271280 -- which loads which-key before all the UI elements are loaded. Events can be
272281 -- normal autocommands events (`:help autocmd-events`).
273282 --
274- -- Then, because we use the `config` key, the configuration only runs
275- -- after the plugin has been loaded:
276- -- config = function() ... end
283+ -- Then, because we use the `opts` key (recommended), the configuration runs
284+ -- after the plugin has been loaded as `require(MODULE).setup(opts)`.
277285
278286 { -- Useful plugin to show you pending keybinds.
279287 ' folke/which-key.nvim' ,
280288 event = ' VimEnter' , -- Sets the loading event to 'VimEnter'
281289 opts = {
290+ -- delay between pressing a key and opening which-key (milliseconds)
291+ -- this setting is independent of vim.opt.timeoutlen
292+ delay = 0 ,
282293 icons = {
283294 -- set icon mappings to true if you have a Nerd Font
284295 mappings = vim .g .have_nerd_font ,
285296 -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
286- -- default whick -key.nvim defined Nerd Font icons, otherwise define a string table
297+ -- default which -key.nvim defined Nerd Font icons, otherwise define a string table
287298 keys = vim .g .have_nerd_font and {} or {
288299 Up = ' <Up> ' ,
289300 Down = ' <Down> ' ,
@@ -450,22 +461,22 @@ require('lazy').setup({
450461 opts = {
451462 library = {
452463 -- Load luvit types when the `vim.uv` word is found
453- { path = ' luvit-meta /library' , words = { ' vim%.uv' } },
464+ { path = ' ${3rd}/luv /library' , words = { ' vim%.uv' } },
454465 },
455466 },
456467 },
457- { ' Bilal2453/luvit-meta' , lazy = true },
458468 {
459469 -- Main LSP Configuration
460470 ' neovim/nvim-lspconfig' ,
461471 dependencies = {
462472 -- Automatically install LSPs and related tools to stdpath for Neovim
463- { ' williamboman/mason.nvim' , config = true }, -- NOTE: Must be loaded before dependants
473+ -- Mason must be loaded before its dependents so we need to set it up here.
474+ -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
475+ { ' williamboman/mason.nvim' , opts = {} },
464476 ' williamboman/mason-lspconfig.nvim' ,
465477 ' WhoIsSethDaniel/mason-tool-installer.nvim' ,
466478
467479 -- Useful status updates for LSP.
468- -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
469480 { ' j-hui/fidget.nvim' , opts = {} },
470481
471482 -- Allows extra capabilities provided by nvim-cmp
@@ -551,13 +562,26 @@ require('lazy').setup({
551562 -- For example, in C this would take you to the header.
552563 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
553564
565+ -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
566+ --- @param client vim.lsp.Client
567+ --- @param method vim.lsp.protocol.Method
568+ --- @param bufnr ? integer some lsp support methods only in specific files
569+ --- @return boolean
570+ local function client_supports_method (client , method , bufnr )
571+ if vim .fn .has ' nvim-0.11' == 1 then
572+ return client :supports_method (method , bufnr )
573+ else
574+ return client .supports_method (method , { bufnr = bufnr })
575+ end
576+ end
577+
554578 -- The following two autocommands are used to highlight references of the
555579 -- word under your cursor when your cursor rests there for a little while.
556580 -- See `:help CursorHold` for information about when this is executed
557581 --
558582 -- When you move your cursor, the highlights will be cleared (the second autocommand).
559583 local client = vim .lsp .get_client_by_id (event .data .client_id )
560- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_documentHighlight ) then
584+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_documentHighlight , event . buf ) then
561585 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
562586 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
563587 buffer = event .buf ,
@@ -584,14 +608,43 @@ require('lazy').setup({
584608 -- code, if the language server you are using supports them
585609 --
586610 -- This may be unwanted, since they displace some of your code
587- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_inlayHint ) then
611+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_inlayHint , event . buf ) then
588612 map (' <leader>th' , function ()
589613 vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event .buf })
590614 end , ' [T]oggle Inlay [H]ints' )
591615 end
592616 end ,
593617 })
594618
619+ -- Diagnostic Config
620+ -- See :help vim.diagnostic.Opts
621+ vim .diagnostic .config {
622+ severity_sort = true ,
623+ float = { border = ' rounded' , source = ' if_many' },
624+ underline = { severity = vim .diagnostic .severity .ERROR },
625+ signs = vim .g .have_nerd_font and {
626+ text = {
627+ [vim .diagnostic .severity .ERROR ] = ' ' ,
628+ [vim .diagnostic .severity .WARN ] = ' ' ,
629+ [vim .diagnostic .severity .INFO ] = ' ' ,
630+ [vim .diagnostic .severity .HINT ] = ' ' ,
631+ },
632+ } or {},
633+ virtual_text = {
634+ source = ' if_many' ,
635+ spacing = 2 ,
636+ format = function (diagnostic )
637+ local diagnostic_message = {
638+ [vim .diagnostic .severity .ERROR ] = diagnostic .message ,
639+ [vim .diagnostic .severity .WARN ] = diagnostic .message ,
640+ [vim .diagnostic .severity .INFO ] = diagnostic .message ,
641+ [vim .diagnostic .severity .HINT ] = diagnostic .message ,
642+ }
643+ return diagnostic_message [diagnostic .severity ]
644+ end ,
645+ },
646+ }
647+
595648 -- LSP servers and clients are able to communicate to each other what features they support.
596649 -- By default, Neovim doesn't support everything that is in the LSP specification.
597650 -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
@@ -632,8 +685,8 @@ require('lazy').setup({
632685 --
633686
634687 lua_ls = {
635- -- cmd = {...},
636- -- filetypes = { ...},
688+ -- cmd = { ... },
689+ -- filetypes = { ... },
637690 -- capabilities = {},
638691 settings = {
639692 Lua = {
@@ -651,13 +704,16 @@ require('lazy').setup({
651704 }
652705
653706 -- Ensure the servers and tools above are installed
654- -- To check the current status of installed tools and/or manually install
655- -- other tools, you can run
707+ --
708+ -- To check the current status of installed tools and/or manually install
709+ -- other tools, you can run
656710 -- :Mason
657711 --
658- -- You can press `g?` for help in this menu.
659- require (' mason' ).setup ()
660-
712+ -- You can press `g?` for help in this menu.
713+ --
714+ -- `mason` had to be setup earlier: to configure its options see the
715+ -- `dependencies` table for `nvim-lspconfig` above.
716+ --
661717 -- You can add other tools here that you want Mason to install
662718 -- for you, so that they are available from within Neovim.
663719 local ensure_installed = vim .tbl_keys (servers or {})
@@ -667,6 +723,8 @@ require('lazy').setup({
667723 require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
668724
669725 require (' mason-lspconfig' ).setup {
726+ ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
727+ automatic_installation = false ,
670728 handlers = {
671729 function (server_name )
672730 local server = servers [server_name ] or {}
@@ -759,6 +817,7 @@ require('lazy').setup({
759817 -- into multiple repos for maintenance purposes.
760818 ' hrsh7th/cmp-nvim-lsp' ,
761819 ' hrsh7th/cmp-path' ,
820+ ' hrsh7th/cmp-nvim-lsp-signature-help' ,
762821 },
763822 config = function ()
764823 -- See `:help cmp`
@@ -835,6 +894,7 @@ require('lazy').setup({
835894 { name = ' nvim_lsp' },
836895 { name = ' luasnip' },
837896 { name = ' path' },
897+ { name = ' nvim_lsp_signature_help' },
838898 },
839899 }
840900 end ,
@@ -847,14 +907,18 @@ require('lazy').setup({
847907 -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
848908 ' folke/tokyonight.nvim' ,
849909 priority = 1000 , -- Make sure to load this before all the other start plugins.
850- init = function ()
910+ config = function ()
911+ --- @diagnostic disable-next-line : missing-fields
912+ require (' tokyonight' ).setup {
913+ styles = {
914+ comments = { italic = false }, -- Disable italics in comments
915+ },
916+ }
917+
851918 -- Load the colorscheme here.
852919 -- Like many other themes, this one has different styles, and you could load
853920 -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
854921 vim .cmd .colorscheme ' tokyonight-night'
855-
856- -- You can configure highlights by doing something like:
857- vim .cmd .hi ' Comment gui=none'
858922 end ,
859923 },
860924
@@ -937,7 +1001,7 @@ require('lazy').setup({
9371001 -- end,
9381002 -- },
9391003
940- -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
1004+ -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
9411005 -- init.lua. If you want these files, they are in the repository, so you can just download them and
9421006 -- place them in the correct locations.
9431007
@@ -957,8 +1021,12 @@ require('lazy').setup({
9571021 -- This is the easiest way to modularize your config.
9581022 --
9591023 -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
960- -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
9611024 -- { import = 'custom.plugins' },
1025+ --
1026+ -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
1027+ -- Or use telescope!
1028+ -- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
1029+ -- you can continue same window with `<space>sr` which resumes last telescope search
9621030}, {
9631031 ui = {
9641032 -- If you are using a Nerd Font: set icons to an empty table which will use the
0 commit comments