You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to have a setup where single quotes don't get auto-paired when writing a comment.
I took the example in the README, but even this doesn't seem to work for comments.
Mapping bug
No response
Steps to reproduce
See that the comment node is properly detected by treesitter:
When entering "%" at the end of the comment, it doesn't get a matching one (but it should)
When entering "%" inside the string, it gets a matching one like expected.
For some reason the "comment" node doesn't seem to be working
Minimal config
-- config using lazy-- [[ Install `lazy.nvim` plugin manager ]]-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more infolocallazypath=vim.fn.stdpath("data") .."/lazy/lazy.nvim"ifnotvim.loop.fs_stat(lazypath) thenlocallazyrepo="https://github.com/folke/lazy.nvim.git"vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
end---@diagnosticdisable-next-line:undefined-fieldvim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"nvim-treesitter/nvim-treesitter",
build=":TSUpdate",
config=function()
---@diagnosticdisable-next-line:missing-fieldsrequire("nvim-treesitter.configs").setup({
ensure_installed= {"lua"},
auto_install=true,
highlight= { enable=true },
indent= { enable=true },
})
end,
},
{
"windwp/nvim-autopairs",
event="InsertEnter",
config=function()
localnpairs=require("nvim-autopairs")
localRule=require("nvim-autopairs.rule")
npairs.setup({
check_ts=true,
})
localts_conds=require("nvim-autopairs.ts-conds")
require("nvim-autopairs").get_rules("'")[1]:with_pair(ts_conds.is_not_ts_node({ "comment" }))
-- press % => %% only while inside a comment or stringnpairs.add_rules({
Rule("%", "%", "lua"):with_pair(ts_conds.is_ts_node({ "string", "comment" })),
Rule("$", "$", "lua"):with_pair(ts_conds.is_not_ts_node({ "function" })),
})
end,
},
})
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Description
I'm trying to have a setup where single quotes don't get auto-paired when writing a comment.
I took the example in the README, but even this doesn't seem to work for comments.
Mapping bug
No response
Steps to reproduce
See that the
comment
node is properly detected by treesitter:When entering "%" at the end of the comment, it doesn't get a matching one (but it should)
When entering "%" inside the string, it gets a matching one like expected.
For some reason the "comment" node doesn't seem to be working
Minimal config
The text was updated successfully, but these errors were encountered: