mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-23 01:08:59 +02:00
fix(treesitter-textobjects): only disable the textobject plugins/* files when its not enabled in the treesitter opts
This commit is contained in:
parent
eccd122e6d
commit
94ebe25ccb
2 changed files with 23 additions and 9 deletions
|
@ -151,15 +151,7 @@ return {
|
||||||
-- { "i", mode = { "x", "o" } },
|
-- { "i", mode = { "x", "o" } },
|
||||||
-- },
|
-- },
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
dependencies = {
|
dependencies = { "nvim-treesitter-textobjects" },
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
||||||
init = function()
|
|
||||||
-- no need to load the plugin, since we only need its queries
|
|
||||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
opts = function()
|
opts = function()
|
||||||
local ai = require("mini.ai")
|
local ai = require("mini.ai")
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -4,6 +4,28 @@ return {
|
||||||
version = false, -- last release is way too old and doesn't work on Windows
|
version = false, -- last release is way too old and doesn't work on Windows
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
event = { "BufReadPost", "BufNewFile" },
|
event = { "BufReadPost", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
|
init = function()
|
||||||
|
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||||
|
local plugin = require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
||||||
|
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||||
|
local enabled = false
|
||||||
|
if opts.textobjects then
|
||||||
|
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
|
||||||
|
if opts.textobjects[mod].enable then
|
||||||
|
enabled = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not enabled then
|
||||||
|
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ "<c-space>", desc = "Increment selection" },
|
{ "<c-space>", desc = "Increment selection" },
|
||||||
{ "<bs>", desc = "Schrink selection", mode = "x" },
|
{ "<bs>", desc = "Schrink selection", mode = "x" },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue