feat: move coding-related plugins to coding.lua

This is the first commit of my v2 update. I am following the LazyVim
pattern for organizing all of my configuration options. I like LazyVim a
lot and would use it myself - except I have an obsession with tinkering
and doing this part myself. So I shall!
This commit is contained in:
Devin Haska 2024-04-26 16:57:31 -06:00
parent 8591814ca5
commit 102af95a0b
6 changed files with 109 additions and 114 deletions

86
lua/plugins/coding.lua Normal file
View file

@ -0,0 +1,86 @@
return {
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-nvim-lsp" },
config = function()
local cmp = require("cmp")
cmp.setup({
-- Highlights the first result always
completion = {
completeopt = "menu,menuone,noinsert",
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-o>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { "i" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i" }),
["<CR>"] = cmp.mapping.confirm({
behaviour = cmp.ConfirmBehavior.Insert,
select = true,
}),
}),
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "buffer" },
}),
})
end,
},
{
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
},
{
"echasnovski/mini.pairs",
version = false,
opts = {},
},
{
"echasnovski/mini.surround",
version = false,
opts = {},
},
{
"JoosepAlviste/nvim-ts-context-commentstring",
opts = {
enable_autocmd = false,
},
},
{
"echasnovski/mini.comment",
version = false,
opts = {
options = {
custom_commentstring = function()
return require("ts_context_commentstring.internal").calculate_commentstring()
or vim.bo.commentstring
end,
},
},
},
}