2023-01-03 04:33:34 +00:00
|
|
|
if not vim.g.guid then
|
2024-08-04 17:33:32 +00:00
|
|
|
local function guid_reload()
|
|
|
|
for name, _ in pairs(package.loaded) do
|
|
|
|
if vim.startswith(name, 'guid') then
|
|
|
|
package.loaded[name] = nil
|
|
|
|
end
|
|
|
|
end
|
2023-01-03 04:33:34 +00:00
|
|
|
end
|
2022-12-31 17:56:22 +00:00
|
|
|
|
2024-08-04 17:33:32 +00:00
|
|
|
local function guid_insert(ctx)
|
|
|
|
require('guid').guid_insert(ctx.args)
|
2023-01-03 04:33:34 +00:00
|
|
|
end
|
2022-12-31 17:56:22 +00:00
|
|
|
|
2024-08-04 17:33:32 +00:00
|
|
|
local function guid_format(ctx)
|
|
|
|
require('guid').guid_format(ctx.args)
|
2023-01-03 04:33:34 +00:00
|
|
|
end
|
|
|
|
|
2024-08-04 17:33:32 +00:00
|
|
|
local function guid_object()
|
|
|
|
require('guid').guid_object()
|
2023-01-03 04:33:34 +00:00
|
|
|
end
|
2023-01-01 05:09:47 +00:00
|
|
|
|
2023-01-25 02:12:31 +00:00
|
|
|
math.randomseed(os.time())
|
|
|
|
|
2024-08-04 17:33:32 +00:00
|
|
|
vim.api.nvim_create_user_command('GuidFormat', guid_format, {nargs = '?'})
|
|
|
|
vim.api.nvim_create_user_command('GuidInsert', guid_insert, {nargs = '?'})
|
|
|
|
vim.api.nvim_create_user_command('GuidObject', guid_object, {})
|
|
|
|
vim.api.nvim_create_user_command('GuidReload', guid_reload, {})
|
2023-01-03 04:33:34 +00:00
|
|
|
|
2022-12-31 17:56:22 +00:00
|
|
|
vim.g.guid = true
|
|
|
|
end
|