@@ -416,15 +416,6 @@ require('lazy').setup({
416416 group = vim .api .nvim_create_augroup (' telescope-lsp-attach' , { clear = true }),
417417 callback = function (event )
418418 local buf = event .buf
419- local client = vim .lsp .get_client_by_id (event .data .client_id )
420-
421- local goto_declaration = function ()
422- if client and client :supports_method (' textDocument/declaration' , buf ) then
423- vim .lsp .buf .declaration ()
424- else
425- builtin .lsp_definitions ()
426- end
427- end
428419
429420 -- Find references for the word under your cursor.
430421 vim .keymap .set (' n' , ' grr' , builtin .lsp_references , { buffer = buf , desc = ' [G]oto [R]eferences' })
@@ -436,9 +427,7 @@ require('lazy').setup({
436427 -- Jump to the definition of the word under your cursor.
437428 -- This is where a variable was first declared, or where a function is defined, etc.
438429 -- To jump back, press <C-t>.
439- vim .keymap .set (' n' , ' gd' , builtin .lsp_definitions , { buffer = buf , desc = ' [G]oto [D]efinition' })
440430 vim .keymap .set (' n' , ' grd' , builtin .lsp_definitions , { buffer = buf , desc = ' [G]oto [D]efinition' })
441- vim .keymap .set (' n' , ' gD' , goto_declaration , { buffer = buf , desc = ' [G]oto [D]eclaration' })
442431
443432 -- Fuzzy find all the symbols in your current document.
444433 -- Symbols are things like variables, functions, types, etc.
@@ -491,15 +480,7 @@ require('lazy').setup({
491480 -- Automatically install LSPs and related tools to stdpath for Neovim
492481 -- Mason must be loaded before its dependents so we need to set it up here.
493482 -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
494- {
495- ' mason-org/mason.nvim' ,
496- opts = {
497- registries = {
498- ' github:mason-org/mason-registry' ,
499- ' github:Crashdummyy/mason-registry' ,
500- },
501- },
502- },
483+ { ' mason-org/mason.nvim' , opts = {} },
503484 { ' mason-org/mason-lspconfig.nvim' , opts = {} },
504485 ' WhoIsSethDaniel/mason-tool-installer.nvim' ,
505486
@@ -542,8 +523,6 @@ require('lazy').setup({
542523 vim .api .nvim_create_autocmd (' LspAttach' , {
543524 group = vim .api .nvim_create_augroup (' kickstart-lsp-attach' , { clear = true }),
544525 callback = function (event )
545- local client = vim .lsp .get_client_by_id (event .data .client_id )
546-
547526 -- NOTE: Remember that Lua is a real programming language, and as such it is possible
548527 -- to define small helper and utility functions so you don't have to repeat yourself.
549528 --
@@ -558,28 +537,20 @@ require('lazy').setup({
558537 -- Most Language Servers support renaming across files, etc.
559538 map (' grn' , vim .lsp .buf .rename , ' [R]e[n]ame' )
560539
561- -- Show documentation for the symbol under your cursor.
562- map (' K' , vim .lsp .buf .hover , ' Hover Documentation' )
563-
564540 -- Execute a code action, usually your cursor needs to be on top of an error
565541 -- or a suggestion from your LSP for this to activate.
566542 map (' gra' , vim .lsp .buf .code_action , ' [G]oto Code [A]ction' , { ' n' , ' x' })
567543
568544 -- WARN: This is not Goto Definition, this is Goto Declaration.
569545 -- For example, in C this would take you to the header.
570- map (' grD' , function ()
571- if client and client :supports_method (' textDocument/declaration' , event .buf ) then
572- vim .lsp .buf .declaration ()
573- else
574- vim .lsp .buf .definition ()
575- end
576- end , ' [G]oto [D]eclaration' )
546+ map (' grD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
577547
578548 -- The following two autocommands are used to highlight references of the
579549 -- word under your cursor when your cursor rests there for a little while.
580550 -- See `:help CursorHold` for information about when this is executed
581551 --
582552 -- When you move your cursor, the highlights will be cleared (the second autocommand).
553+ local client = vim .lsp .get_client_by_id (event .data .client_id )
583554 if client and client :supports_method (' textDocument/documentHighlight' , event .buf ) then
584555 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
585556 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
@@ -882,25 +853,12 @@ require('lazy').setup({
882853
883854 { -- Highlight, edit, and navigate code
884855 ' nvim-treesitter/nvim-treesitter' ,
885- build = ' :TSUpdate' ,
886856 config = function ()
857+ local filetypes = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline' , ' query' , ' vim' , ' vimdoc' }
858+ require (' nvim-treesitter' ).install (filetypes )
887859 vim .api .nvim_create_autocmd (' FileType' , {
888- pattern = {
889- ' bash' ,
890- ' c' ,
891- ' cs' ,
892- ' diff' ,
893- ' html' ,
894- ' lua' ,
895- ' markdown' ,
896- ' query' ,
897- ' vim' ,
898- ' help' ,
899- },
900- callback = function (args )
901- local lang = vim .treesitter .language .get_lang (args .match ) or args .match
902- pcall (vim .treesitter .start , args .buf , lang )
903- end ,
860+ pattern = filetypes ,
861+ callback = function () vim .treesitter .start () end ,
904862 })
905863 end ,
906864 },
@@ -925,7 +883,7 @@ require('lazy').setup({
925883 -- This is the easiest way to modularize your config.
926884 --
927885 -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
928- { import = ' custom.plugins' },
886+ -- { import = 'custom.plugins' },
929887 --
930888 -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
931889 -- Or use telescope!
0 commit comments