Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crispgm/telescope-heading.nvim
An extension for telescope.nvim that allows you to switch between headings
https://github.com/crispgm/telescope-heading.nvim
neovim neovim-plugin nvim-plugin telescope telescope-extension
Last synced: 1 day ago
JSON representation
An extension for telescope.nvim that allows you to switch between headings
- Host: GitHub
- URL: https://github.com/crispgm/telescope-heading.nvim
- Owner: crispgm
- License: mit
- Created: 2021-04-29T07:36:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-11T12:43:56.000Z (5 months ago)
- Last Synced: 2024-11-06T06:12:06.847Z (9 days ago)
- Topics: neovim, neovim-plugin, nvim-plugin, telescope, telescope-extension
- Language: Lua
- Homepage:
- Size: 615 KB
- Stars: 126
- Watchers: 4
- Forks: 14
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telescope-heading.nvim
An extension for [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) that allows you to switch between document's headings.
## Supported File Types
| File Type | Tree-sitter | Notes |
| ---------------- | ----------- | -------------------------------------------------------------- |
| AsciiDoc | ✅ | |
| Beancount | ✅ | |
| LaTeX | ⬜ | |
| Markdown | ✅ | including `vimwiki`, `vim-pandoc-syntax`, and `vim-gfm-syntax` |
| Neorg | ✅ | |
| OrgMode | ⬜ | |
| ReStructuredText | ✅ | |
| Vimdoc (help) | ✅ | |## Setup
Install with your favorite package manager:
```lua
use('nvim-telescope/telescope.nvim')
use('crispgm/telescope-heading.nvim')
```You can setup the extension by adding the following to your config:
```lua
require('telescope').load_extension('heading')
```### Tree-sitter Support
telescope-heading supports Tree-sitter for parsing documents and finding headings. But not all file types are supported, you may check [Supported File Types](#supported-file-types) section and inspect the Tree-sitter column.
```lua
-- add nvim-treesitter
use('nvim-treesitter/nvim-treesitter')-- make sure you have already installed treesitter modules
require('nvim-treesitter.configs').setup({
ensure_installed = {
-- ..
'markdown',
'rst',
-- ..
},
})-- enable treesitter parsing
local telescope = require('telescope')
telescope.setup({
-- ...
extensions = {
heading = {
treesitter = true,
},
},
})-- `load_extension` must be after `telescope.setup`
telescope.load_extension('heading')
```If `nvim-treesitter` was not correctly loaded, it would have fallen back to normal parsing. You may check `nvim-treesitter` configurations and whether your language is `TSInstall`ed.
### Telescope Picker Options
We may specific picker options for telescope-heading, which overrides the general telescope picker options.
```lua
local telescope = require('telescope')
telescope.setup({
-- ...
extensions = {
heading = {
picker_opts = {
layout_config = { width = 0.8, preview_width = 0.5 },
layout_strategy = 'horizontal',
},
},
-- ...
},
})
```## Usage
```viml
:Telescope heading
```## Development
Init:
```bash
make init
```Load telescope-heading locally:
```bash
nvim --noplugin -u scripts/minimal_init.vim ./README.md # replace with /path/to/testfile
# or
make test
```Lint:
```bash
make lint
```## Contributing
All contributions are welcome.
## License
Copyright 2023 David Zhang. MIT License.