nvim: Check trouble before adding telescope maps
Check that the trouble plugin exists before adding its maps to the telescope buffer. Should probably go into trouble setup instead but works as a quick safeguard for now.
This commit is contained in:
parent
ec791fda5f
commit
56951911f6
1 changed files with 8 additions and 5 deletions
|
@ -43,6 +43,13 @@ return {
|
|||
-- rg (ripgrep) for in-text searches
|
||||
-- fd for quicker directory structure searches
|
||||
-- lsp for a variety of lsp queries
|
||||
local trouble_mappings = {}
|
||||
if require("core.util").is_available("trouble") then
|
||||
trouble_mappings = {
|
||||
i = { ["<c-t>"] = require("trouble.sources.telescope").open },
|
||||
n = { ["<c-t>"] = require("trouble.sources.telescope").open },
|
||||
}
|
||||
end
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
|
@ -61,11 +68,7 @@ return {
|
|||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
color_devicons = true,
|
||||
mappings = {
|
||||
-- FIXME: Find way to only invoke this *IF* trouble plugin is found
|
||||
i = { ["<c-t>"] = require("trouble.sources.telescope").open },
|
||||
n = { ["<c-t>"] = require("trouble.sources.telescope").open },
|
||||
},
|
||||
mappings = trouble_mappings or {},
|
||||
},
|
||||
pickers = {
|
||||
buffers = { theme = "ivy" },
|
||||
|
|
Loading…
Reference in a new issue