From 62ce7744db02f17b77147683b4eaa884d7f2f1f5 Mon Sep 17 00:00:00 2001 From: kiyan42 Date: Tue, 21 Apr 2020 23:40:23 +0200 Subject: feat/refacto: add configs.lua, setup install - configs.lua holds the `repositories` data - install health moved to health.lua - plugins loads _root.setup() on startup - install and list command are available through vim > use them with `:TSInstall lang` and `:TSInstallInfo` --- lua/nvim-treesitter.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lua/nvim-treesitter.lua') diff --git a/lua/nvim-treesitter.lua b/lua/nvim-treesitter.lua index 8628e499b..8f2fa05ed 100644 --- a/lua/nvim-treesitter.lua +++ b/lua/nvim-treesitter.lua @@ -1,10 +1,15 @@ local api = vim.api local parsers = require'nvim-treesitter.parsers' +local configs = require 'nvim-treesitter.configs' local install = require'nvim-treesitter.install' local locals = require'nvim-treesitter.locals' local M = {} +function M.available_parsers() + return vim.tbl_keys(configs.repositories) +end + -- This function sets up everythin needed for a given language -- this is the main interface through the plugin function M.setup(lang) @@ -12,9 +17,11 @@ function M.setup(lang) end end --- To install, run `:lua require'nvim-treesitter'.install_parser('language')` --- we should add a vim layer over the lua function -M.install_parser = install.install_parser -M.list_parsers = install.list_parsers +-- This function initialize the plugin +-- it is run at startup +M._root = {} +function M._root.setup() + install.setup() +end return M -- cgit v1.2.3-70-g09d2