I am using Neovim's built-in vim.pack to install and load Comment.nvim.
The default gcc mapping works correctly, including for Zsh files. However, when I configure custom keymaps through toggler, opleader, or vim.keymap.set(), commenting fails with:
[Comment.nvim] nil
For example:
vim.pack.add({
"https://github.com/numToStr/Comment.nvim",
})
local cm = require("Comment")
cm.setup({
toggler = {
line = "<C-\>",
block = "\",
},
opleader = {
line = "<C-\\>",
block = "<leader>\\",
},
})
The default mapping:
gcc
works correctly on the same Zsh file.
I also verified that the Zsh filetype and commentstring are correct:
:set filetype?
filetype=zsh
:set commentstring?
commentstring=# %s
I tried configuring the Zsh commentstring explicitly:
local ft = require("Comment.ft")
ft.set("zsh", "#%s")
but this does not resolve the error.
I also tried creating the mapping manually with vim.keymap.set() and encountered the same:
[Comment.nvim] nil
Therefore, the issue does not appear to be related to the Zsh filetype or its commentstring. The default gcc mapping works, while custom mappings consistently trigger the error.
Environment
Neovim: 0.12.x
Plugin manager: built-in vim.pack
Plugin: numToStr/Comment.nvim
Filetype: zsh
Expected behavior
Custom mappings configured through toggler, opleader, or vim.keymap.set() should work in the same way as the default gcc mapping.
Is there a known compatibility issue with custom mappings when Comment.nvim is loaded using Neovim's vim.pack? What is the recommended configuration or workaround?
I am using Neovim's built-in vim.pack to install and load Comment.nvim.
The default gcc mapping works correctly, including for Zsh files. However, when I configure custom keymaps through toggler, opleader, or vim.keymap.set(), commenting fails with:
[Comment.nvim] nil
For example:
vim.pack.add({
"https://github.com/numToStr/Comment.nvim",
})
local cm = require("Comment")
cm.setup({
toggler = {
line = "<C-\>",
block = "\",
},
})
The default mapping:
gcc
works correctly on the same Zsh file.
I also verified that the Zsh filetype and commentstring are correct:
:set filetype?
filetype=zsh
:set commentstring?
commentstring=# %s
I tried configuring the Zsh commentstring explicitly:
local ft = require("Comment.ft")
ft.set("zsh", "#%s")
but this does not resolve the error.
I also tried creating the mapping manually with vim.keymap.set() and encountered the same:
[Comment.nvim] nil
Therefore, the issue does not appear to be related to the Zsh filetype or its commentstring. The default gcc mapping works, while custom mappings consistently trigger the error.
Environment
Neovim: 0.12.x
Plugin manager: built-in vim.pack
Plugin: numToStr/Comment.nvim
Filetype: zsh
Expected behavior
Custom mappings configured through toggler, opleader, or vim.keymap.set() should work in the same way as the default gcc mapping.
Is there a known compatibility issue with custom mappings when Comment.nvim is loaded using Neovim's vim.pack? What is the recommended configuration or workaround?