@@ -235,12 +235,22 @@ require('lazy').setup({
235235 -- with the first argument being the link and the following
236236 -- keys can be used to configure plugin behavior/loading/etc.
237237 --
238- -- 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.
239239 --
240240
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+ --
241252 -- Here is a more advanced example where we pass configuration
242- -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
243- -- require('gitsigns').setup({ ... })
253+ -- options to `gitsigns.nvim`.
244254 --
245255 -- See `:help gitsigns` to understand what the configuration keys do
246256 { -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -616,16 +626,29 @@ require('lazy').setup({
616626 -- For example, in C this would take you to the header.
617627 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
618628
629+ -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
630+ --- @param client vim.lsp.Client
631+ --- @param method vim.lsp.protocol.Method
632+ --- @param bufnr ? integer some lsp support methods only in specific files
633+ --- @return boolean
634+ local function client_supports_method (client , method , bufnr )
635+ if vim .fn .has ' nvim-0.11' == 1 then
636+ return client :supports_method (method , bufnr )
637+ else
638+ return client .supports_method (method , { bufnr = bufnr })
639+ end
640+ end
641+
619642 -- The following two autocommands are used to highlight references of the
620643 -- word under your cursor when your cursor rests there for a little while.
621644 -- See `:help CursorHold` for information about when this is executed
622645 --
623646 -- When you move your cursor, the highlights will be cleared (the second autocommand).
624647 -- local client = vim.lsp.get_client_by_id(event.data.client_id)
625- -- if client and client.supports_method( vim.lsp.protocol.Methods.textDocument_documentHighlight) then
648+ -- if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf ) then
626649 -- local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
627650 -- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
628- -- buffer = event.buf,
651+ -- buffer = event.buf,
629652 -- group = highlight_augroup,
630653 -- callback = vim.lsp.buf.document_highlight,
631654 -- })
@@ -649,23 +672,42 @@ require('lazy').setup({
649672 -- code, if the language server you are using supports them
650673 --
651674 -- This may be unwanted, since they displace some of your code
652- -- if client and client.supports_method( vim.lsp.protocol.Methods.textDocument_inlayHint) then
675+ -- if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf ) then
653676 -- map('<leader>th', function()
654677 -- vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
655678 -- end, '[T]oggle Inlay [H]ints')
656679 -- end
657680 end ,
658681 })
659682
660- -- Change diagnostic symbols in the sign column (gutter)
661- -- if vim.g.have_nerd_font then
662- -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
663- -- local diagnostic_signs = {}
664- -- for type, icon in pairs(signs) do
665- -- diagnostic_signs[vim.diagnostic.severity[type]] = icon
666- -- end
667- -- vim.diagnostic.config { signs = { text = diagnostic_signs } }
668- -- end
683+ -- Diagnostic Config
684+ -- See :help vim.diagnostic.Opts
685+ vim .diagnostic .config {
686+ severity_sort = true ,
687+ float = { border = ' rounded' , source = ' if_many' },
688+ underline = { severity = vim .diagnostic .severity .ERROR },
689+ signs = vim .g .have_nerd_font and {
690+ text = {
691+ [vim .diagnostic .severity .ERROR ] = ' ' ,
692+ [vim .diagnostic .severity .WARN ] = ' ' ,
693+ [vim .diagnostic .severity .INFO ] = ' ' ,
694+ [vim .diagnostic .severity .HINT ] = ' ' ,
695+ },
696+ } or {},
697+ virtual_text = {
698+ source = ' if_many' ,
699+ spacing = 2 ,
700+ format = function (diagnostic )
701+ local diagnostic_message = {
702+ [vim .diagnostic .severity .ERROR ] = diagnostic .message ,
703+ [vim .diagnostic .severity .WARN ] = diagnostic .message ,
704+ [vim .diagnostic .severity .INFO ] = diagnostic .message ,
705+ [vim .diagnostic .severity .HINT ] = diagnostic .message ,
706+ }
707+ return diagnostic_message [diagnostic .severity ]
708+ end ,
709+ },
710+ }
669711
670712 -- LSP servers and clients are able to communicate to each other what features they support.
671713 -- By default, Neovim doesn't support everything that is in the LSP specification.
@@ -739,6 +781,8 @@ require('lazy').setup({
739781 require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
740782
741783 require (' mason-lspconfig' ).setup {
784+ ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
785+ automatic_installation = false ,
742786 handlers = {
743787 function (server_name )
744788 local server = servers [server_name ] or {}
@@ -826,17 +870,18 @@ require('lazy').setup({
826870 },
827871 ' saadparwaiz1/cmp_luasnip' ,
828872
829- -- Adds other completion capabilities.
830- -- nvim-cmp does not ship with all sources by default. They are split
831- -- into multiple repos for maintenance purposes.
832- ' hrsh7th/cmp-nvim-lsp' ,
833- ' hrsh7th/cmp-path' ,
834- },
835- config = function ()
836- -- See `:help cmp`
837- local cmp = require ' cmp'
838- local luasnip = require ' luasnip'
839- luasnip .config .setup {}
873+ -- Adds other completion capabilities.
874+ -- nvim-cmp does not ship with all sources by default. They are split
875+ -- into multiple repos for maintenance purposes.
876+ ' hrsh7th/cmp-nvim-lsp' ,
877+ ' hrsh7th/cmp-path' ,
878+ ' hrsh7th/cmp-nvim-lsp-signature-help' ,
879+ },
880+ config = function ()
881+ -- See `:help cmp`
882+ local cmp = require ' cmp'
883+ local luasnip = require ' luasnip'
884+ luasnip .config .setup {}
840885
841886 cmp .setup {
842887 snippet = {
@@ -895,22 +940,23 @@ require('lazy').setup({
895940 end
896941 end , { ' i' , ' s' }),
897942
898- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
899- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
900- },
901- sources = {
902- {
903- name = ' lazydev' ,
904- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
905- group_index = 0 ,
906- },
907- { name = ' nvim_lsp' },
908- { name = ' luasnip' },
909- { name = ' path' },
910- },
911- }
912- end ,
913- },
943+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
944+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
945+ },
946+ sources = {
947+ {
948+ name = ' lazydev' ,
949+ -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
950+ group_index = 0 ,
951+ },
952+ { name = ' nvim_lsp' },
953+ { name = ' luasnip' },
954+ { name = ' path' },
955+ { name = ' nvim_lsp_signature_help' },
956+ },
957+ }
958+ end ,
959+ },
914960
915961 { -- You can easily change to a different colorscheme.
916962 -- Change the name of the colorscheme plugin below, and then
@@ -919,14 +965,18 @@ require('lazy').setup({
919965 -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
920966 ' folke/tokyonight.nvim' ,
921967 priority = 1000 , -- Make sure to load this before all the other start plugins.
922- init = function ()
968+ config = function ()
969+ --- @diagnostic disable-next-line : missing-fields
970+ require (' tokyonight' ).setup {
971+ styles = {
972+ comments = { italic = false }, -- Disable italics in comments
973+ },
974+ }
975+
923976 -- Load the colorscheme here.
924977 -- Like many other themes, this one has different styles, and you could load
925978 -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
926- vim .cmd .colorscheme ' retrobox'
927-
928- -- You can configure highlights by doing something like:
929- vim .cmd .hi ' Comment gui=none'
979+ vim .cmd .colorscheme ' tokyonight-night'
930980 end ,
931981 },
932982
0 commit comments