feat: add completion and treesitter
This commit is contained in:
parent
2dc93fdd1d
commit
969864d4e0
|
|
@ -1,14 +1,23 @@
|
||||||
{
|
{
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "b3104910bb5ebf40492aadffae18f2528fa757d9" },
|
||||||
|
"cmp-nerdfont": { "branch": "main", "commit": "e97482344ebed29093015a18c155057adf5c842b" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||||
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||||
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
"lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" },
|
||||||
|
"lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" },
|
||||||
"lualine-spell-status": { "branch": "main", "commit": "aa81c2c9a71e3ed3552c6cd75e150414ff9ac664" },
|
"lualine-spell-status": { "branch": "main", "commit": "aa81c2c9a71e3ed3552c6cd75e150414ff9ac664" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7f9a39fcd2ac6e979001f857727d606888f5909c" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "f760507df8c49a4bf46a4d12e1fc616797508979" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
"mason.nvim": { "branch": "main", "commit": "b3689a41dd77e5294498dba9757fb22cc80cbebd" },
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "f1deac7ecec88c28a250d890ba7bb35843e69cbd" },
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "ed057048a281b418d5318dd5153f9486daa517a3" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "d9879110d0422a566fa01d732556f4d5515e1738" },
|
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "336b388c272555d2ae94627a50df4c2f89a5e257" },
|
||||||
|
"nvim-treesitter": { "branch": "main", "commit": "5a70b1eb8cbdf6c7f0a59dfb7356ad198421b620" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
|
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
121
lua/plugins/spec/completion.lua
Normal file
121
lua/plugins/spec/completion.lua
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
require("lazy.types")
|
||||||
|
---@type LazySpec[]
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
dependencies = {
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local lua_snippets = vim.fn.stdpath("config") .. "/luasnip"
|
||||||
|
local vscode_snippets = vim.fn.stdpath("config") .. "/snippets"
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load({ paths = { vscode_snippets } })
|
||||||
|
require("luasnip.loaders.from_lua").lazy_load({ paths = { lua_snippets } })
|
||||||
|
end,
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
event = { "InsertEnter" },
|
||||||
|
dependencies = {
|
||||||
|
"LuaSnip",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"onsails/lspkind.nvim",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"nvim-autopairs",
|
||||||
|
"chrisgrieser/cmp-nerdfont",
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
local lspkind = require("lspkind")
|
||||||
|
---@type cmp.ConfigSchema
|
||||||
|
return {
|
||||||
|
enabled = function()
|
||||||
|
local disabled = false
|
||||||
|
disabled = disabled or (vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt")
|
||||||
|
disabled = disabled or (vim.fn.reg_recording() ~= "")
|
||||||
|
disabled = disabled or (vim.fn.reg_executing() ~= "")
|
||||||
|
disabled = disabled or require("cmp.config.context").in_treesitter_capture("comment")
|
||||||
|
return not disabled
|
||||||
|
end,
|
||||||
|
preselect = cmp.PreselectMode.None,
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = {
|
||||||
|
scrollbar = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_locally_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.locally_jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<CR>"] = cmp.mapping({
|
||||||
|
i = function(fallback)
|
||||||
|
if cmp.visible() and cmp.get_active_entry() then
|
||||||
|
cmp.confirm({
|
||||||
|
behaviour = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = false,
|
||||||
|
})
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
s = cmp.mapping.confirm({ select = false }),
|
||||||
|
c = cmp.mapping.confirm({
|
||||||
|
behaviour = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = false,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "lazydev" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "nerdfont" },
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format({
|
||||||
|
mode = "symbol_text",
|
||||||
|
menu = {
|
||||||
|
nvim_lsp = "[LSP]",
|
||||||
|
luasnip = "[SNP]",
|
||||||
|
lazydev = "[LZY]",
|
||||||
|
nerdfont = "[SYM]",
|
||||||
|
},
|
||||||
|
maxwidth = 50,
|
||||||
|
ellipsis_char = "",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
8
lua/plugins/spec/treesitter.lua
Normal file
8
lua/plugins/spec/treesitter.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
lazy = false,
|
||||||
|
branch = "main",
|
||||||
|
build = "TSUpdate",
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user