kitchen sink...
just gonna put the changes that I can remember making here: - replace blink with native completion (omnifunc) - remove some unneeded plugins - add a misc function for making sure complex bindings don't cause flickering - remove some stale snippets - remove folding (I don't find myself folding that often)
This commit is contained in:
@ -1,75 +1,45 @@
|
||||
local map, auto = core.misc.map, core.misc.auto
|
||||
local map = core.misc.map
|
||||
|
||||
return { "L3MON4D3/LuaSnip",
|
||||
branch = "v2.*",
|
||||
disable = not vim.fn.has("nvim-0.7.0"),
|
||||
config = function()
|
||||
vim.cmd("make install_jsregexp")
|
||||
end,
|
||||
lazy = function(load)
|
||||
load:keymap({"i", "s"}, "<c-a>")
|
||||
load:keymap({"i", "s"}, "<c-e>")
|
||||
load:keymap({"i", "s"}, "<c-j>")
|
||||
load:keymap({"i", "s"}, "<c-k>")
|
||||
end,
|
||||
load = function()
|
||||
local luasnip = require("luasnip")
|
||||
local types = require("luasnip.util.types")
|
||||
branch = "v2.*",
|
||||
config = function()
|
||||
vim.cmd("make install_jsregexp")
|
||||
end,
|
||||
lazy = function(load)
|
||||
load:keymap({"i", "s"}, "<c-a>")
|
||||
load:keymap({"i", "s"}, "<c-e>")
|
||||
load:keymap({"i", "s"}, "<c-j>")
|
||||
load:keymap({"i", "s"}, "<c-k>")
|
||||
end,
|
||||
load = function()
|
||||
local ls = require("luasnip")
|
||||
vim.snippet.expand = ls.lsp_expand
|
||||
|
||||
luasnip.config.set_config {
|
||||
history = true, -- return back into snippet
|
||||
enable_autosnippets = true,
|
||||
ls.config.setup {
|
||||
keep_roots = true,
|
||||
link_roots = true,
|
||||
link_children = true,
|
||||
exit_roots = not true
|
||||
}
|
||||
|
||||
-- update on text insert and cursor hold
|
||||
updateevents = { "TextChanged", "TextChangedI", "CursorHold" },
|
||||
ext_opts = {
|
||||
[types.choiceNode] = {
|
||||
active = {
|
||||
virt_text = {{ "?", "@boolean" }}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
map({"i", "s"}, "<C-e>", ls.expand)
|
||||
map({"i", "s"}, "<C-j>", function() ls.jump(1) end)
|
||||
map({"i", "s"}, "<C-k>", function() ls.jump(-1) end)
|
||||
map({"i", "s"}, "<C-a>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end)
|
||||
|
||||
map({"i", "s"}, "<c-a>", function()
|
||||
if luasnip.choice_active() then
|
||||
luasnip.change_choice(1)
|
||||
end
|
||||
end)
|
||||
-- collect all snippets and add them
|
||||
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua",
|
||||
true)) do
|
||||
local fn = file:gsub("^.*/", ""):gsub("%.lua$", "")
|
||||
|
||||
map({"i", "s"}, "<c-e>", function()
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
end
|
||||
end)
|
||||
|
||||
map({"i", "s"}, "<C-j>", function()
|
||||
if luasnip.jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
end
|
||||
end)
|
||||
|
||||
map({"i", "s"}, "<C-k>", function()
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end)
|
||||
|
||||
-- collect all snippets and add them when in the correct file type
|
||||
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua",
|
||||
true)) do
|
||||
local fn = file:gsub("^.*/", ""):gsub("%.lua$", "")
|
||||
|
||||
auto("FileType", {
|
||||
pattern = fn,
|
||||
once = true,
|
||||
callback = function()
|
||||
local ret = require("snippets."..fn)
|
||||
if type(ret) ~= "boolean" then
|
||||
luasnip.add_snippets(fn, ret, { key = fn })
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
local ret = require("snippets."..fn)
|
||||
if type(ret) ~= "boolean" then
|
||||
ls.add_snippets(fn, ret, { key = fn })
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
|
Reference in New Issue
Block a user