Skip to content

Commit 8e2a82e

Browse files
committed
re-enable cmp and tree-sitter
1 parent d4ce269 commit 8e2a82e

File tree

1 file changed

+155
-155
lines changed

1 file changed

+155
-155
lines changed

init.lua

Lines changed: 155 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ require('lazy').setup({
383383
{ 'j-hui/fidget.nvim', opts = {} },
384384

385385
-- Allows extra capabilities provided by nvim-cmp
386-
'hrsh7th/cmp-nvim-lsp',
386+
-- 'hrsh7th/cmp-nvim-lsp',
387387
},
388388
config = function()
389389
-- Brief aside: **What is LSP?**
@@ -642,123 +642,123 @@ require('lazy').setup({
642642
},
643643
},
644644

645-
-- { -- Autocompletion
646-
-- 'hrsh7th/nvim-cmp',
647-
-- event = 'InsertEnter',
648-
-- dependencies = {
649-
-- -- Snippet Engine & its associated nvim-cmp source
650-
-- {
651-
-- 'L3MON4D3/LuaSnip',
652-
-- build = (function()
653-
-- -- Build Step is needed for regex support in snippets.
654-
-- -- This step is not supported in many windows environments.
655-
-- -- Remove the below condition to re-enable on windows.
656-
-- if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
657-
-- return
658-
-- end
659-
-- return 'make install_jsregexp'
660-
-- end)(),
661-
-- dependencies = {
662-
-- -- `friendly-snippets` contains a variety of premade snippets.
663-
-- -- See the README about individual language/framework/plugin snippets:
664-
-- -- https://github.com/rafamadriz/friendly-snippets
665-
-- {
666-
-- 'rafamadriz/friendly-snippets',
667-
-- config = function()
668-
-- require('luasnip.loaders.from_vscode').lazy_load()
669-
-- end,
670-
-- },
671-
-- },
672-
-- },
673-
-- 'saadparwaiz1/cmp_luasnip',
674-
--
675-
-- -- Adds other completion capabilities.
676-
-- -- nvim-cmp does not ship with all sources by default. They are split
677-
-- -- into multiple repos for maintenance purposes.
678-
-- 'hrsh7th/cmp-nvim-lsp',
679-
-- 'hrsh7th/cmp-path',
680-
-- },
681-
-- config = function()
682-
-- -- See `:help cmp`
683-
-- local cmp = require 'cmp'
684-
-- local luasnip = require 'luasnip'
685-
-- luasnip.config.setup {}
686-
--
687-
-- cmp.setup {
688-
-- snippet = {
689-
-- expand = function(args)
690-
-- luasnip.lsp_expand(args.body)
691-
-- end,
692-
-- },
693-
-- completion = { completeopt = 'menu,menuone,noinsert' },
694-
--
695-
-- -- For an understanding of why these mappings were
696-
-- -- chosen, you will need to read `:help ins-completion`
697-
-- --
698-
-- -- No, but seriously. Please read `:help ins-completion`, it is really good!
699-
-- mapping = cmp.mapping.preset.insert {
700-
-- -- Select the [n]ext item
701-
-- ['<C-n>'] = cmp.mapping.select_next_item(),
702-
-- -- Select the [p]revious item
703-
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
704-
--
705-
-- -- Scroll the documentation window [b]ack / [f]orward
706-
-- ['<C-b>'] = cmp.mapping.scroll_docs(-4),
707-
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
708-
--
709-
-- -- Accept ([y]es) the completion.
710-
-- -- This will auto-import if your LSP supports it.
711-
-- -- This will expand snippets if the LSP sent a snippet.
712-
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
713-
--
714-
-- -- If you prefer more traditional completion keymaps,
715-
-- -- you can uncomment the following lines
716-
-- --['<CR>'] = cmp.mapping.confirm { select = true },
717-
-- --['<Tab>'] = cmp.mapping.select_next_item(),
718-
-- --['<S-Tab>'] = cmp.mapping.select_prev_item(),
719-
--
720-
-- -- Manually trigger a completion from nvim-cmp.
721-
-- -- Generally you don't need this, because nvim-cmp will display
722-
-- -- completions whenever it has completion options available.
723-
-- ['<C-Space>'] = cmp.mapping.complete {},
724-
--
725-
-- -- Think of <c-l> as moving to the right of your snippet expansion.
726-
-- -- So if you have a snippet that's like:
727-
-- -- function $name($args)
728-
-- -- $body
729-
-- -- end
730-
-- --
731-
-- -- <c-l> will move you to the right of each of the expansion locations.
732-
-- -- <c-h> is similar, except moving you backwards.
733-
-- ['<C-l>'] = cmp.mapping(function()
734-
-- if luasnip.expand_or_locally_jumpable() then
735-
-- luasnip.expand_or_jump()
736-
-- end
737-
-- end, { 'i', 's' }),
738-
-- ['<C-h>'] = cmp.mapping(function()
739-
-- if luasnip.locally_jumpable(-1) then
740-
-- luasnip.jump(-1)
741-
-- end
742-
-- end, { 'i', 's' }),
743-
--
744-
-- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
745-
-- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
746-
-- },
747-
-- sources = {
748-
-- {
749-
-- name = 'lazydev',
750-
-- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
751-
-- group_index = 0,
752-
-- },
753-
-- { name = 'nvim_lsp' },
754-
-- { name = 'luasnip' },
755-
-- { name = 'path' },
756-
-- { name = 'copilot' },
757-
-- { name = 'buffer' },
758-
-- },
759-
-- }
760-
-- end,
761-
-- },
645+
{ -- Autocompletion
646+
'hrsh7th/nvim-cmp',
647+
event = 'InsertEnter',
648+
dependencies = {
649+
-- Snippet Engine & its associated nvim-cmp source
650+
{
651+
'L3MON4D3/LuaSnip',
652+
build = (function()
653+
-- Build Step is needed for regex support in snippets.
654+
-- This step is not supported in many windows environments.
655+
-- Remove the below condition to re-enable on windows.
656+
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
657+
return
658+
end
659+
return 'make install_jsregexp'
660+
end)(),
661+
dependencies = {
662+
-- `friendly-snippets` contains a variety of premade snippets.
663+
-- See the README about individual language/framework/plugin snippets:
664+
-- https://github.com/rafamadriz/friendly-snippets
665+
{
666+
'rafamadriz/friendly-snippets',
667+
config = function()
668+
require('luasnip.loaders.from_vscode').lazy_load()
669+
end,
670+
},
671+
},
672+
},
673+
'saadparwaiz1/cmp_luasnip',
674+
675+
-- Adds other completion capabilities.
676+
-- nvim-cmp does not ship with all sources by default. They are split
677+
-- into multiple repos for maintenance purposes.
678+
'hrsh7th/cmp-nvim-lsp',
679+
'hrsh7th/cmp-path',
680+
},
681+
config = function()
682+
-- See `:help cmp`
683+
local cmp = require 'cmp'
684+
local luasnip = require 'luasnip'
685+
luasnip.config.setup {}
686+
687+
cmp.setup {
688+
snippet = {
689+
expand = function(args)
690+
luasnip.lsp_expand(args.body)
691+
end,
692+
},
693+
completion = { completeopt = 'menu,menuone,noinsert' },
694+
695+
-- For an understanding of why these mappings were
696+
-- chosen, you will need to read `:help ins-completion`
697+
--
698+
-- No, but seriously. Please read `:help ins-completion`, it is really good!
699+
mapping = cmp.mapping.preset.insert {
700+
-- Select the [n]ext item
701+
['<C-n>'] = cmp.mapping.select_next_item(),
702+
-- Select the [p]revious item
703+
['<C-p>'] = cmp.mapping.select_prev_item(),
704+
705+
-- Scroll the documentation window [b]ack / [f]orward
706+
['<C-b>'] = cmp.mapping.scroll_docs(-4),
707+
['<C-f>'] = cmp.mapping.scroll_docs(4),
708+
709+
-- Accept ([y]es) the completion.
710+
-- This will auto-import if your LSP supports it.
711+
-- This will expand snippets if the LSP sent a snippet.
712+
['<C-y>'] = cmp.mapping.confirm { select = true },
713+
714+
-- If you prefer more traditional completion keymaps,
715+
-- you can uncomment the following lines
716+
--['<CR>'] = cmp.mapping.confirm { select = true },
717+
--['<Tab>'] = cmp.mapping.select_next_item(),
718+
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
719+
720+
-- Manually trigger a completion from nvim-cmp.
721+
-- Generally you don't need this, because nvim-cmp will display
722+
-- completions whenever it has completion options available.
723+
['<C-Space>'] = cmp.mapping.complete {},
724+
725+
-- Think of <c-l> as moving to the right of your snippet expansion.
726+
-- So if you have a snippet that's like:
727+
-- function $name($args)
728+
-- $body
729+
-- end
730+
--
731+
-- <c-l> will move you to the right of each of the expansion locations.
732+
-- <c-h> is similar, except moving you backwards.
733+
['<C-l>'] = cmp.mapping(function()
734+
if luasnip.expand_or_locally_jumpable() then
735+
luasnip.expand_or_jump()
736+
end
737+
end, { 'i', 's' }),
738+
['<C-h>'] = cmp.mapping(function()
739+
if luasnip.locally_jumpable(-1) then
740+
luasnip.jump(-1)
741+
end
742+
end, { 'i', 's' }),
743+
744+
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
745+
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
746+
},
747+
sources = {
748+
{
749+
name = 'lazydev',
750+
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
751+
group_index = 0,
752+
},
753+
{ name = 'nvim_lsp' },
754+
{ name = 'luasnip' },
755+
{ name = 'path' },
756+
{ name = 'copilot' },
757+
{ name = 'buffer' },
758+
},
759+
}
760+
end,
761+
},
762762

763763
{ -- You can easily change to a different colorscheme.
764764
-- Change the name of the colorscheme plugin below, and then
@@ -783,43 +783,43 @@ require('lazy').setup({
783783
-- Highlight todo, notes, etc in comments
784784
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
785785

786-
{ -- Collection of various small independent plugins/modules
787-
'echasnovski/mini.nvim',
788-
config = function()
789-
-- Better Around/Inside textobjects
790-
--
791-
-- Examples:
792-
-- - va) - [V]isually select [A]round [)]paren
793-
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
794-
-- - ci' - [C]hange [I]nside [']quote
795-
require('mini.ai').setup { n_lines = 500 }
796-
797-
-- Add/delete/replace surroundings (brackets, quotes, etc.)
798-
--
799-
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
800-
-- - sd' - [S]urround [D]elete [']quotes
801-
-- - sr)' - [S]urround [R]eplace [)] [']
802-
require('mini.surround').setup()
803-
804-
-- Simple and easy statusline.
805-
-- You could remove this setup call if you don't like it,
806-
-- and try some other statusline plugin
807-
local statusline = require 'mini.statusline'
808-
-- set use_icons to true if you have a Nerd Font
809-
statusline.setup { use_icons = vim.g.have_nerd_font }
810-
811-
-- You can configure sections in the statusline by overriding their
812-
-- default behavior. For example, here we set the section for
813-
-- cursor location to LINE:COLUMN
814-
---@diagnostic disable-next-line: duplicate-set-field
815-
statusline.section_location = function()
816-
return '%2l:%-2v'
817-
end
818-
819-
-- ... and there is more!
820-
-- Check out: https://github.com/echasnovski/mini.nvim
821-
end,
822-
},
786+
-- { -- Collection of various small independent plugins/modules
787+
-- 'echasnovski/mini.nvim',
788+
-- config = function()
789+
-- -- Better Around/Inside textobjects
790+
-- --
791+
-- -- Examples:
792+
-- -- - va) - [V]isually select [A]round [)]paren
793+
-- -- - yinq - [Y]ank [I]nside [N]ext [Q]uote
794+
-- -- - ci' - [C]hange [I]nside [']quote
795+
-- require('mini.ai').setup { n_lines = 500 }
796+
--
797+
-- -- Add/delete/replace surroundings (brackets, quotes, etc.)
798+
-- --
799+
-- -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
800+
-- -- - sd' - [S]urround [D]elete [']quotes
801+
-- -- - sr)' - [S]urround [R]eplace [)] [']
802+
-- require('mini.surround').setup()
803+
--
804+
-- -- Simple and easy statusline.
805+
-- -- You could remove this setup call if you don't like it,
806+
-- -- and try some other statusline plugin
807+
-- local statusline = require 'mini.statusline'
808+
-- -- set use_icons to true if you have a Nerd Font
809+
-- statusline.setup { use_icons = vim.g.have_nerd_font }
810+
--
811+
-- -- You can configure sections in the statusline by overriding their
812+
-- -- default behavior. For example, here we set the section for
813+
-- -- cursor location to LINE:COLUMN
814+
-- ---@diagnostic disable-next-line: duplicate-set-field
815+
-- statusline.section_location = function()
816+
-- return '%2l:%-2v'
817+
-- end
818+
--
819+
-- -- ... and there is more!
820+
-- -- Check out: https://github.com/echasnovski/mini.nvim
821+
-- end,
822+
-- },
823823
{ -- Highlight, edit, and navigate code
824824
'nvim-treesitter/nvim-treesitter',
825825
build = ':TSUpdate',

0 commit comments

Comments
 (0)