Commit graph

55 commits

Author SHA1 Message Date
Gaetan Lepage
bb5b0a2655 tests/modules-performance: add nvim-cmp to extraPlugins when necessary 2024-11-30 18:13:15 +01:00
Heitor Augusto
1d78aee791 tests/modules/clipboard: add raw lua code test 2024-11-15 18:40:10 +00:00
Heitor Augusto
f11a877bcc
tests/modules/output: add tests for providers 2024-11-13 16:55:33 -03:00
Matt Sturgeon
c4ad4d0b2e
modules/nixpkgs: add overlays option
Based on the `nixpkgs.overlays` option available in NixOS, allows users
to further customize the `pkgs` instance used when evaluating nixvim.

The standard module tests are now provided a few extra module args to
enable a test where we instantiate a custom nixpkgs instance.
2024-10-19 21:11:42 +01:00
Stanislav Asunkin
767eb62f48 modules/output: obtain plugin configs from wrapped neovim
The official method for obtaining the generated initRc content is from
wrapped neovim rather than from makeNeovimConfig helper. To use this
approach: first wrap neovim with the generated config, then override it
with our wrapperArgs.
2024-10-13 09:54:05 +03:00
Stanislav Asunkin
21f7ed6eb6 tests/modules/output: test that init.lua contains all config sections
This test was removed in 3d1224a039 to
remove IFD. Rewrite the test using `pkgs.runCommandLocal` and grep.
2024-10-13 09:28:12 +03:00
Austin Horstman
75ae10571d
tests/byte-compile-lua: server_configurations -> configs
bedb2a0df1
2024-10-10 08:58:59 -05:00
Matt Sturgeon
6a1bf6bdc3
modules/output: check warnings+assertions on build.package
Add a `build.packageUnchecked` option for use instead of the old `check`
evalNixvim argument.
2024-09-26 18:04:36 +01:00
Matt Sturgeon
692e39311e
modules/{output,files,test}: move outputs to build scope
Move the following output options into `build`:
- finalPackage -> package
- printInitPackage
- initPath -> initFile
- filesPlugin -> extraFiles
- test.derivation -> test
2024-09-26 06:31:57 +01:00
Matt Sturgeon
4e5bd1d79b
lib: segregate and deprecate functions that need pkgs
Splits everything that depends on a `pkgs` instance into an optional
attrs, allowing `helpers.nix` to be bootstrapped without `pkgs`.

This required some refactoring:
- `modules.specialArgs` is only available when `pkgs` is used
- `modules.specialArgsWith` now requires `defaultPkgs` be provided
- `builders.*` now have `*With` variants that take `pkgs` as an argument
  and a `withPkgs` function that returns the old interface
- Had to define the fixed part of `builders` outside the attrs for now,
  to avoid infinite recursion.
- The old `builders` are now deprecated, and print a warning when
  evaluated
- `withOptoinalFns` was introduced to merge the optional attrs into the
  final lib.
2024-09-13 19:05:26 +01:00
Matt Sturgeon
123a55ed6f
tests: remove special treatment of module
Since we no longer need to extract `tests.dontRun` from an attrset, we
no longer need the "special" `module` attr.
2024-08-20 01:07:21 +01:00
Austin Horstman
00f32f0430
tests/lua-loader: builtins.match -> lib.hasInfix
Getting invalid regex expression on darwin.
2024-08-16 08:55:38 -05:00
Matt Sturgeon
3d1224a039
tests/modules/output: remove IFD 2024-08-04 00:13:12 +01:00
Stanislav Asunkin
9314cd46f0 modules/performance: add ability to byte compile nvim runtime directory
This commit adds `performance.byteCompileLua.nvimRuntime` toggle that,
if enabled, byte compiles all lua files in Nvim runtime directory.
2024-07-31 11:31:40 +00:00
Stanislav Asunkin
55ca9d235b modules/performance: add ability to byte compile lua plugins
This commit adds `performance.byteCompileLua.plugins` toggle that, if
enabled, byte compiles all lua files in plugins
2024-07-31 11:31:40 +00:00
Stanislav Asunkin
44849233e0 modules/performance: add ability to byte compile lua configuration files
This commit adds support for byte compiling lua configuration files.
It's enabled by default (if byte compiling is enabled at all) and can be
disabled with `performance.byteCompileLua.configs` toggle.

