Closed YanzhaoW closed 2 years ago
local function nvim_comment()
require('nvim_comment').setup()
vim.api.nvim_command [[autocmd! FileType cpp :lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")]]
end
use {'terrortylor/nvim-comment', config = nvim_comment}
and it works well.
Hi,
I want to change the comment format of cpp file from "/*...*/" to "//...". According to README, I wrote following codes in my config file (.lua file):
But it didn't work at all. The comment format is still "/*...*/"
Also I don't want to do
as is shown in README file because cpp files can have many extensions, such as .cxx .cc .cpp or .h .hpp .hh etc. So I would like to set commentstring based on filetype instead of file extension.