Use this example as a convention for helper functions:
---@param name string # name of the augroup
---@param opts table | nil # options for the augroup
---@return number # returns augroup id
_H.create_augroup = function(name, opts)
...
end
---@param file_name string # name of the file for which to get buffer
---@return number | nil # buffer number
_H.get_buffer = function(file_name)
...
end
The function assignment is preferred over:
function _H.create_augroup(name, opts)
...
end
Module has following structure:
local uv = vim.uv or vim.loop
local config = require("gp.config")
local M = {
_Name = "Gp", -- plugin name
_state = {}, -- table of state variables
agents = {}, -- table of agents
cmd = {}, -- default command functions
config = {}, -- config variables
hooks = {}, -- user defined command functions
defaults = require("gp.defaults"), -- some useful defaults
deprecator = require("gp.deprecator"), -- handle deprecated options
helpers = require("gp.helper"), -- helper functions
imager = require("gp.imager"), -- imager module
logger = require("gp.logger"), -- logger module
render = require("gp.render"), -- render module
spinner = require("gp.spinner"), -- spinner module
tasker = require("gp.tasker"), -- tasker module
vault = require("gp.vault"), -- vault module
whisper = require("gp.whisper"), -- whisper module
}