Can't disable autopairs for """
foozzi opened this issue · comments
fz0x1 commented
Description
local config = function()
local Rule = require("nvim-autopairs.rule")
local npairs = require("nvim-autopairs")
require("nvim-autopairs").setup({})
npairs.add_rule(Rule('"""', '"""', "python"):with_pair(function()
return false
end))
end
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = config, -- this is equalent to setup({}) function
}
Mapping bug
No response
Steps to reproduce
Try to type """ in a python file.
Minimal config
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
require('packer').startup {
{
'wbthomason/packer.nvim',
{
'windwp/nvim-autopairs',
},
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. '/plugin/packer_compiled.lua',
display = { non_interactive = true },
},
}
end
_G.load_config = function()
require('nvim-autopairs').setup()
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing nvim-autopairs and dependencies.")
vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
Sam commented
npairs.remove_rule('"""')
fz0x1 commented
npairs.remove_rule('"""')
local config = function()
local npairs = require("nvim-autopairs")
npairs.remove_rule('"""')
end
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = config, -- this is equalent to setup({}) function
}
Failed to run `config` for nvim-autopairs
...al/share/nvim/lazy/nvim-autopairs/lua/nvim-autopairs.lua:125: attempt to index field 'config' (a nil value)
# stacktrace:
- ~/.config/nvim/lua/plugins/nvim-autopairs.lua:5 _in_ **config**
Sam commented
You didn't setup nvim-autopairs.
local config = function()
local npairs = require("nvim-autopairs")
npairs.setup()
npairs.remove_rule('"""')
end
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = config, -- this is equalent to setup({}) function
}
Lazy doesn't call setup with config.
fz0x1 commented
You didn't setup nvim-autopairs.
local config = function() local npairs = require("nvim-autopairs") npairs.setup() npairs.remove_rule('"""') end return { "windwp/nvim-autopairs", event = "InsertEnter", config = config, -- this is equalent to setup({}) function }Lazy doesn't call setup with config.
2024-02-01.10.04.08.mov
I think it doesn't work.
I have a problem when using luasnip
when I want to put a docstring in a python file.
Sam commented
It works for me, maybe some other plugin is adding the ".
stale commented
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.