Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/echasnovski/mini.operators
Text edit operators. Part of 'mini.nvim' library.
https://github.com/echasnovski/mini.operators
lua mini-nvim neovim neovim-plugin
Last synced: 2 days ago
JSON representation
Text edit operators. Part of 'mini.nvim' library.
- Host: GitHub
- URL: https://github.com/echasnovski/mini.operators
- Owner: echasnovski
- License: mit
- Created: 2023-08-15T08:49:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-09T13:45:35.000Z (2 months ago)
- Last Synced: 2024-09-09T16:38:21.661Z (2 months ago)
- Topics: lua, mini-nvim, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 48.8 KB
- Stars: 39
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![GitHub license](https://badgen.net/github/license/echasnovski/mini.nvim)](https://github.com/echasnovski/mini.nvim/blob/main/LICENSE)
### Text edit operators
See more details in [Features](#features) and [help file](doc/mini-operators.txt).
---
⦿ This is a part of [mini.nvim](https://github.com/echasnovski/mini.nvim) library. Please use [this link](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-operators.md) if you want to mention this module.
⦿ All contributions (issues, pull requests, discussions, etc.) are done inside of 'mini.nvim'.
⦿ See the repository page to learn about common design principles and configuration recipes.
---
If you want to help this project grow but don't know where to start, check out [contributing guides of 'mini.nvim'](https://github.com/echasnovski/mini.nvim/blob/main/CONTRIBUTING.md) or leave a Github star for 'mini.nvim' project and/or any its standalone Git repositories.
## Demo
https://github.com/echasnovski/mini.nvim/assets/24854248/8a3656c4-c92a-4d9f-9711-8d6a751b3e5a
## Features
Features:
- Operators:
- Evaluate text and replace with output.
- Exchange text regions.
- Multiply (duplicate) text.
- Replace text with register.
- Sort text.- Automated configurable mappings to operate on textobject, line, selection. Can be disabled in favor of more control with `MiniOperators.make_mappings()`.
- All operators support `[count]` and dot-repeat.
See `*MiniOperators-overview*` and `*MiniOperators.config*` tags in help for more details.
## Installation
This plugin can be installed as part of 'mini.nvim' library (**recommended**) or as a standalone Git repository.
There are two branches to install from:
- `main` (default, **recommended**) will have latest development version of plugin. All changes since last stable release should be perceived as being in beta testing phase (meaning they already passed alpha-testing and are moderately settled).
- `stable` will be updated only upon releases with code tested during public beta-testing phase in `main` branch.Here are code snippets for some common installation methods (use only one):
With mini.deps
Github repo
Branch Code snippet
'mini.nvim' library Main Follow recommended 'mini.deps' installation
Stable
Standalone plugin Mainadd('echasnovski/mini.operators')
Stableadd({ source = 'echasnovski/mini.operators', checkout = 'stable' })
With folke/lazy.nvim
Github repo
Branch Code snippet
'mini.nvim' library
Main{ 'echasnovski/mini.nvim', version = false },
Stable{ 'echasnovski/mini.nvim', version = '*' },
Standalone plugin
Main{ 'echasnovski/mini.operators', version = false },
Stable{ 'echasnovski/mini.operators', version = '*' },
With junegunn/vim-plug
Github repo
Branch Code snippet
'mini.nvim' library
MainPlug 'echasnovski/mini.nvim'
StablePlug 'echasnovski/mini.nvim', { 'branch': 'stable' }
Standalone plugin MainPlug 'echasnovski/mini.operators'
StablePlug 'echasnovski/mini.operators', { 'branch': 'stable' }
**Important**: don't forget to call `require('mini.operators').setup()` to enable its functionality.
**Note**: if you are on Windows, there might be problems with too long file paths (like `error: unable to create file : Filename too long`). Try doing one of the following:
- Enable corresponding git global config value: `git config --system core.longpaths true`. Then try to reinstall.## Default config
```lua
-- No need to copy this inside `setup()`. Will be used automatically.
{
-- Each entry configures one operator.
-- `prefix` defines keys mapped during `setup()`: in Normal mode
-- to operate on textobject and line, in Visual - on selection.-- Evaluate text and replace with output
evaluate = {
prefix = 'g=',-- Function which does the evaluation
func = nil,
},-- Exchange text regions
exchange = {
prefix = 'gx',-- Whether to reindent new text to match previous indent
reindent_linewise = true,
},-- Multiply (duplicate) text
multiply = {
prefix = 'gm',-- Function which can modify text before multiplying
func = nil,
},-- Replace text with register
replace = {
prefix = 'gr',-- Whether to reindent new text to match previous indent
reindent_linewise = true,
},-- Sort text
sort = {
prefix = 'gs',-- Function which does the sort
func = nil,
}
}
```## Similar plugins
- [gbprod/substitute.nvim](https://github.com/gbprod/substitute.nvim)
- [svermeulen/vim-subversive](https://github.com/svermeulen/vim-subversive)
- [tommcdo/vim-exchange](https://github.com/tommcdo/vim-exchange)
- [christoomey/vim-sort-motion](https://github.com/christoomey/vim-sort-motion)