Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maaslalani/awkward.nvim
Evaluate AWK expressions within neovim
https://github.com/maaslalani/awkward.nvim
Last synced: 9 days ago
JSON representation
Evaluate AWK expressions within neovim
- Host: GitHub
- URL: https://github.com/maaslalani/awkward.nvim
- Owner: maaslalani
- Created: 2021-07-17T04:03:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-17T04:28:38.000Z (over 3 years ago)
- Last Synced: 2024-10-16T19:19:28.792Z (23 days ago)
- Language: Lua
- Homepage:
- Size: 5.86 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Awkward
**Awkward** is a (trivial) lua plugin for Neovim that allows your to write
`AWK` expressions to perform calculations on data inside a vim buffer. The
`AWK` expression, when evaluated, is concealed and the result is displayed with
Virtual Text.For example, given a buffer:
```
| Mock | Data |
| ---- | ---- |
| 10 | 2 |
| 12 | 4 |
| 14 | 6 |
| 16 | 8 |-- Sum: first column
awk '{ a += $2 } END { print a }'-- Sum: second column
awk '{ b += $4 } END { print b }'
```Running `:Awkward` will result in
```lua
...-- Sum: first column
→ 52-- Sum: second column
→ 20
```The `AWK` expression is only `Conceal`ed (not replaced) so when you hover your
cursor over the result, you can continue to edit the `AWK` expression.Lua-style comments (`--`) are available to use to document the result of your
`AWK` expressions.### Keybindings
Awkward comes with no keybindings. Map `:Awkward` to whatever you want.### Highlights
* `AwkwardComment` (defaults to `Comment`) are the Lua-style `--` comments
* `AwkwardExpression` (defaults to `Text`) are the `awk '{ ... }'` expressions
* `AwkwardResults` (defaults to `Text`) are evaluated results### Setup
In `init.lua`
```lua
require('awkward').setup{}
```To evaluate the buffer, use `:Awkward`.