aMOPel / tree-sitter-nim

tree-sitter parser for the nim programming language
MIT License
36 stars 10 forks source link

How to test-drive this tree-sitter parser? #20

Closed hellerbarde closed 1 year ago

hellerbarde commented 1 year ago

I would like to try this, but my nvim treesitter config-fu is not strong enough. Tree-sitter is working and everything, I just don't quite understand how to get this repo situated in the right place and in the right config file.

Thanks so much :)

aMOPel commented 1 year ago

https://github.com/nvim-treesitter/nvim-treesitter/pull/4439#issuecomment-1454662011

More explicitly:

  1. Clone this repo
  2. Put this before your nvim-treesitter setup call:
    local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
    parser_configs.nim = {
    install_info = {
    url = "~/projects/treesitter/tree-sitter-nim", -- or where ever you cloned the repo to
    files = { "src/parser.c", "src/scanner.cc"}
    },
    }
  3. Link/copy the queries (most importantly highlights.scm) from tree-sitter-nim/queries/nvim to <nvim plugin dir>/nvim-treesitter/queries/nim
  4. In Neovim: :TSInstall nim

That should do it