Numeralize.nvim is a Neovim plugin that converts numbers into text or Roman numerals. This plugin allows you to easily convert numbers in a specified pattern to either English words or Roman numerals within your Neovim buffer.
- Convert numbers to English words
- Supports both cardinal and ordinal numbers
- Convert numbers to Roman numerals
- Supports custom patterns for matching numbers
- Supports negative numbers
Using lazy.nvim
{
'svban/numeralize.nvim',
opts={},
cmd={"NumbersToWords", "NumbersToRoman"}
}
- an external library is required, it will be automatically installed, but if it doesn't for some reason, you can use
pip3 install num2words
To convert numbers to words, use the following command:
:NumbersToWords p<pattern> [c|o]
- p: Specifies the pattern to match numbers. Prefix the pattern with p.
- [c|o]: Optional. Specifies the conversion type. Use c for cardinal (default) or o for ordinal.
To convert numbers to Roman numerals, use the following command:
:NumbersToRoman p<pattern>
- p: Specifies the pattern to match numbers. Prefix the pattern with p.
To convert all numbers in the buffer to words:
:NumbersToWords p\d\+ c
To convert all numbers in the buffer to Roman numerals:
:NumbersToRoman p\d\+