@@ -234,12 +234,22 @@ require('lazy').setup({
234234 -- with the first argument being the link and the following
235235 -- keys can be used to configure plugin behavior/loading/etc.
236236 --
237- -- Use `opts = {}` to force a plugin to be loaded.
237+ -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
238238 --
239239
240+ -- Alternatively, use `config = function() ... end` for full control over the configuration.
241+ -- If you prefer to call `setup` explicitly, use:
242+ -- {
243+ -- 'lewis6991/gitsigns.nvim',
244+ -- config = function()
245+ -- require('gitsigns').setup({
246+ -- -- Your gitsigns configuration here
247+ -- })
248+ -- end,
249+ -- }
250+ --
240251 -- Here is a more advanced example where we pass configuration
241- -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
242- -- require('gitsigns').setup({ ... })
252+ -- options to `gitsigns.nvim`.
243253 --
244254 -- See `:help gitsigns` to understand what the configuration keys do
245255 { -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -548,13 +558,26 @@ require('lazy').setup({
548558 -- For example, in C this would take you to the header.
549559 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
550560
561+ -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
562+ --- @param client vim.lsp.Client
563+ --- @param method vim.lsp.protocol.Method
564+ --- @param bufnr ? integer some lsp support methods only in specific files
565+ --- @return boolean
566+ local function client_supports_method (client , method , bufnr )
567+ if vim .fn .has ' nvim-0.11' == 1 then
568+ return client :supports_method (method , bufnr )
569+ else
570+ return client .supports_method (method , { bufnr = bufnr })
571+ end
572+ end
573+
551574 -- The following two autocommands are used to highlight references of the
552575 -- word under your cursor when your cursor rests there for a little while.
553576 -- See `:help CursorHold` for information about when this is executed
554577 --
555578 -- When you move your cursor, the highlights will be cleared (the second autocommand).
556579 local client = vim .lsp .get_client_by_id (event .data .client_id )
557- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_documentHighlight ) then
580+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_documentHighlight , event . buf ) then
558581 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
559582 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
560583 buffer = event .buf ,
@@ -581,23 +604,42 @@ require('lazy').setup({
581604 -- code, if the language server you are using supports them
582605 --
583606 -- This may be unwanted, since they displace some of your code
584- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_inlayHint ) then
607+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_inlayHint , event . buf ) then
585608 map (' <leader>th' , function ()
586609 vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event .buf })
587610 end , ' [T]oggle Inlay [H]ints' )
588611 end
589612 end ,
590613 })
591614
592- -- Change diagnostic symbols in the sign column (gutter)
593- -- if vim.g.have_nerd_font then
594- -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
595- -- local diagnostic_signs = {}
596- -- for type, icon in pairs(signs) do
597- -- diagnostic_signs[vim.diagnostic.severity[type]] = icon
598- -- end
599- -- vim.diagnostic.config { signs = { text = diagnostic_signs } }
600- -- end
615+ -- Diagnostic Config
616+ -- See :help vim.diagnostic.Opts
617+ vim .diagnostic .config {
618+ severity_sort = true ,
619+ float = { border = ' rounded' , source = ' if_many' },
620+ underline = { severity = vim .diagnostic .severity .ERROR },
621+ signs = vim .g .have_nerd_font and {
622+ text = {
623+ [vim .diagnostic .severity .ERROR ] = ' ' ,
624+ [vim .diagnostic .severity .WARN ] = ' ' ,
625+ [vim .diagnostic .severity .INFO ] = ' ' ,
626+ [vim .diagnostic .severity .HINT ] = ' ' ,
627+ },
628+ } or {},
629+ virtual_text = {
630+ source = ' if_many' ,
631+ spacing = 2 ,
632+ format = function (diagnostic )
633+ local diagnostic_message = {
634+ [vim .diagnostic .severity .ERROR ] = diagnostic .message ,
635+ [vim .diagnostic .severity .WARN ] = diagnostic .message ,
636+ [vim .diagnostic .severity .INFO ] = diagnostic .message ,
637+ [vim .diagnostic .severity .HINT ] = diagnostic .message ,
638+ }
639+ return diagnostic_message [diagnostic .severity ]
640+ end ,
641+ },
642+ }
601643
602644 -- LSP servers and clients are able to communicate to each other what features they support.
603645 -- By default, Neovim doesn't support everything that is in the LSP specification.
@@ -665,6 +707,8 @@ require('lazy').setup({
665707 require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
666708
667709 require (' mason-lspconfig' ).setup {
710+ ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
711+ automatic_installation = false ,
668712 handlers = {
669713 function (server_name )
670714 local server = servers [server_name ] or {}
@@ -757,6 +801,7 @@ require('lazy').setup({
757801 -- into multiple repos for maintenance purposes.
758802 ' hrsh7th/cmp-nvim-lsp' ,
759803 ' hrsh7th/cmp-path' ,
804+ ' hrsh7th/cmp-nvim-lsp-signature-help' ,
760805 },
761806 config = function ()
762807 -- See `:help cmp`
@@ -833,6 +878,7 @@ require('lazy').setup({
833878 { name = ' nvim_lsp' },
834879 { name = ' luasnip' },
835880 { name = ' path' },
881+ { name = ' nvim_lsp_signature_help' },
836882 },
837883 }
838884 end ,
@@ -847,7 +893,14 @@ require('lazy').setup({
847893 -- 'oxfist/night-owl.nvim',
848894 lazy = false ,
849895 priority = 1000 , -- Make sure to load this before all the other start plugins.
850- init = function ()
896+ config = function ()
897+ --- @diagnostic disable-next-line : missing-fields
898+ require (' tokyonight' ).setup {
899+ styles = {
900+ comments = { italic = false }, -- Disable italics in comments
901+ },
902+ }
903+
851904 -- Load the colorscheme here.
852905 -- Like many other themes, this one has different styles, and you could load
853906 -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
0 commit comments