forked from dineshsalunke/nvim-config
90 lines
2.9 KiB
Lua
90 lines
2.9 KiB
Lua
return {
|
|
|
|
{
|
|
"L3MON4D3/LuaSnip",
|
|
build = (not jit.os:find("Windows"))
|
|
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
|
|
or nil,
|
|
dependencies = {
|
|
"rafamadriz/friendly-snippets",
|
|
config = function()
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
end,
|
|
},
|
|
opts = {
|
|
history = true,
|
|
delete_check_events = "TextChanged",
|
|
},
|
|
-- stylua: ignore
|
|
keys = {
|
|
{
|
|
"<tab>",
|
|
function()
|
|
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
|
|
end,
|
|
expr = true, silent = true, mode = "i",
|
|
},
|
|
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
|
|
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
|
|
},
|
|
},
|
|
|
|
{
|
|
"hrsh7th/nvim-cmp",
|
|
event = "InsertEnter",
|
|
dependencies = {
|
|
"hrsh7th/cmp-nvim-lsp",
|
|
"hrsh7th/cmp-buffer",
|
|
"hrsh7th/cmp-path",
|
|
"saadparwaiz1/cmp_luasnip",
|
|
},
|
|
opts = function ()
|
|
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
|
local cmp = require("cmp")
|
|
return {
|
|
completion = {
|
|
completeopt = "menu,menuone,noinsert"
|
|
},
|
|
snippet = {
|
|
expand = function (args)
|
|
require("luasnip").lsp_expand(args)
|
|
end,
|
|
},
|
|
mapping = cmp.mapping.preset.insert({
|
|
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
["<C-Space>"] = cmp.mapping.complete(),
|
|
["<C-e>"] = cmp.mapping.abort(),
|
|
["<CR>"] = cmp.mapping.confirm({ behavior = cmp.SelectBehavior.Replace, select = true}),
|
|
}),
|
|
sources = cmp.config.sources({
|
|
{ name = "path" },
|
|
{ name = "nvim_lsp" },
|
|
{ name = "buffer", keyword_length = 5 },
|
|
{ name = "luasnip", keyword_length = 3 },
|
|
})
|
|
}
|
|
end
|
|
},
|
|
|
|
|
|
{
|
|
"echasnovski/mini.pairs",
|
|
event = "VeryLazy",
|
|
opts = {}
|
|
},
|
|
|
|
{
|
|
"echasnovski/mini.comment",
|
|
event = "VeryLazy",
|
|
opts = {
|
|
options = {
|
|
custom_commentstring = function()
|
|
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
|
|
end,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|