guid.nvim/plugin/guid.lua

30 lines
706 B
Lua
Raw Normal View History

2023-01-03 04:33:34 +00:00
if not vim.g.guid then
local guid = require('guid')
2022-12-31 17:56:22 +00:00
2023-01-03 04:33:34 +00:00
local function reload()
package.loaded.guid = nil
guid = require('guid')
end
2022-12-31 17:56:22 +00:00
2023-01-03 04:33:34 +00:00
local function insert(ctx)
guid.guid_insert(ctx.args)
end
2022-12-31 17:56:22 +00:00
2023-01-03 04:33:34 +00:00
local function format(ctx)
guid.guid_format(ctx.args)
end
local function object()
guid.guid_object()
end
2023-01-01 05:09:47 +00:00
math.randomseed(os.time())
2023-01-02 03:50:01 +00:00
vim.api.nvim_create_user_command('GuidFormat', format, {nargs = '?'})
vim.api.nvim_create_user_command('GuidInsert', insert, {nargs = '?'})
2023-01-03 04:33:34 +00:00
vim.api.nvim_create_user_command('GuidObject', object, {})
2023-01-02 03:50:01 +00:00
vim.api.nvim_create_user_command('GuidReload', reload, {})
2023-01-03 04:33:34 +00:00
2022-12-31 17:56:22 +00:00
vim.g.guid = true
end