fix(pack): install missing plugins asynchronously without startup updates
This commit is contained in:
@@ -1,16 +1,39 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local ok_configs, ts_configs = pcall(require, "nvim-treesitter.configs")
|
||||
if not ok_configs then
|
||||
local ok_ts, ts = pcall(require, "nvim-treesitter")
|
||||
if not ok_ts then
|
||||
vim.schedule(function()
|
||||
vim.notify("nvim-treesitter is not available yet. Run :lua vim.pack.update() and restart.",
|
||||
vim.notify("nvim-treesitter is not ready yet. Wait for background plugin install and restart Neovim.",
|
||||
vim.log.levels.WARN)
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
ts_configs.setup({
|
||||
local move_config = {
|
||||
goto_next_start = {
|
||||
["]f"] = "@function.outer",
|
||||
["]c"] = "@class.outer",
|
||||
["]a"] = "@parameter.inner",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]F"] = "@function.outer",
|
||||
["]C"] = "@class.outer",
|
||||
["]A"] = "@parameter.inner",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[f"] = "@function.outer",
|
||||
["[c"] = "@class.outer",
|
||||
["[a"] = "@parameter.inner",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[F"] = "@function.outer",
|
||||
["[C"] = "@class.outer",
|
||||
["[A"] = "@parameter.inner",
|
||||
},
|
||||
}
|
||||
|
||||
ts.setup({
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
@@ -51,26 +74,10 @@ function M.setup()
|
||||
textobjects = {
|
||||
move = {
|
||||
enable = true,
|
||||
goto_next_start = {
|
||||
["]f"] = "@function.outer",
|
||||
["]c"] = "@class.outer",
|
||||
["]a"] = "@parameter.inner",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]F"] = "@function.outer",
|
||||
["]C"] = "@class.outer",
|
||||
["]A"] = "@parameter.inner",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[f"] = "@function.outer",
|
||||
["[c"] = "@class.outer",
|
||||
["[a"] = "@parameter.inner",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[F"] = "@function.outer",
|
||||
["[C"] = "@class.outer",
|
||||
["[A"] = "@parameter.inner",
|
||||
},
|
||||
goto_next_start = move_config.goto_next_start,
|
||||
goto_next_end = move_config.goto_next_end,
|
||||
goto_previous_start = move_config.goto_previous_start,
|
||||
goto_previous_end = move_config.goto_previous_end,
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -84,7 +91,7 @@ function M.setup()
|
||||
if name:find("goto") == 1 then
|
||||
move[name] = function(query, ...)
|
||||
if vim.wo.diff then
|
||||
local config = ts_configs.get_module("textobjects.move")[name]
|
||||
local config = move_config[name]
|
||||
for key, textobject in pairs(config or {}) do
|
||||
if query == textobject and key:find("[%]%[][cC]") then
|
||||
vim.cmd("normal! " .. key)
|
||||
|
||||
Reference in New Issue
Block a user