tree-sitter-elixir icon indicating copy to clipboard operation
tree-sitter-elixir copied to clipboard

Add sample config

Open wilkinson4 opened this issue 4 years ago • 4 comments

It would be nice to see a sample setup in the README showing a typical setup in neovim/lua with nvim-treesitter. I feel like I have it working, but I also have a plugin called elixir-editors/vim-elixir that does syntax highlighting for elixir files. If I turn that off I feel like I am not getting much from tree-sitter which makes me feel like I am missing something.

wilkinson4 avatar Jun 03 '21 23:06 wilkinson4

@wilkinson4 how did you do it? I'm trying to use it to no avail

gugahoa avatar Jun 06 '21 03:06 gugahoa

Same here…

alappe avatar Jun 07 '21 09:06 alappe

Anyone with a sample config working ?

cvignal avatar Jun 15 '21 06:06 cvignal

I cloned this repo into my root directory ~. Then I created a treesitter.lua file with the following config.

require'nvim-treesitter.configs'.setup {
  ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
  highlight = {
    enable = true,              -- false will disable the whole extension
    disable = { },              -- list of language that will be disabled
  },
  playground = {
    enable = true,
    disable = {},
    updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
    persist_queries = false -- Whether the query persists across vim sessions
  },
  rainbow = {
    enable = true
  }
}

require("nvim-treesitter.parsers").elixir = {
  install_info = {
    url = "$HOME/tree-sitter-elixir/",
    files = "grammar.js"
  },
  used_by = {'elixir'}
}

Finally, in vim window I ran TSInstallFromGrammar elixir.

wilkinson4 avatar Jun 15 '21 14:06 wilkinson4