1
Fork 0
satellite/dotfiles/neovim/lua/my/plugins/comment.lua
2022-07-19 21:19:36 +03:00

27 lines
685 B
Lua

local A = require("my.helpers.augroup")
local M = {}
local extraCommentStrings = { lean = "/- %s -/", bkf = "-- %s" }
-- Update comments for certain languages
function M.setCommentString(extension, commentString)
A.augroup('set-commentstring-' .. extension, function()
local action =
':lua vim.api.nvim_buf_set_option(0, "commentstring", "' ..
commentString .. '")'
A.autocmd('BufEnter', '*.' .. extension, action)
A.autocmd('BufFilePost', '*.' .. extension, action)
end)
end
function M.setup()
require('nvim_comment').setup()
for lang, commentString in pairs(extraCommentStrings) do
M.setCommentString(lang, commentString)
end
end
return M