A Telescope picker to quickly access configurations of plugins managed by lazy.nvim.
Example: Searching for telescope
plugins configurations:
⚡ Simply search the plugin name and open its configuration at the corresponding file and line.
⚡ Quickly access all the specs where a plugin is defined.
⚡ No more head overload trying to remember in which file you changed that plugin option.
⚡ Easily find duplicates or conflicting overlapping settings.
⚡ Add custom entries to any file for your special needs.
⚡ Quickly execute builtin actions on the selected entry:
<CR>
).<C-g>x
).<C-g>r
).<C-g>d
).live_grep
picker at the plugin's local directory path (<C-g>l
).find_files
picker at the plugin's local directory path (<C-g>f
).return {
"nvim-telescope/telescope.nvim",
dependencies = {
{ "polirritmico/telescope-lazy-plugins.nvim" },
},
-- etc.
}
Check the Configuration examples and the Configuration section for more details.
[!IMPORTANT] 📌 If your lazy configuration file is not located in the default path (
nvim/lua/config/lazy.lua
), thelazy_config
option must be set to a valid path.
require("telescope").load_extension("lazy_plugins")
[!TIP] It's recommended to run
:checkhealth telescope
after the installation (make sure the extension is loaded first).
:Telescope lazy_plugins
require("telescope").extensions.lazy_plugins.lazy_plugins()
Add the options in the telescope.nvim
opts extensions
table inside
lazy_plugins
(configuration examples).
Option | Type | Description |
---|---|---|
lazy_config |
string |
Path to the lua file containing the lazy options passed to the setup() call. This is the first-level imported file and the one you would be directed by searching lazy.nvim . Should be set if the lazy.nvim config file path differs from the defaults. |
name_only |
boolean |
Match only the repository name. Set to false to match the full account/repo_name . |
show_disabled |
boolean |
Also show disabled plugins from the Lazy spec. |
ignore_imports |
table |
Array-like string table with modules to ignore. Useful for config distributions like LazyVim to avoid importing the inner configurations, e.g., { "lazyvim.plugins" } . |
picker_opts |
table |
Telescope layout options passed to the picker. Check :h telescope.layout . |
mappings |
table |
Keymaps attached to the picker. See :h telescope.mappings . Also, 'Custom Actions' could be added. |
live_grep |
table |
Custom options to be used by the live_grep picker action (<C-g>l ). See :h telescope.builtin.live_grep . |
custom_entries |
table |
A collection of custom entries to add into the picker. See the 'Custom Entries' section. |
In next table, the lp_actions
column refers to the name of the action function
provided by the module telescope-lazy-plugins.actions
, accessible via:
require("telescope").extensions.lazy_plugins.actions
Insert mode | Normal mode | lp_actions | Description |
---|---|---|---|
<CR> |
<CR> |
open |
Open the selected plugin config file at the first line of the plugin spec. |
<C-g>d |
gd |
open_repo_dir |
Open the local clone folder of the plugin repository. |
<C-g>f |
gf |
open_repo_find_files |
Open a Telescope find_files picker at the repository local clone directory path. |
<C-g>l |
gl |
open_repo_live_grep |
Open a Telescope live_grep picker at the repository local clone directory path. |
<C-g>r |
gr |
open_readme |
Open the selected plugin README file. |
<C-g>x |
gx |
open_repo_url |
Open the plugin repository url in the default web browser. |
custom_action |
A wrapper helper to use custom actions. See the 'Custom Actions' section. |
{
lazy_config = vim.fn.stdpath("config") .. "/lua/config/lazy.lua", -- This must be a valid path to the file containing the lazy opts and setup() call.
name_only = true, -- match only the `repo_name`, false to match the full `account/repo_name`.
show_disabled = true, -- also show disabled plugins from the Lazy spec.
custom_entries = {}, ---@type table<LazyPluginsCustomEntry> Table to pass custom entries to the picker.
live_grep = {}, -- Opts to pass into `live_grep`. Check `:h telescope.builtin.live_grep`.
ignore_imports = {}, -- Add imports you want to ignore, e.g., "lazyvim.plugins".
mappings = {
["i"] = {
["<C-g>d"] = lp_actions.open_repo_dir,
["<C-g>f"] = lp_actions.open_repo_find_files,
["<C-g>l"] = lp_actions.open_repo_live_grep,
["<C-g>r"] = lp_actions.open_readme,
["<C-g>x"] = lp_actions.open_repo_url,
},
["n"] = {
["gd"] = lp_actions.open_repo_dir,
["gf"] = lp_actions.open_repo_find_files,
["gl"] = lp_actions.open_repo_live_grep,
["gr"] = lp_actions.open_readme,
["gx"] = lp_actions.open_repo_url,
},
},
picker_opts = {
sorting_strategy = "ascending",
layout_strategy = "flex",
layout_config = {
flex = { flip_columns = 150 },
horizontal = { preview_width = { 0.55, max = 100, min = 30 } },
vertical = { preview_cutoff = 20, preview_height = 0.5 },
},
},
}
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{
"polirritmico/telescope-lazy-plugins.nvim",
keys = {
{ "<leader>cp", "<Cmd>Telescope lazy_plugins<CR>", desc = "Telescope: Plugins configurations" },
},
},
},
opts = {
extensions = {
lazy_plugins = {
lazy_config = vim.fn.stdpath("config") .. "/lua/lazy/init.lua", -- Must be a valid path to the file containing the lazy spec and setup() call.
},
},
-- etc.
},
}
Lazy-loading Telescope extensions could be a little tricky. This approach
creates a user auto command that checks when the telescope.nvim
plugin is
loaded and then executes the load_extension
function (Could be used with any
Telescope extension).
If your plugins are inside a large table passed directly to the
require('lazy').setup({...}, opts)
call, make sure to set the lazy_config
option to specify the file where the spec table is defined. For example, for
configurations in a single init.lua
file:
The plugin also offer the possibility to add and define your custom actions to
the picker through custom_action
and helper functions.
Custom entries could be added into the custom_entries
field in the options.
Should follow this specs:
---@class LazyPluginsCustomEntry
---@field name string Entry name
---@field filepath string Full path to the lua target file
---@field line? integer Optional: Line number to set the view on the target file. Defaults to 1.
---@field repo_url? string Optional: URL to open with the `open_repo_url` action
---@field repo_dir? string Optional: Directory path to open with the `open_repo_dir` action
--- Custom entry example:
lazy_plugins = {
custom_entries = {
{
name = "custom-entry",
filepath = vim.fn.stdpath("config") .. "/lua/extra-options/somefile.lua",
-- Optional:
line = 42,
repo_url = "https://www.lua.org/manual/5.2/",
repo_dir = vim.fn.stdpath("config") .. "/lua/extra-options/",
},
-- etc.
},
},
This are the highlights defined by Telescope Lazy Plugins:
Highlight group | Defaults to | Description |
---|---|---|
TelescopeLazyPlugins | Normal | Plugin name |
TelescopeLazyPluginsFile | Comment | Module file with the config spec |
TelescopeLazyPluginsEnabled | Function | Enabled plugin icon |
TelescopeLazyPluginsDisabled | Delimiter | Disabled plugin icon |
This plugin is made mainly for my personal use, but suggestions, issues, or pull requests are very welcome.
Enjoy