guid.nvim/plugin/guid.lua

22 lines
502 B
Lua
Raw Normal View History

2022-12-31 17:56:22 +00:00
local guid = require('guid')
2023-01-02 03:50:01 +00:00
local function reload()
2022-12-31 17:56:22 +00:00
package.loaded.guid = nil
guid = require('guid')
end
2023-01-02 03:50:01 +00:00
local function insert(ctx)
2023-01-01 04:56:47 +00:00
guid.guid_insert(ctx.args)
2022-12-31 17:56:22 +00:00
end
2023-01-02 03:50:01 +00:00
local function format(ctx)
2023-01-01 05:09:47 +00:00
guid.guid_format(ctx.args)
end
2022-12-31 17:56:22 +00:00
if not vim.g.guid then
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 = '?'})
vim.api.nvim_create_user_command('GuidReload', reload, {})
2022-12-31 17:56:22 +00:00
vim.g.guid = true
end