@advice2020, you misspelled my nickname :) I didn't receive the notification, I 
saw it by accident.

Maybe something like this (but I didn't check it)
```lua
local aTypes = {
{"Lua", ".lua", "--#####################################"},
{"",    ".txt", "######################################"},
{"XML", ".xml", "<!--#################################-->"}
}
local aFI = geany.fileinfo()
local sExt, sStr
for i = 1, #aTypes do
  if aTypes[i][1] == aFI.type then
    sStr = aTypes[i][3]
    break
  end
end
if sStr == nil then
  sExt = string.lower(aFI.ext)
  for i = 1, #aTypes do
    if aTypes[i][2] == sExt then
      sStr = aTypes[i][3]
      break
    end
  end
end
if sStr == nil then
  geany.status("Warning: Unknown file type!")
  return
end
local iEOL = geany.scintilla("SCI_GETEOLMODE")
local sLE
if iEOL == 0 then
  sLE = "\r\n"
elseif iEOL == 1 then
  sLE = "\r"
elseif iEOL == 2 then
  sLE = "\n"
else
  sLE = "\n"
end
local iCurPos = geany.caret()
local iL, iC = geany.rowcol(iCurPos)
iCurPos = geany.scintilla("SCI_POSITIONFROMLINE", iL - 1)
geany.select(iCurPos)
geany.selection(sStr .. sLE)
```
`aTypes`:
```
{"file type", "file extension", "string"}
```
where "file extension" with dot, "file type" - see `filetype_extensions.conf` 
([online](https://github.com/geany/geany/blob/master/data/filetype_extensions.conf)).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1384#issuecomment-2488726988
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/issues/1384/[email protected]>

Reply via email to