A neovim plugin for generating fake data. It can be used to create random names, addresses, phone numbers, and other types of data, which is useful for testing and development purposes. It uses @tehdb/faker-cli under the hood which is based on Faker
For faster
:Faker
command executions, it is recommended to install the faker CLI as a global npm package usingnpm i -g @tehdb/faker-cli
. Otherwise, npx is used to run faker commands, which consumes more time to execute.
With lazy.nvim
{
'tehdb/nvim-faker',
config = function()
require('nvim-faker').setup({
use_global_package = true -- use gloabl npm package otherwise npx (default: false)
})
end
}
With LuaRocks
luarocks install nvim-faker
or with rocks.nvim
:Rocks nvim-faker
require('faker').setup{}
lua << EOF
require('faker').setup{}
EOF
:Faker <module> <function> [param-value]... [param-key:param-value]... [locale]
For modules and supported functions see faker api reference
For supported locales see available locales
When you type the :Faker
command and press <space>
followed by <tab>
, completions for the faker modules will appear. After choosing or typing a faker module and pressing <space>
and <tab>
again, completions for the selected faker module functions will be displayed.
:Faker lorem words
:Faker lorem words de
:Faker lorem words 5
:Faker lorem words 5 de
:Faker lorem words min:4 max:5
:Faker lorem words min:4 max:5 de
:Faker lorem sentences 2 '<br>'
:Faker lorem sentences 2 '<br>' de