To implement this feature `extraFiles.<name>.finalSource` internal
read-only option is introduced. `source` option cannot be used because
it's user configurable. In order to access the values of the
`performance.byteCompileLua` options, parent config is added to
specialArgs of extraFiles submodule. Then the usages of `source` option
changed to `finalSource` in all relevant places (filesPlugin and
wrappers).

Added more helpers for various cases of byte compiling:

* `byteCompileLuaFile` byte compiles lua file
* `byteCompileLuaHook` is a setup hook that byte compiles all lua files
* `byteCompileLuaDrv` overrides derivation by adding byteCompileLuaHook
  to it

Added tests to validate that extraFiles specified by various methods are
handled correctly. Added a separate home-manager test, that is intended
to validate that extraFiles propagated to wrapper modules are correctly
byte compiled.
2024-07-31 11:31:40 +00:00
Stanislav Asunkin
17e8904992 modules/performance: add performance.byteCompileLua option
* add `performance.byteCompileLua.enable` toggle to enable or disable
  all byte compiling features
* add `performance.byteCompileLua.initLua` toggle to enable or
  disable byte compiling of init.lua
* add `writeByteCompiledLua` helper for saving byte compiled lua source
  code to the nix store
* `nixvim-print-init` utility is always pointed to uncompiled init.lua
* add tests
2024-07-31 11:31:40 +00:00
Stanislav Asunkin
6e2ec5ed02 modules/performance: add plenary filetypes directory to default pathsToLink
plenary.nvim is often pulled as a dependency of other plugins.
It has filetype definitions in `data/plenary/filetypes` directory.
Even though I don't think there are plugins using it instead of
vim.filetype, but it should be no harm to add this directory by default.
2024-07-24 16:50:50 +02:00
Stanislav Asunkin
0c32f5bda5 modules/performance: don't combine filesPlugin into plugin pack
It's expected that user may want to override some runtime files in its
own config directory. Do not combine it into plugin pack to avoid
collisions.
2024-07-24 16:50:50 +02:00
Stanislav Asunkin
e65c9590d0 modules/performance: add combinePlugins.standalonePlugins option 2024-07-24 16:50:50 +02:00
Stanislav Asunkin
d6bebcefa3 modules/performance: handle plugin configs when combining plugins 2024-07-24 16:50:50 +02:00
Stanislav Asunkin
27201addd7 modules/performance: handle optional plugins when combining plugins 2024-07-24 16:50:50 +02:00
Stanislav Asunkin
f900dcd6aa modules/performance: handle python3 dependencies when combining plugins 2024-07-24 16:50:50 +02:00
Stanislav Asunkin
fdb3950c59 modules/performance: add an option to combine plugins to a single plugin pack 2024-07-24 16:50:50 +02:00
Stanislav Asunkin
299d0406bb modules/output: refactor config generation
The motivation for this change was to avoid generating empty
config sections like

    vim.cmd([[

    ]])

To make a config generation cleaner several helper functions introduced:

* `hasContent` have been moved to helpers
* `concatNonEmptyLines` joins strings (which has content) separated with
  newlines
* `wrapVimscriptForLua` wraps a lua string for using in Vimscript, but
  only if the string has content, otherwise empty string is returned
* `wrapLuaForVimscript` wraps Vimscript for using in lua, but only if
  the string has content, otherwise empty string is returned

Added tests:

* testing that all possible config sections are present in the final
  generated config
* testing that the config files generated by empty `files` definitions
  don't have any content in it
2024-07-22 23:18:53 +02:00
Stanislav Asunkin
34aa3e00e7 modules/filetype: ensure that the module does not set empty settings
When setting any filetype suboption to null (or anything else guarded by
mkIf) it's value becomes:

    { extension = null; filename = null; pattern = null; }

