Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niuiic/omega.nvim
Neovim lua utils
https://github.com/niuiic/omega.nvim
Last synced: 10 days ago
JSON representation
Neovim lua utils
- Host: GitHub
- URL: https://github.com/niuiic/omega.nvim
- Owner: niuiic
- License: mit
- Created: 2024-10-11T02:59:24.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-17T00:01:18.000Z (26 days ago)
- Last Synced: 2024-11-17T01:16:26.442Z (26 days ago)
- Language: Lua
- Size: 221 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - niuiic/omega.nvim (⭐1) - Missing functions for Lua plugin development. (Recently Updated / [Oct 14, 2024](/content/2024/10/14/README.md))
README
# omega.nvim
Lua development utilities for Neovim.
All functions are lazy load.
[More neovim plugins](https://github.com/niuiic/awesome-neovim-plugins)
## Install
- lazy.nvim
```lua
{"niuiic/omega.nvim", build = "cd rs && cargo build --release"}
```## Dev
Run current lua file with `require("omega").dofile(vim.api.nvim_buf_get_name(0))`. This function would unload deps of the file before running it, thus you can check the real-time update of the file without restart neovim.
It's recommended to do unit test with this function and builtin `assert`. Check `lua/omega/exist_in_file.test.lua` for an example.
## Functions
name|type|desc
-|-|-
dofile|fun(file_path: string)|dofile without cache
exist_in_file|fun(text: string, path: string): boolean|check if text exists in file
get_selected_area|fun(): omega.Area|get selected area
get_selection|fun(): string[] \| nil|get selected text, get cursor expr in normal mode
to_normal_mode|fun()|enter normal mode
get_timestamp|fun(time?: string): number|get a millisecond-level timestamp, time format should be like '2022-01-01 00:00:00'
get_human_readable_duration|fun(start_time: number, end_time: number): string|get a human-readable duration between two millisecond-level timestamps
get_chars|fun(str: string): string[]|get chars from a string, work for any transformation format## Useful Neovim Builtin Functions
| name | usage |
| ------------------ | ---------------------------- |
| vim.fn.isdirectory | check if path is a directory |
| vim.uv.fs_stat | check if path exist |
| vim.fs.root | find root directory |
| vim.system | spawn a command |
| vim.iter | lua list operation |
| vim.fs.joinpath | concat path |