old options
This commit is contained in:
parent
0d4d0254bb
commit
5bed96736a
@ -1,13 +1,35 @@
|
||||
local gh = function(x) return 'https://github.com/' .. x end
|
||||
|
||||
local run = function(cmd, cwd)
|
||||
local result = vim.system(cmd, { cwd = cwd, text = true }):wait()
|
||||
if result.code ~= 0 then
|
||||
local details = result.stderr ~= '' and result.stderr or result.stdout or ''
|
||||
vim.notify(('Pack hook failed: %s\n%s'):format(table.concat(cmd, ' '), details), vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
|
||||
local post_change = {
|
||||
['telescope-fzf-native.nvim'] = function(data)
|
||||
run({ 'make' }, data.path)
|
||||
end,
|
||||
['nvim-treesitter'] = function(data)
|
||||
if not data.active then
|
||||
vim.cmd.packadd('nvim-treesitter')
|
||||
end
|
||||
vim.cmd('TSUpdate')
|
||||
end,
|
||||
}
|
||||
|
||||
local hooks = function(ev)
|
||||
-- Use available |event-data|
|
||||
local name, kind = ev.data.spec.name, ev.data.kind
|
||||
-- Run build script after plugin's code has changed
|
||||
if name == 'nvim-telescope/telescope-fzf-native.nvim' and (kind == 'install' or kind == 'update') then
|
||||
-- Append `:wait()` if you need synchronous execution
|
||||
vim.system({ 'make' }, { cwd = ev.data.path }):wait()
|
||||
local data = ev.data
|
||||
if not data or (data.kind ~= 'install' and data.kind ~= 'update') then
|
||||
return
|
||||
end
|
||||
|
||||
local name = data.spec and data.spec.name
|
||||
local hook = name and post_change[name]
|
||||
if hook then
|
||||
hook(data)
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_autocmd('PackChanged', { callback = hooks })
|
||||
@ -33,6 +55,12 @@ vim.pack.add({
|
||||
{ src = gh("nvim-lua/plenary.nvim")},
|
||||
{ src = gh("sindrets/diffview.nvim")},
|
||||
{ src = gh("nvim-telescope/telescope.nvim")},
|
||||
|
||||
-- git signs
|
||||
{ src = gh("lewis6991/gitsigns.nvim")},
|
||||
|
||||
-- treesitter
|
||||
{ src = gh("nvim-treesitter/nvim-treesitter")},
|
||||
}, {
|
||||
confirm = false,
|
||||
})
|
||||
|
||||
@ -31,7 +31,7 @@ if not fzf_ok then
|
||||
vim.notify("ERROR: (telescope) fzf not loaded")
|
||||
end
|
||||
local ui_select_ok, _ = pcall(require("telescope").load_extension, "ui-select")
|
||||
if not ui_slect_ok then
|
||||
if not ui_select_ok then
|
||||
vim.notify("ERROR: (telescope) ui select not loaded")
|
||||
end
|
||||
|
||||
|
||||
@ -4,6 +4,10 @@
|
||||
"rev": "4516612fe98ff56ae0415a259ff6361a89419b0a",
|
||||
"src": "https://github.com/sindrets/diffview.nvim"
|
||||
},
|
||||
"gitsigns.nvim": {
|
||||
"rev": "8d82c240f190fc33723d48c308ccc1ed8baad69d",
|
||||
"src": "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
"gruvbox.nvim": {
|
||||
"rev": "154eb5ff5b96d0641307113fa385eaf0d36d9796",
|
||||
"src": "https://github.com/ellisonleao/gruvbox.nvim"
|
||||
@ -12,6 +16,10 @@
|
||||
"rev": "e906fce7e44ae562f06345be99a7db02f8315236",
|
||||
"src": "https://github.com/NeogitOrg/neogit"
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"rev": "4916d6592ede8c07973490d9322f187e07dfefac",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
"nvim-web-devicons": {
|
||||
"rev": "c72328a5494b4502947a022fe69c0c47e53b6aa6",
|
||||
"src": "https://github.com/nvim-tree/nvim-web-devicons"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user