Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AllenDang/nvim-expand-expr
Expand and repeat expression to multiple lines for neovim.
https://github.com/AllenDang/nvim-expand-expr
Last synced: about 2 months ago
JSON representation
Expand and repeat expression to multiple lines for neovim.
- Host: GitHub
- URL: https://github.com/AllenDang/nvim-expand-expr
- Owner: AllenDang
- License: mit
- Created: 2021-08-13T07:15:14.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-14T10:21:19.000Z (over 3 years ago)
- Last Synced: 2024-07-31T20:51:37.269Z (4 months ago)
- Language: Lua
- Size: 80.1 KB
- Stars: 35
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - Allendang/nvim-expand-expr - Expand and repeat expression to multiple lines. (Editing Support / Scrollbar)
- my-neovim-pluginlist - Allendang/nvim-expand-expr - expand-expr) ![](https://img.shields.io/github/last-commit/Allendang/nvim-expand-expr) ![](https://img.shields.io/github/commit-activity/y/Allendang/nvim-expand-expr) (Editing support / Misc)
README
# nvim-expand-expr
Expand and repeat expression to multiple lines for neovim.
![demo.gif!](https://github.com/AllenDang/nvim-expand-expr/blob/main/demo.gif)
# Requirements
`Neovim >= 0.5`
# Installation
[packer.nvim](https://github.com/wbthomason/packer.nvim)
`use 'AllenDang/nvim-expand-expr'`
# Usage
```lua
require("expand_expr").expand()
```It will parse cursor line and expand it base on below syntax.
`range|expr`
## range
`range` has two forms.
1. Single number
`10|print({%d})` will expand to```
print(1)
print(2)
print(3)
print(4)
print(5)
print(6)
print(7)
print(8)
print(9)
print(10)
```2. Range format
`3,7|print({%d})` will expand to```
print(3)
print(4)
print(5)
print(6)
print(7)
```## expr
_expr_ is a string contains multiple `{%d}` parts, the content inside {} will be eval as lua expression.
`3|{%d} + {%d+1} + {%d+2}` will expand to
```
1 + 2 + 3
2 + 3 + 4
3 + 4 + 5
````3|{%d .. ' hello world ' .. %d*3}` will expand to
```
1 hello world 3
2 hello world 6
3 hello world 9
```