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.
- 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.
To install the plugin using lazy.nvim, add the following configuration to your Neovim setup:
{
"yousefakbar/toc.nvim",
ft = "markdown",
opts = {},
keys = { -- Optional if you want to define a keymap to launch :Toc
{ "<leader>mc", "<CMD>Toc<CR>", desc = "Table of contents" },
},
}
Otherwise, follow the specific steps for your plugin manager.
- Open a Markdown file in Neovim.
- Run the command
:Toc
to open the Telescope picker with all the headings from the current buffer. - Use the fuzzy search functionality to find a heading.
- Press
<Enter>
to navigate directly to the selected heading in the file.
- 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. - Telescope Integration: The extracted headings are passed to Telescope, enabling users to search and select headings easily.
- Navigation: Upon selecting a heading, the plugin jumps to the corresponding line in the document.
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.
Feel free to contribute to this project! Submit issues or pull requests on the GitHub repository