Skip to content
Discussion options

You must be logged in to vote
Admin verified this answer by drowning-cat Jan 26, 2026

Treesitter approach

Caution

Make sure the markdown parser is installed (:TSInstall markdown) and treesitter is working correctly.

Tip

  • Use :InspectTree to view the parsed syntax tree for the file.
  • Use :EditQuery to test the captures shown below.

1. Define captures for mini.ai

; after/queries/markdown/textobjects.scm

; extends

((fenced_code_block) @code_block.outer)
((code_fence_content) @code_block.inner)

2. Extend mini.ai for the markdown filetype

-- after/ftplugin/markdown.lua

if MiniAi then
  vim.b.miniai_config = {
    custom_textobjects = {
      c = MiniAi.gen_spec.treesitter({ a = "@code_block.outer", i = "@code_block.inner" }),
    },
  }
end

Note there is no "inline" fence…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@echasnovski
Comment options

@asadzman
Comment options

Answer verified by Admin Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested mini.ai
3 participants