Neovim 101 — Tree-sitter

Learn the magic of Lua and Tree-sitter.

alpha2phi
6 min readSep 3, 2022
Neovim 101 — Tree-sitter

The introduction of Lua and Tree-sitter provides us with endless possibilities to customize Neovim.

In this article, we will get into the basics of Tree-sitter and use the Neovim Tree-sitter APIs to develop a function navigator.

This article is part of the Neovim 101 series.

The Neovim configuration files are available in this repository.

Getting Started

Introduction

Tree-sitter is a parser generator tool and an incremental parsing library. For Neovim, we use the nvim-treesitter plugin that provides a simple and easy-to-use interface to interact with Tree-sitter.

Tree-sitter Playground

The Tree-sitter website provides a playground that we can use to experiment with different programming languages without installing any plugins.

E.g., for JavaScript,

JavaScript Syntax Tree

E.g, for Python,

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.