Gaetan Lepage
a7e516b322
lib/utils: add mkAssertions
2025-01-20 14:17:26 +01:00
Gaetan Lepage
02e16b2a76
lib/utils: add mkWarnings
2025-01-20 12:25:33 +00:00
Sandro Jäckel
d608bccddd
Replace runCommandNoCCLocal alias with runCommandLocal
2025-01-01 00:54:27 +00:00
Matt Sturgeon
896f6be694
lib/plugins: take ownership of modules
utils
...
These util functions were previously defined in `modules`, but
`plugins.utils` is a better home.
2024-12-22 09:35:16 +00:00
Gaetan Lepage
1d50fa4f63
lib: add applyPrefixToAttrs
2024-12-17 21:40:20 +00:00
Gaetan Lepage
ec24d496d5
treewide (cleaning): helpers.toLuaObject -> lib.nixvim.toLuaObject
2024-12-15 21:55:51 +00:00
Matt Sturgeon
6a192a8604
lib/neovim-plugin: allow configLocation
to be wrapped using mkOrder
2024-12-14 02:39:44 +00:00
Matt Sturgeon
da6e3499d4
lib/utils: add nestedLiteral
and nestedLiteralLua
...
`nestedLiteral` converts a `literalExpression` into a `toPretty` style
pretty-printer.
`nestedLiteralLua` composes `nestedLiteral` and `literalLua` together.
2024-11-15 21:46:25 +00:00
Matt Sturgeon
eb76e62a9b
lib/utils: add literalLua
for use in option docs
...
Creates a `literalExpression` equivalent to using `lib.nixvim.mkRaw`.
2024-11-15 21:46:25 +00:00
Matt Sturgeon
036e11665f
tests: cleanup tests to better use callTest
pattern
...
e.g. Prefer taking `pkgs.*` attrs directly as function arguments.
2024-10-18 20:52:02 +01:00
Jeremy Fleischman
400d1d927d
lib: fix escaping bugs in wrapVimscriptForLua and wrapLuaForVimscript
...
These functions had very similar bugs: they didn't check if their chosen
"close token" was already present in the string they're escaping.
I went ahead and did the work implied by the TODOs: search for a "close
token" that is *not* in the original string. Pretty simple concept, but
it turned into an annoying amount of code. I couldn't find anything in
upstream nixpkgs lib, or some clever insight about lua/vimscript that
makes this work unecessary, but I'll be thrilled (and a little bummed
about a wasted afternoon) to learn about something.
2024-09-19 15:41:46 -07:00
Matt Sturgeon
8f99c3953c
lib/util: add groupListBySize
...
Splits up a list into many sub-lists based on the given max-size.
e.g.
```nix
groupListBySize 2 [ 1 2 3 4 5 ]
=> [ [ 1 2 ] [ 3 4 ] [ 5 ] ]
```
2024-08-19 00:50:57 +01:00
Matt Sturgeon
693e749edb
tests/lib-test: correctly print expected/result
...
In some edge cases, expected and result can't be directly used in string
interpolation, so pass them through `lib.generators.toPretty` to be safe.
2024-08-19 00:38:22 +01:00
Matt Sturgeon
4eb2ad7db7
lib/lua: support nixpkg's "lua-inline" type
...
See #1935
2024-08-14 00:25:59 +01:00
Matt Sturgeon
6dc0bda459
lib/to-lua: handle derivations as path strings
...
Fixes #1888
2024-07-22 13:24:16 +01:00
Matt Sturgeon
9b25eaaa6f
lib/to-lua: fix removing empties nested in lists
...
- Add options for removing empty/null list entries (default false)
- Fix recursion into attrs that are themselves list entries
Fixes #1804
2024-07-03 16:44:30 +01:00
Matt Sturgeon
aff12581d8
lib/lua: refactor toLuaObject, now configurable
...
Heavily based on nixpkgs lib.generators.toPretty
2024-06-28 22:44:43 +01:00
Matt Sturgeon
53a9599cc4
lib/lua: pad table ,
with a space
...
Makes toLuaObject's output a little more readable.
2024-06-26 12:35:47 +01:00
Matt Sturgeon
00ce71f51a
lib/lua: only quote table keys when needed
2024-06-26 12:31:05 +01:00
Matt Sturgeon
01cf43dbaa
lib/lua: add isKeyword
and isIdentifier
...
Allow testing whether a string is a valid lua identifier or a reserved
keyword.
2024-06-26 11:40:52 +01:00
Matt Sturgeon
c16533b3f7
lib: add upperFirstChar
...
A util function to capitalize the first character of a string.
2024-06-07 09:17:29 +01:00
traxys
62f32bfc71
treewide: Reformat with nixfmt
2024-05-05 22:00:40 +02:00
Gaetan Lepage
a121d96091
tests: do not import helpers.nix directly
2024-02-11 11:50:35 +01:00
Gaetan Lepage
b6724702b4
misc: refactor imports, prefer adding helpers
to args rather than importing it
2023-11-06 16:33:39 +01:00
municorn
934bf7e2e3
fix(helpers): use "__unkeyed" prefix instead of "@" in toLuaObject
( #632 )
2023-10-09 15:50:21 +02:00
Gaétan Lepage
35c56b62a1
helpers/lib: toLuaObject ignore empty attrs ( #312 )
2023-04-03 11:25:37 +02:00
*Kim Zick
7f50b54bfb
tests/lib: Add basic unit tests for helpers.toLuaObject
( #291 )
2023-03-26 11:03:51 +02:00