Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/catgoose/telescope-helpgrep.nvim
Telescope extension that uses Telescope builtins (live_grep or grep_string) to grep through help files
https://github.com/catgoose/telescope-helpgrep.nvim
neovim neovim-lua neovim-plugin
Last synced: about 1 month ago
JSON representation
Telescope extension that uses Telescope builtins (live_grep or grep_string) to grep through help files
- Host: GitHub
- URL: https://github.com/catgoose/telescope-helpgrep.nvim
- Owner: catgoose
- Created: 2023-11-04T11:53:41.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-05-18T11:37:07.000Z (5 months ago)
- Last Synced: 2024-05-18T12:27:06.897Z (5 months ago)
- Topics: neovim, neovim-lua, neovim-plugin
- Language: Lua
- Homepage:
- Size: 445 KB
- Stars: 31
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Telescope helpgrep
- [Telescope helpgrep](#telescope-helpgrep)
- [Using help](#using-help)
- [Alternative](#alternative)
- [Usage](#usage)
- [Default picker options](#default-picker-options)
- [Setup](#setup)
- [Defaults](#defaults)
- [Example](#example)
- [Extra](#extra)
Telescope extension that uses Telescope builtins (`live_grep` or `grep_string`)
to grep through help filesSometimes help tags are not available for what you are looking for with
`Telescope help_tags` or `:help`. Telescope helpgrep can be used to grep through
help files using Telescope's builtins## Using help
| ![help](https://github.com/catgoose/telescope-helpgrep.nvim/blob/7c52e4840ee0f404d8f79d3a457d6214a073c1e9/helpgrep3.png "help") |
| :-----------------------------------------------------------------------------------------------------------------------------: |
| Searching for help the help topic: `vim.api.nvim_open_win` using `:help` || ![Telescope helptags](https://github.com/catgoose/telescope-helpgrep.nvim/blob/7c52e4840ee0f404d8f79d3a457d6214a073c1e9/helpgrep1.png "Telescope help_tags") |
| :----------------------------------------------------------------------------------------------------------------------------------------------------------: |
| Searching for help the help topic: `vim.api.nvim_open_win` using `:Telescope help_tags` || ![Telescope helpgrep](https://github.com/catgoose/telescope-helpgrep.nvim/blob/7c52e4840ee0f404d8f79d3a457d6214a073c1e9/helpgrep2.png "Telescope helpgrep") |
| :---------------------------------------------------------------------------------------------------------------------------------------------------------: |
| Grepping through help files for `vim.api.nvim_open_win` with `:Telescope helpgrep` |## Alternative
Of course you can use the built in `helpgrep`, but I wanted something more
"Telescopic" rather than having to filter through quickfix.## Usage
Defaults to `live_grep` picker:
```lua
:Telescope helpgrep
```Uses `Telescope live_grep` builtin:
```lua
:Telescope helpgrep live_grep
```Uses `Telescope grep_string` builtin:
```lua
:Telescope helpgrep grep_string
```### Default picker options
These are the default options passed into the Telescope picker
```lua
{
prompt_title = "Help Grep",
glob_pattern = "*.txt",
disable_coordinates = true,
path_display = { "tail" },
}
```These options can be overridden by passing opts table into `live_grep` or `grep_string`
`:help telescope.builtin.live_grep` and `:help telescope.builtin.grep_string````lua
require("telescope-helpgrep").live_grep({
prompt_title = "Helpy McGrepperson",
...,
})
``````lua
require("telescope-helpgrep").grep_string({
prompt_title = "grep_string",
...,
})
```## Setup
`ignore_paths` defines which paths will be ignored by helpgrep
`mappings` defines mappings overrides### Defaults
```lua
local actions = require("telescope.actions")
local builtin = require("telescope.builtin")({
ignore_paths = {},
mappings = {
i = {
[""] = actions.select_tab,
},
n = {
[""] = actions.select_tab,
},
},
default_grep = builtin.live_grep,
})
```### Example
In Telescope setup:
```lua
local actions = require("telescope.actions")
local builtin = require("telescope.builtin")telescope.setup({
...
extensions = {
helpgrep = {
ignore_paths = {
vim.fn.stdpath("state") .. "/lazy/readme",
},
mappings = {
i = {
[""] = actions.select_default,
[""] = actions.select_vertical,
},
n = {
[""] = actions.select_default,
[""] = actions.select_horizontal,
}
},
default_grep = builtin.live_grep,
}
}
})
``````lua
require("telescope").load_extension("helpgrep")
```No paths are ignored by default, but if you use `lazy.nvim` it is recommended
to add `vim.fn.stdpath("state") .. "/lazy/readme"` to the `ignore_paths` table## TODO
- [ ] Set win/buffer optsions for help window, configurable by setup opts
## Extra
My other neovim projects
- [neovim config](https://github.com/catgoose/nvim)
- [do-the-needful.nvim](https://github.com/catgoose/do-the-needful.nvim)
- [vue-goto-definition](https://github.com/catgoose/vue-goto-definition.nvim)