Skip to content

About

Small plugin that let you randomize data on multiple lines within Neovim.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Randomize.nvim

Lua Neovim

Welcome!

If you've stumbled upon this plugin, chances are you don't need it. randomize.nvim was created to address a simple yet annoying problem: generating mock data to test a REST API.

While a quick script might work for single use cases, I needed a solution that could speed up the data generation on different CSV files with varying numbers of columns and diverse values requirements. Relying on scripts would have meant cluttering them with numerous if statements to account for all the variations, making the process cumbersome and error-prone.

This plugin provides an easy way to generate random values directly within Neovim, giving you fine control over the data to ensure it's both random and meaningful.

Installation

Using lazy.nvim:

{
    "simone-lungarella/randomize.nvim",
    config = function()
        require("randomize").setup()
    end,
}

Using packer.nvim:

use({
    "simone-lungarella/randomize.nvim",
    config = function()
        require("randomize").setup()
    end,
})

Usage

RandomizeBetween

  1. Select content in different lines in Visual mode;
  2. Run :RandomizeBetween <min> <max>;
  3. The function will replace selected content with random numbers in choosen range.
random-numbers.mp4

RandomizeDateBetween

  1. Select content in different lines in Visual mode;
  2. Run :RandomizeDateBetween <yyyy-MM-dd> <yyyy-MM-dd>;
  3. The function will replace selected content with random dates in choosen range.
random-dates.mp4

RandomizeChoice

  1. Select content in different lines in Visual mode;
  2. Run :RandomizeChoice <option1> <option2> [option3] ...;
  3. The function will replace selected content with a random choice from the provided options.

Example: :RandomizeChoice pending approved rejected will randomly pick one of these three values for each selected line.

RandomizeBool

  1. Select content in different lines in Visual mode;
  2. Run :RandomizeBool [format];
  3. The function will replace selected content with random boolean values.

Formats:

  • true/false (default)
  • yes/no
  • 1/0

Example: :RandomizeBool yes/no will randomly generate "yes" or "no" for each selected line.

RandomizeString

  1. Select content in different lines in Visual mode;
  2. Run :RandomizeString <length> or :RandomizeString <min> <max>;
  3. The function will replace selected content with random alphanumeric strings.

Examples:

  • :RandomizeString 10 generates strings of exactly 10 characters
  • :RandomizeString 5 15 generates strings with length between 5 and 15 characters

RandomizeUUID

  1. Select content in different lines in Visual mode;
  2. Run :RandomizeUUID;
  3. The function will replace selected content with RFC4122 compliant UUIDs (v4).

Example output: a3f2b8c1-4d5e-4f6a-9b8c-7d6e5f4a3b2c

RandomizeColor

  1. Select content in different lines in Visual mode;
  2. Run :RandomizeColor;
  3. The function will replace selected content with random hex color codes.

Example output: #a3f2b8, #ff5733, #00ff00

License

This plugin is licensed under the MIT License.

About

Small plugin that let you randomize data on multiple lines within Neovim.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages