telescope-media: Check if ueberzug is available before loading the extension

This commit is contained in:
Akianonymus 2021-08-22 16:05:50 +05:30 committed by siduck76
parent ef40dfcbc1
commit a82f71334f
1 changed files with 13 additions and 12 deletions

View File

@ -65,23 +65,24 @@ telescope.setup {
},
}
if
not pcall(function()
-- NvChad pickers
-- load the theme_switcher extension
telescope.load_extension "themes"
-- load the term_picker extension
telescope.load_extension "terms"
local extensions = { "themes", "terms", "fzf" }
local packer_repos = [["core", "telescope-fzf-native.nvim"]]
telescope.load_extension "fzf"
telescope.load_extension "media_files"
end)
then
if vim.fn.executable "ueberzug" == 1 then
table.insert(extensions, "media_files")
packer_repos = packer_repos .. ', "telescope-media-files.nvim"'
end
if not pcall(function()
for _, ext in ipairs(extensions) do
telescope.load_extension(ext)
end
end) then
-- This should only trigger when in need of PackerSync, so better do it
print "After completion of PackerCompile, restart neovim."
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
vim.cmd 'autocmd User PackerComplete ++once lua print "Waiting for PackerCompile.." require("packer").compile()'
vim.cmd 'autocmd User PackerCompileDone ++once echo "Packer Compile done, restart neovim."'
require "plugins"
require("packer").update("core", "telescope-fzf-native.nvim", "telescope-media-files.nvim")
loadstring('require("packer").update(' .. packer_repos .. ")")()
end