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