Skip to content

Treesitter Integration

github-actions[bot] edited this page Jun 25, 2022 · 176 revisions

TreeSitter integration in Neorg

A module designed to integrate TreeSitter into Neorg.



How to Apply

  • This module is already present in the core.defaults metamodule. You can load the module with:
    ["core.defaults"] = {},
    In your Neorg setup.
  • To manually load the module, place this code in your Neorg setup:
    ["core.integrations.treesitter"] = {
       config = { -- Note that this table is optional and doesn't need to be provided
           -- Configuration here
    Consult the configuration section to see how you can configure core.integrations.treesitter to your liking.


configure_parsers : If true will auto-configure the parsers to use the recommended setup. Sometimes nvim-treesitter's repositories lag behind and this is the only good fix.

Default value: true

install_parsers : If true will automatically install parsers if they are not present.

Default value: true

parser_configs : Configurations for each parser as expected by nvim-treesitter. If you want to tweak your parser configs you can do so here.

Default Value:

Developer Usage

Public API

This segment will detail all of the functions core.integrations.treesitter exposes. All of these functions reside in the public table.

  • get_node_text
  • get_ts_utils
  • get_document_metadata
  • get_all_nodes
  • get_tag_info
  • get_first_node
  • goto_next_heading
  • get_first_node_recursive
  • get_node_range
  • goto_previous_heading
  • get_first_node_on_line
  • find_parent
  • tree_map
  • tree_map_rec
  • get_document_root


None Provided

Extra Info


This module supports at least version 0.0.11. The current Neorg version is 0.0.11.


This module does not import any other files.


  • core.highlights - Manages your highlight groups with this module.
  • core.mode - Modes are a way of isolating different parts of Neorg based on the current mode.
  • core.keybinds - Module for managing keybindings with Neorg mode support.
  • core.neorgcmd - This module deals with handling everything related to the :Neorg command.

Required by