Skip to content

Expand and repeat expression to multiple lines for neovim.

License

Notifications You must be signed in to change notification settings

AllenDang/nvim-expand-expr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nvim-expand-expr

Expand and repeat expression to multiple lines for neovim.

demo.gif!

Requirements

Neovim >= 0.5

Installation

packer.nvim

use 'AllenDang/nvim-expand-expr'

Usage

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)
  1. 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

About

Expand and repeat expression to multiple lines for neovim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages