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.
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,
})- Select content in different lines in Visual mode;
- Run
:RandomizeBetween <min> <max>; - The function will replace selected content with random numbers in choosen range.
random-numbers.mp4
- Select content in different lines in Visual mode;
- Run
:RandomizeDateBetween <yyyy-MM-dd> <yyyy-MM-dd>; - The function will replace selected content with random dates in choosen range.
random-dates.mp4
- Select content in different lines in Visual mode;
- Run
:RandomizeChoice <option1> <option2> [option3] ...; - 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.
- Select content in different lines in Visual mode;
- Run
:RandomizeBool [format]; - The function will replace selected content with random boolean values.
Formats:
true/false(default)yes/no1/0
Example: :RandomizeBool yes/no will randomly generate "yes" or "no" for
each selected line.
- Select content in different lines in Visual mode;
- Run
:RandomizeString <length>or:RandomizeString <min> <max>; - The function will replace selected content with random alphanumeric strings.
Examples:
:RandomizeString 10generates strings of exactly 10 characters:RandomizeString 5 15generates strings with length between 5 and 15 characters
- Select content in different lines in Visual mode;
- Run
:RandomizeUUID; - The function will replace selected content with RFC4122 compliant UUIDs (v4).
Example output: a3f2b8c1-4d5e-4f6a-9b8c-7d6e5f4a3b2c
- Select content in different lines in Visual mode;
- Run
:RandomizeColor; - The function will replace selected content with random hex color codes.
Example output: #a3f2b8, #ff5733, #00ff00
This plugin is licensed under the MIT License.