1
Fork 0
satellite/dotfiles/neovim/lua/my/plugins/comment.lua

19 lines
601 B
Lua
Raw Normal View History

2022-02-07 11:47:03 +01:00
local M = {}
-- Update comments for certain languages
local function setCommentString(extension, commentString)
2022-02-07 11:52:21 +01:00
vim.cmd('augroup set-commentstring-' .. extension)
vim.cmd('autocmd!')
vim.cmd('autocmd BufEnter *.' .. extension .. ' :lua vim.api.nvim_buf_set_option(0, "commentstring", "' .. commentString .. '")')
vim.cmd('autocmd BufFilePost *.' .. extension .. ' :lua vim.api.nvim_buf_set_option(0, "commentstring", "' .. commentString .. '")')
vim.cmd('augroup END')
2022-02-07 11:47:03 +01:00
end
function M.setup()
require('nvim_comment').setup()
2022-02-07 11:52:21 +01:00
setCommentString("nix", "# %s")
2022-02-07 11:47:03 +01:00
end
return M