~foosoft/guid.nvim

Neovim plugin for generating and reformatting GUIDs
2273e2ac — Alex Yatskov 23 days ago
Merge branch 'master' of https://git.yatskov.com/alex/guid.nvim
4eee70f1 — Alex Yatskov 23 days ago
Cleanup
a92fd261 — Alex Yatskov 23 days ago
Update README

refs

master
browse  log 
25.3.30.1
browse  .tar.gz 

clone

read-only
https://git.sr.ht/~foosoft/guid.nvim
read/write
git@git.sr.ht:~foosoft/guid.nvim

You can also use your local clone with git send-email.

#GUID

This plugin makes working with Globally Unique Identifiers easier in Neovim. Generated GUIDs conform to the RFC 4122 spec for pseudo-random identifiers.

#Configuration

The plugin is configured via the setup function. Options may be provided to change the default settings shown below.

require('guid').setup({
    default = 'd',
    styles = {
        n = '????????????????????????????????',
        d = '????????-????-????-????-????????????',
        b = '{????????-????-????-????-????????????}',
        p = '(????????-????-????-????-????????????)',
        x = '{0x????????,0x????,0x????,{0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??}}',
    },
})
#default

Specifies which format to use if one is not provided for GuidInsert, GuidAppend, and GuidFormat commands.

#styles

Specifies template map used for parsing and printing GUIDs. The question marks are placeholders for hexadecimal characters.

#Formatting

The format specifier syntax outlined by Guid.ToString is borrowed for the default GUID styles. The casing of the format specifier determines whether lowercase or uppercase will be used. You can modify these mappings and introduce new GUID styles as you see fit.

Format Example
n cbb297c014a940bc8d911d0ef9b42df9
N CBB297C014A940BC8D911D0EF9B42DF9
d cbb297c0-14a9-40bc-8d91-1d0ef9b42df9
D CBB297C0-14A9-40BC-8D91-1D0EF9B42DF9
b {cbb297c0-14a9-40bc-8d91-1d0ef9b42df9}
B {CBB297C0-14A9-40BC-8D91-1D0EF9B42DF9}
p (cbb297c0-14a9-40bc-8d91-1d0ef9b42df9)
P (CBB297C0-14A9-40BC-8D91-1D0EF9B42DF9)
x {0xcbb297c0,0x14a9,0x40bc,{0x8d,0x91,0x1d,0x0e,0xf9,0xb4,0x2d,0xf9}}
X {0xCBB297C0,0x14A9,0x40BC,{0x8D,0x91,0x1D,0x0E,0xF9,0xB4,0x2D,0xF9}}

#Commands

Commands are not mapped by default; an example set of bindings is shown below:

vim.keymap.set({'x', 'o'}, 'ag', ':<c-u>GuidObject<cr>', {noremap = true, silent = true})
#GuidInsert [format]

Inserts a GUID at the cursor position using the optionally provided format.

#GuidAppend [format]

Appends a GUID at the cursor position using the optionally provided format.

#GuidFormat [format]

Formats the GUID at the cursor position using the optionally provided format.

#GuidSpin [range]

Regenerates the selected GUIDs while preserving their style. GUIDs are bucketed by their value, meaning that identical GUIDs will still have matching (but new) values after after this operation.

#GuidObject

Selects the GUID at the cursor position.

Do not follow this link