Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install in Neovim? #6

Open
tms-tham opened this issue Aug 22, 2024 · 1 comment
Open

How to install in Neovim? #6

tms-tham opened this issue Aug 22, 2024 · 1 comment

Comments

@tms-tham
Copy link

tms-tham commented Aug 22, 2024

Nvim

I followed the instructions in this link, but it doesn't work. This is my configuration

  local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()

  treesitter_parser_config.slim = {
    install_info = {
      url = "https://github.com/kolen/tree-sitter-slim.git",
      files = {"src/parser.c", "src/scanner.c"},
      branch = "master",
    }
  }

  vim.treesitter.language.register("slim", "slim")

  vim.filetype.add({
    extension = {
      slim = 'slim'
    }
  })

Screenshots

image

@kolen
Copy link
Owner

kolen commented Oct 11, 2024

I never used neovim, today I tried to load this grammar in neovim. My ~/.config/nvim/init.lua config:

local vim = vim
local Plug = vim.fn['plug#']

vim.call('plug#begin')
Plug('nvim-treesitter/nvim-treesitter', { ['do'] = ':TSUpdate'} )
vim.call('plug#end')

local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.slim = {
   install_info = {
      url = "https://github.com/kolen/tree-sitter-slim",
      files = {"src/parser.c", "src/scanner.c"},
      requires_generate_from_grammar = false,
   },
   filetype = "slim",
}

After that, running :TSInstall slim completes successfully. However, for this grammar to be usable for editing slim files, at least queries for highlighting should be created, something like this. I don't have experience with Neovim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants