Go to file
2023-01-21 17:58:44 -08:00
img Add README 2023-01-11 20:37:56 -08:00
lua Generate GUID according to RFC 4122 2023-01-21 17:58:44 -08:00
plugin Add text object 2023-01-02 20:33:34 -08:00
.gitignore Boilerplate 2022-12-31 09:56:22 -08:00
LICENSE Initial commit 2022-12-30 17:33:53 -08:00
README.md Add README 2023-01-11 20:37:56 -08:00

guid.nvim

This Neovim plugin simplifies common operations when working with Globally Unique Identifiers (GUIDs). As guid.nvim is written entirely in Lua, classic Vim is not supported.

GUID Styles

There a few standard ways to format GUIDs. The one-character format specifier for these styles are based on the convention outlined in the documentation for Guid.ToString. This set of specifiers was expanded to allow the case of hexadecimal characters to be specified. The casing of the specifier determines whether lowercase or uppercase will be used.

  • n 00000000000000000000000000000000
    32 digits.

  • d 00000000-0000-0000-0000-000000000000
    32 digits separated by hyphens.

  • b {00000000-0000-0000-0000-000000000000}
    32 digits separated by hyphens, enclosed in braces.

  • p (00000000-0000-0000-0000-000000000000)
    32 digits separated by hyphens, enclosed in parenthesis.

  • x {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
    Four hexadecimal values enclosed in braces, where the fourth value is a subset of eight hexadecimal values that is also enclosed in braces.

GUID Commands

  • GuidInsert [style]
    Inserts a GUID at the cursor position using the default or provided style.

  • GuidFormat [style]
    Formats the GUID at the cursor position using the default or provided style.

  • GuidObject
    Selects the GUID at the cursor position (useful for text objects).

GUID Text Object

A custom text object for GUIDs is provided. By default it is bound to the g key. For example to yank a GUID you would input yig in normal mode. The GUID text object supports all of the GUID styles described above.

Configuration

The plugin should be configured by calling the setup function. Options can be optionally provided if you wish to override the default settings, which are shown below:

require('guid').setup({
    comma_space = false,
    default_style = 'd',
    object_char = 'g'
})

These options are:

  • comma_space
    Determines if commas should be followed by spaces in GUIDs formatted with the x specifier.

  • default_style
    Determines what style to use if one is not provided for GuidInsert and GuidFormat commands.

  • object-char
    Determines which character should be used for the GUID text object.