LunarVim/lua/core/treesitter.lua
devtoi d85584d09f
[Refactor/Bugfix] move on_config_done callbacks to relevant setup() (#1175)
* Make autopairs config consistent with others

* Fix two typos for autopairs

* Remove extranous autopairs code. Return on setup

* Remove extranous else for autopairs completion confirmation

* Move on_config_done callbacks to setup functions.

* Add on_config_done completion for builtins lacking a config function

* enables galaxyline callbacks to work properly

* Add modules for more builtins

* Finish streamline of config function in plugin setup

* Fix double use of which_key/wk

* Fix erroneous remove of functionality in autopairs completion

* consistency fixes

* Work around telescope not found at config time

* Match plugin definition of project and lualine with others

* fix: restore config callback syntax

Co-authored-by: Johan Melin <johan.melin@paradoxinteractive.com>
Co-authored-by: rebuilt <memoryman51@hotmail.com>
Co-authored-by: Luc Sinet <luc.sinet@gmail.com>
Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
2021-08-22 20:03:19 +02:00

81 lines
2.5 KiB
Lua

local M = {}
local Log = require "core.log"
M.config = function()
lvim.builtin.treesitter = {
on_config_done = nil,
ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ignore_install = {},
matchup = {
enable = false, -- mandatory, false will disable the whole extension
-- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
},
highlight = {
enable = true, -- false will disable the whole extension
additional_vim_regex_highlighting = true,
disable = { "latex" },
},
context_commentstring = {
enable = false,
config = { css = "// %s" },
},
-- indent = {enable = true, disable = {"python", "html", "javascript"}},
-- TODO seems to be broken
indent = { enable = true, disable = { "yaml" } },
autotag = { enable = false },
textobjects = {
swap = {
enable = false,
-- swap_next = textobj_swap_keymaps,
},
-- move = textobj_move_keymaps,
select = {
enable = false,
-- keymaps = textobj_sel_keymaps,
},
},
textsubjects = {
enable = false,
keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
},
playground = {
enable = false,
disable = {},
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false, -- Whether the query persists across vim sessions
keybindings = {
toggle_query_editor = "o",
toggle_hl_groups = "i",
toggle_injected_languages = "t",
toggle_anonymous_nodes = "a",
toggle_language_display = "I",
focus_language = "f",
unfocus_language = "F",
update = "R",
goto_node = "<cr>",
show_help = "?",
},
},
rainbow = {
enable = false,
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
},
}
end
M.setup = function()
local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then
Log:get_default().error "Failed to load nvim-treesitter.configs"
return
end
treesitter_configs.setup(lvim.builtin.treesitter)
if lvim.builtin.treesitter.on_config_done then
lvim.builtin.treesitter.on_config_done(treesitter_configs)
end
end
return M