Modularized all my plugins

This commit is contained in:
Rakshit Sinha 2024-11-09 21:49:28 -08:00
parent a467ba4a69
commit 86b269d5f9
9 changed files with 193 additions and 130 deletions

View file

@ -9,7 +9,7 @@ return { -- Autocompletion
-- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows.
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
if vim.fn.has('win32') == 1 or vim.fn.executable('make') == 0 then
return
end
return 'make install_jsregexp'
@ -39,15 +39,15 @@ return { -- Autocompletion
},
config = function()
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
local lspkind = require 'lspkind'
local cmp = require('cmp')
local luasnip = require('luasnip')
local lspkind = require('lspkind')
-- loads vscode style snippets from the installed plugins (e.g. friendly-snippets)
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
luasnip.config.setup({})
cmp.setup {
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
@ -59,7 +59,7 @@ return { -- Autocompletion
-- chosen, you will need to read `:help ins-completion`
--
-- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert {
mapping = cmp.mapping.preset.insert({
-- Select the [n]ext item
-- ['<C-j>'] = cmp.mapping.select_next_item(),
-- Select the [p]revious item
@ -77,12 +77,12 @@ return { -- Autocompletion
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
['<CR>'] = cmp.mapping.confirm { select = false },
['<CR>'] = cmp.mapping.confirm({ select = false }),
-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available.
['<C-Space>'] = cmp.mapping.complete {},
['<C-Space>'] = cmp.mapping.complete({}),
['<C-e>'] = cmp.mapping.abort(), -- close completion window
-- Think of <c-l> as moving to the right of your snippet expansion.
@ -106,13 +106,13 @@ return { -- Autocompletion
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},
}),
sources = {
{
name = 'lazydev',
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
group_index = 0,
},
-- {
-- name = 'lazydev',
-- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
-- group_index = 0,
-- },
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
@ -121,11 +121,13 @@ return { -- Autocompletion
-- configure lspkind for VSCode like pictograms in completion menu
-- formatting = {
-- fields = cmp.ItemField.Abbr,
-- expandable_indicator = true,
-- format = lspkind.cmp_format({
-- maxwidth = 50,
-- ellipsis_char = '...',
-- }),
-- },
}
})
end,
}