terrortylor / nvim-comment

A comment toggler for Neovim, written in Lua
MIT License
479 stars 23 forks source link

Autohotkey/AHK files not getting commented. #57

Open leet0rz opened 1 year ago

leet0rz commented 1 year ago

Shows commentstring not understood.

oneroyalace commented 1 year ago

@leet0rz, You can have nvim-comment work with AHK files by creating an autocommand that sets the AHK commentstring buffer option, thus letting nvim-comment know how to recognize AHK comments.

E.g., somewhere in your init.lua path, try adding


vim.api.nvim_create_augroup("comment", { clear = true })

vim.api.nvim_create_autocmd({"BufEnter", "BufFilePost"}, {
  group = "comment",
  pattern = {"*.ahk"},
  callback = function()
    vim.api.nvim_buf_set_option(0, "commentstring", "; %s")
  end
})

I would personally stick this in my lua/plugins/nvimcomment.lua config file.