Skip to content

Looking for nvim plugin to navigate between headings in a md or qmd file. #75

Answered by jmbuhr
hopezh asked this question in Q&A
Discussion options

You must be logged in to vote

You can define a textobject based on treesiter like so: https://github.com/jmbuhr/quarto-nvim-kickstarter/blob/f0c3aef0c31252f0fe8c29167e8920a13291eb33/lua/plugins/quarto.lua#L126
These allow you to do things like jump to next or even select inside etc. like with regular text objects in vim (like word, paragraph etc.).
For example, I use ]] to jump to the next code block or heading.

Furthermore, with a language server for markdown configured such as marskman: https://github.com/jmbuhr/quarto-nvim-kickstarter/blob/f0c3aef0c31252f0fe8c29167e8920a13291eb33/lua/plugins/quarto.lua#L226-L235
headings will become document symbols provided by the lsp. You can view a list with e.g. :Telescope lsp_…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hopezh
Comment options

Answer selected by hopezh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants