This commit is contained in:
Hadi
2026-05-21 13:56:31 +02:00
commit 2a0d03c258
4 changed files with 299 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
# sttr.nvim
A Neovim plugin for [sttr](https://github.com/abhimanyu003/sttr): select text, pick a transformation, done.
Supports charwise (`v`), linewise (`V`), and block (`<C-v>`) visual selections.
The list of available transformations is read dynamically from your installed version of sttr.
## Requirements
- Neovim 0.10+
- [sttr](https://github.com/abhimanyu003/sttr) installed and available in `$PATH`
## Installation
**lazy.nvim**
```lua
{
'anotherhadi/sttr.nvim',
config = function()
require('sttr').setup()
end,
}
```
## Setup
```lua
require('sttr').setup()
```
No keymaps are set by default. Add your own:
```lua
vim.keymap.set('v', '<leader>st', ':<C-u>SttrTransform<CR>', { silent = true, desc = 'sttr: transform selection' })
```
## Commands
| Command | Description |
| ----------------- | --------------------------------------------------------------- |
| `:SttrTransform` | Open the transformation picker for the current visual selection |
| `:SttrClearCache` | Clear the cached transformation list (re-reads `sttr --help`) |
## Pickers
The plugin automatically uses the best available picker:
1. [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
2. [snacks.nvim](https://github.com/folke/snacks.nvim) picker
3. `vim.ui.select` (built-in, or overridden by snacks/dressing/etc.)
## Block visual
In block visual mode (`<C-v>`), each line of the selection is transformed independently. This is useful for transforming a column of values (e.g. base64-decoding a column of tokens).
## Transformations
sttr.nvim dynamically reads transformations from `sttr --help` at first use, so it always reflects your installed version. sttr supports 60+ operations including:
- Encoding: base64, base32, URL, HTML, hex, morse…
- Hashing: md5, sha256, sha512, bcrypt…
- Case: camelCase, snake_case, kebab-case, UPPER, lower…
- Lines: sort, reverse, unique, shuffle…
- Formats: JSON↔YAML, markdown→HTML…
- Extraction: emails, IPs, URLs…