2022-04-04 01:10:26 +02:00
|
|
|
local A = require("my.helpers.augroup")
|
2022-02-07 11:47:03 +01:00
|
|
|
local M = {}
|
|
|
|
|
2022-05-10 14:28:36 +02:00
|
|
|
local extraCommentStrings = {nix = "# %s", lean = "/- %s -/", bkf = "-- %s"}
|
2022-04-04 01:10:26 +02:00
|
|
|
|
2022-02-07 11:47:03 +01:00
|
|
|
-- Update comments for certain languages
|
|
|
|
local function setCommentString(extension, commentString)
|
2022-04-04 01:10:26 +02:00
|
|
|
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)
|
2022-02-07 11:47:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function M.setup()
|
|
|
|
require('nvim_comment').setup()
|
|
|
|
|
2022-04-04 01:10:26 +02:00
|
|
|
for lang, commentString in pairs(extraCommentStrings) do
|
|
|
|
setCommentString(lang, commentString)
|
|
|
|
end
|
2022-02-07 11:47:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|