100 lines
3.2 KiB
Lua
100 lines
3.2 KiB
Lua
return {
|
|
{
|
|
"hrsh7th/nvim-cmp",
|
|
dependencies = {
|
|
"hrsh7th/cmp-nvim-lsp",
|
|
"hrsh7th/cmp-buffer",
|
|
},
|
|
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({ 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 = {
|
|
mappings = {
|
|
["`"] = { action = "closeopen", pair = "``", neigh_pattern = "[^\\`].", register = { cr = false } },
|
|
},
|
|
},
|
|
},
|
|
{
|
|
"echasnovski/mini.surround",
|
|
version = false,
|
|
opts = {
|
|
mappings = {
|
|
add = "gsa", -- Add surrounding in Normal and Visual modes
|
|
delete = "gsd", -- Delete surrounding
|
|
find = "gsf", -- Find surrounding (to the right)
|
|
find_left = "gsF", -- Find surrounding (to the left)
|
|
highlight = "gsh", -- Highlight surrounding
|
|
replace = "gsr", -- Replace surrounding
|
|
update_n_lines = "gsn", -- Update `n_lines`
|
|
},
|
|
},
|
|
},
|
|
{
|
|
"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,
|
|
},
|
|
},
|
|
},
|
|
}
|