TinyUnit is a minimalist unit converter for Neovim, designed to seamlessly convert between different CSS units directly within your editor. Perfect for frontend developers who want to quickly convert measurements without leaving their editor.
demo.mp4
- 🪟 Convert units in a clean floating window
- 📏 Support for common CSS units (px, rem, em, vh, vw, mm, cm, in, pt)
- 🎯 Visual selection support for direct conversion
- ⚡ Fast and lightweight
- 🎨 Adapts to your Neovim colorscheme
- 🛠️ Compatible with Lazy.nvim for effortless installation
- Neovim >= 0.8.0
- Lazy.nvim as your plugin manager
return {
"atiladefreitas/tinyunit",
config = function()
require("tinyunit").setup({
-- your custom config here (optional)
})
end,
}
TinyUnit comes with sensible defaults that you can override:
{
window = {
width = 30, -- Width of the floating window
height = 15, -- Height of the floating window
border = "rounded", -- Border style
input_title = "Enter Value",
},
keymap = {
open = "tc", -- Toggle converter window
close = "q", -- Close window
convert = "", -- Convert value
escape = "", -- Close window
},
units = {
"px",
"rem",
"em",
"vh",
"vw",
"mm",
"cm",
"in",
"pt",
},
font = {
base_size = 16, -- Base font size in pixels (default: 16)
},
}
- Press
<leader>tc
to open the converter window - Enter a value with unit (e.g., "16px")
- Press
<CR>
to see all possible conversions - Select a converted value and press
<CR>
to replace the original value
- Select a value in your code (e.g., "16px")
- Press
<leader>tc
- The converter will automatically convert the selected value
- Choose a conversion and press
<CR>
to replace the selected text
TinyUnit supports conversions between the following units:
- px (pixels)
- rem (root em)
- em (relative to parent font size)
- vh (viewport height)
- vw (viewport width)
- mm (millimeters)
- cm (centimeters)
- in (inches)
- pt (points)
- Custom conversion formulas
- More unit types (deg, rad, etc.)
- Configuration for base font size
- Support for calc() expressions
- Unit conversion history
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Feel free to:
- Submit issues for bugs or feature requests
- Create pull requests with improvements
- Share feedback and suggestions
Special thanks to:
- The Neovim community
- Lazy.nvim
- All contributors and users
Repository | Description | Stars |
---|---|---|
LazyClip | A Simple Clipboard Manager | |
Dooing | A Minimalist Todo List Manager | |
TinyUnit | A Practical CSS Unit Converter |