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
|
-- rg (ripgrep) for in-text searches
|
||||||
-- fd for quicker directory structure searches
|
-- fd for quicker directory structure searches
|
||||||
-- lsp for a variety of lsp queries
|
-- 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({
|
require("telescope").setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
vimgrep_arguments = {
|
vimgrep_arguments = {
|
||||||
|
@ -61,11 +68,7 @@ return {
|
||||||
prompt_prefix = " ",
|
prompt_prefix = " ",
|
||||||
selection_caret = " ",
|
selection_caret = " ",
|
||||||
color_devicons = true,
|
color_devicons = true,
|
||||||
mappings = {
|
mappings = trouble_mappings or {},
|
||||||
-- 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 },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
pickers = {
|
pickers = {
|
||||||
buffers = { theme = "ivy" },
|
buffers = { theme = "ivy" },
|
||||||
|
|
Loading…
Reference in a new issue