Go to file
2023-01-24 18:12:31 -08:00
img Add README 2023-01-11 20:37:56 -08:00
lua Fix bit math error, explicitly seed random number generator 2023-01-24 18:12:31 -08:00
plugin Fix bit math error, explicitly seed random number generator 2023-01-24 18:12:31 -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 Update README 2023-01-22 22:21:45 -08:00

guid.nvim

This Neovim-exclusive plugin simplifies common operations when working with Globally Unique Identifiers (GUIDs). The produced values fully conform to the RFC 4122 spec for for pseudo-random GUIDs.

GUID Styles

There are several ways to represent GUIDs as text. The format specifier syntax outlined by Guid.ToString is borrowed for styling text output. This convention is expanded to allow the casing of hexadecimal characters to be specified. The casing of the format specifier determines whether lowercase or uppercase will be used.

  • 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}}

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 functionally identical yag can also be used). The GUID text object supports all of the GUID formatting styles described above. Make sure to call setup if you wish to use GUID text objects (details in the next section).

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'
})

Specifically, 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.