https://github.com/yousefakbar/toc.nvim
Telescope-integrated Markdown TOC Explorer
https://github.com/yousefakbar/toc.nvim
markdown neovim neovim-plugin nvim plugin table-of-contents toc
Last synced: about 1 year ago
JSON representation
Telescope-integrated Markdown TOC Explorer
- Host: GitHub
- URL: https://github.com/yousefakbar/toc.nvim
- Owner: yousefakbar
- Created: 2024-12-24T18:52:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-03T01:10:50.000Z (over 1 year ago)
- Last Synced: 2025-02-17T14:45:14.250Z (over 1 year ago)
- Topics: markdown, neovim, neovim-plugin, nvim, plugin, table-of-contents, toc
- Language: Lua
- Homepage:
- Size: 5.86 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Overview
`toc.nvim` is a Neovim plugin that allows users to navigate Markdown headings in the current buffer using a Telescope picker. With this plugin, you can quickly jump to any heading in your document, enhancing productivity and ease of navigation.
# Features
- Parse and list all Markdown headings in the current buffer.
- Seamless integration with Telescope for fuzzy searching.
- Instant navigation to the selected heading.
- User-friendly interface with customizable key mappings.
# Dependencies
- [Neovim (with lua support)](https://neovim.io/) >= 0.5
- [Telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
# Installation
To install the plugin using [lazy.nvim](https://github.com/folke/lazy.nvim), add the following configuration to your Neovim setup:
```lua
{
"yousefakbar/toc.nvim",
ft = "markdown",
opts = {},
keys = { -- Optional if you want to define a keymap to launch :Toc
{ "mc", "Toc", desc = "Table of contents" },
},
}
```
Otherwise, follow the specific steps for your plugin manager.
# Usage
1. Open a Markdown file in Neovim.
2. Run the command `:Toc` to open the Telescope picker with all the headings from the current buffer.
3. Use the fuzzy search functionality to find a heading.
4. Press `` to navigate directly to the selected heading in the file.
# How It Works
1. **Heading Extraction**: The plugin scans the current buffer for Markdown headings (`#`, `##`, `###`, etc.) and organizes them in a table with their titles, line numbers, and levels.
2. **Telescope Integration**: The extracted headings are passed to Telescope, enabling users to search and select headings easily.
3. **Navigation**: Upon selecting a heading, the plugin jumps to the corresponding line in the document.
# Configuration
Currently, the plugin requires no additional configuration. However, you can extend its functionality or integrate it with your existing Neovim setup using the provided `setup` function.
# Contributing
Feel free to contribute to this project! Submit issues or pull requests on the [GitHub repository](https://github.com/yousefakbar/toc.nvim)