From 692a67e84fdf42c75f7eb4b7f52d84fc2e0ed378 Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Tue, 7 Jun 2022 20:41:32 -0400 Subject: [PATCH] Add Treesitter --- init.lua | 1 + lua/plugins.lua | 8 ++++++-- lua/ts_config.lua | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 lua/ts_config.lua diff --git a/init.lua b/init.lua index 4fe16db..221e8a0 100644 --- a/init.lua +++ b/init.lua @@ -4,3 +4,4 @@ require('autocmd') -- Convenient Autocommands require('lsp') require('keybindings') require('nvim-cmp-cfg') +require('ts_config') diff --git a/lua/plugins.lua b/lua/plugins.lua index 1fdebfa..549c1fc 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -11,7 +11,6 @@ local plugins = require('packer').startup(function(use) -- file management use { 'nvim-telescope/telescope.nvim', -- search and select tool - commit = '80cdb00b221f69348afc4fb4b701f51eb8dd3120', -- for neovim 0.5.0 compatibility requires = { {'nvim-lua/plenary.nvim'} } } @@ -22,7 +21,6 @@ local plugins = require('packer').startup(function(use) use 'neovim/nvim-lspconfig' -- Common lsp server configurations use { 'hrsh7th/nvim-cmp', - commit = '2aa7eee28b4d49e999c694ca733a393da5808dd6', } -- Autocompletion plugin use 'hrsh7th/cmp-nvim-lsp' -- LSP source for nvim-cmp @@ -36,8 +34,14 @@ local plugins = require('packer').startup(function(use) commit = 'b10829736542e7cc9291e60bab134df1273165c9', } + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate' + } + -- Language Specfic use 'rust-lang/rust.vim' + use 'https://git.sr.ht/~sircmpwn/hare.vim' if packer_bootstrap then require('packer').sync() diff --git a/lua/ts_config.lua b/lua/ts_config.lua new file mode 100644 index 0000000..d7adf01 --- /dev/null +++ b/lua/ts_config.lua @@ -0,0 +1,11 @@ +local parser_config = require "nvim-treesitter.parsers".get_parser_configs() +parser_config.hare = { + install_info = { + url = "https://git.sr.ht/~ecmma/tree-sitter-hare", -- local path or git repo + files = {"src/parser.c"}, + -- optional entries: + generate_requires_npm = false, -- if stand-alone parser without npm dependencies + requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c + }, + filetype = "ha", -- if filetype does not match the parser name +}