Account for that case in mkIf condition so that the option would not
produce empty filetype definition.
2024-07-22 11:33:52 +03:00
Stanislav Asunkin
8eb5763bbb modules/lua-loader: make enable option nullable
This avoids having the option always "defined".

This also avoids luaLoader configuration in extra files by default.
Earlier `vim.loader.disable()` was always added to configs produced
by `files` option, effectively disabling luaLoader even if it was
explicitly enabled in a top-level configuration.
2024-07-21 17:11:50 +03:00
Stanislav Asunkin
c9a6912be5 modules/files: fix creating configs of vim type 2024-07-19 14:45:34 +03:00
Matt Sturgeon
086873bed9
modules: refactor extraFiles
Moved `extraFiles` from `modules/output.nix` into its own file `modules/files.nix`.

Users should now assign text to a `text` attribute, however they could
also assign a file path to a `source` attribute instead.

The old method of directly assigning a string still works, and is
coerced to the new type along with a deprecation warning.
2024-07-07 16:42:47 +01:00
Stanislav Asunkin
6674dea840 modules/output: fix extraLuaPackages 2024-07-06 20:44:43 +00:00
Gaetan Lepage
4e224d27ae modules/diagnostics: add test 2024-06-21 16:10:27 +02:00
Gaetan Lepage
4175fac0ea keymaps: remove remaining usages of deprecated lua option 2024-05-27 14:57:40 +02:00
Nick Hu
1c9f2a23a6 modules/commands: allow commands to be raw lua 2024-05-21 14:27:49 +02:00
Nick Hu
3ec6dff17b modules/commands: fix nargs enum 2024-05-21 14:27:49 +02:00
traxys
62f32bfc71 treewide: Reformat with nixfmt 2024-05-05 22:00:40 +02:00
Gaetan Lepage
c706207007 tests: fix occurences of deprecated "options" option 2024-03-30 14:21:21 +01:00
Matt Sturgeon
4f83bcf290
Rename options to avoid confusion with module options (#1324) 2024-03-29 21:58:44 +01:00
Bodleum
303b9ca2c0
Keymaps: Add keymapsOnEvent to load keymap on specified events (#1260) 2024-03-18 20:41:12 +01:00
Austin Horstman
30bc345dee modules/highlights: add highlightOverride 2024-02-11 19:53:16 +01:00
Gaetan Lepage
97eed79568 modules/keymaps: allow action.__raw 2024-02-03 12:42:05 +01:00
Gaetan Lepage
c97afcbf82 modules/commands: fix lua cmd.options value when no options are set 2024-01-20 14:48:59 +01:00
Gaetan Lepage
5ae4714e80 helpers/highlight: Add rawType support for string options in the highlight type 2024-01-17 15:03:54 +01:00
Gaetan Lepage
02149dbb01 modules/options: add localOptions and globalOptions 2023-12-28 11:52:46 +01:00
Gaetan Lepage
48dd8d28cf modules/keymaps: deprecate maps option 2023-12-02 20:29:07 +01:00
Gaetan Lepage
418bf5da17 modules/keymaps: factor out helper functions for use in plugins 2023-10-03 14:18:33 +02:00
Gaetan Lepage
dd6a114e52 plugins/misc: adapt to new maps options 2023-10-02 15:23:54 +02:00
Gaetan Lepage
574fb73258 modules/keymaps: refactor + new syntax 2023-10-02 15:23:54 +02:00
Gaetan Lepage
9e448b7ff0 tests: allow test cases to use the nixvim helpers (for testing them) 2023-09-27 10:48:13 +02:00
Pedro Alves
74bd7ee77e
modules/commands: allow creation of user commands (#366) 2023-05-23 14:30:30 +02:00
Gaétan Lepage
73e8649b20
modules/clipboard: add new module to manage clipboard option and provider (#346) 2023-04-24 10:38:57 +02:00