Giter Site home page Giter Site logo

youtube-treesitter's Introduction

Tree Sitter

Table of content

What is Tree Sitter

Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited

  • General enough to parse any programming language
  • Fast enough to parse on every keystroke in a text editor
  • Robust enough to provide useful results even in the presence of syntax errors
  • Dependency-free so that the runtime library (which is written in pure C) can be embedded in any application

A bit more about Tree Sitter

You can play with tree sitter https://tree-sitter.github.io/tree-sitter/playground

  • Syntax tree
  • Back tracking (branches)
  • Incremental parsing
  • Error recovery

Nvim Tree Sitter

Simple and easy way to use the interface for tree-sitter in Neovim and to provide some basic functionality such as,

Features of Nvim Tree Sitter

  • Shipped with parsers with for popular programming languages
  • Provides commands to manage tree sitter parsers (install/update/remove/enable/disable etc..)
  • Syntax highlighting
  • Incremental selection
  • Indentation
  • Folding

Requirements

  • Neovim 0.5 or higher

Installing

  • Install nvim-treesitter
" vim-plug
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
  • Install Language parser
:TSInstall {language}
" :TSInstall java
" :TSInstall python

Configuration

By default, all the modules in nvim-treesitter is disabled. User needs to enable modules explicitly.

Note: Available capture groups and highlight group identifiers will be found in highlight.lua file in the source code.

require('nvim-treesitter.configs').setup({
    ensure_installed = "all",

    highlight = {
        enable = true,
        custom_captures = {
            -- ["<capture group>"] = "<highlight group>",
            -- ["keyword"] = "TSString",
        },
    },

    incremental_selection = {
        enable = true,
        keymaps = {
            init_selection = "gnn",
            node_incremental = "grn",
            scope_incremental = "grc",
            node_decremental = "grm",
        },
    },

    indent = {
        enable = true
    },
})

vim.api.nvim_exec([[
    set foldmethod=expr
    set foldexpr=nvim_treesitter#foldexpr()
]], true)

Tree Sitter Supported Colorscheme

You might need nvim-treesitter supported colorscheme. List of colorscheme available below.

youtube-treesitter's People

Contributors

s1n7ax avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.