programs.neovim: Add initExtra option (2)#2391
programs.neovim: Add initExtra option (2)#2391viniciusmuller wants to merge 1 commit intonix-community:masterfrom
Conversation
2b730bc to
b7c8473
Compare
|
With neovim we have people writing their config in lua/fennel/teal; I would like to supporting these approaches in neovim. This means we may have to modify the option aftwards. @berbiche I'll let you handle the reviews. |
b7c8473 to
b90d5ed
Compare
I always assumed that the easiest solution to this in the future would be to add an option specifying the output filetype. We can reuse the existing This possibly gets a little more complicated if you could have both an |
May we discuss this design decision here? It would be nice as I'm as interested in the |
|
I would be happy for someone to take on this but we should agree on the design first.
As for the initExtra, someone mentioned putting its initExtra as a fake plugin. Looks like an interesting workaround. I am scared to add something to complex for users and/or to maintain. At the same time as someone with a complex hybrid lua/viml config (and looking forward to add some fennel), I would still like to make it possible for advanced users. |
| } // optionalAttrs (cfg.initExtra != "") { | ||
| beforePlugins = '' | ||
| " Generated by Home Manager | ||
| ${cfg.initExtra} |
There was a problem hiding this comment.
Indented here, but not in the test case?
|
I was bitten by this issue after Could we have this PR merged and backport to |
For now I work around the same Issue by prepanding the first plugins configuration with my nvimrc. E.g. |
If we drop the the |
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
|
Is this still on the table? |
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
Thank you for sharing your answer, it saved me a lot of time. Where preppend_config will load the core, and append_config will take care of the plugins at the end. However, this feels quite convoluted. would it be possible for you to please reconsider the initExtra option? I really consider it an option that carries enough value to create it! Anyway, thank you and best regards! |
|
FWIW, I use this almost trivial patch. If someone wants to neaten it up (change the name to something more descriptive than diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix
index df4b487d..28abf1e0 100644
--- a/modules/programs/neovim.nix
+++ b/modules/programs/neovim.nix
@@ -98,6 +98,14 @@ in {
programs.neovim = {
enable = mkEnableOption "Neovim";
+ initExtra = mkOption {
+ type = types.path;
+ default = null;
+ description = ''
+ Configuration to insert at the top of <filename>$XDG_CONFIG_HOME/nvim/init.vim</filename>
+ '';
+ };
+
viAlias = mkOption {
type = types.bool;
default = false;
@@ -401,6 +409,8 @@ in {
(map (x: x.runtime) pluginsNormalized) ++ [{
"nvim/init.lua" = let
luaRcContent =
+ lib.optionalString (cfg.initExtra != null)
+ "vim.cmd [[source ${cfg.initExtra}]]\n" +
lib.optionalString (neovimConfig.neovimRcContent != "")
"vim.cmd [[source ${
pkgs.writeText "nvim-init-home-manager.vim" |
|
Why not |
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
|
@ncfavier because |
| @@ -1,3 +1,7 @@ | |||
| " generated by Home Manager | |||
| set nocompatible | |||
There was a problem hiding this comment.
neovim sets nocompatible by default so it shoulkd not appear
|
ideally nixpkgs' code should be rewritten with the nixos module so that we dont have to create extra options and can just do mkBefore/mkAfter. I am counting on NixOS/nixpkgs#237425 to make overrides easier too. |
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
|
dont update this PR yet, there is another approach I would like to take now that most of it is merged in nixpkgs. |
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
* hard-code mapleader for now until nix-community/home-manager#2391 is resolved
|
@teto Any updates here? |
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
|
this will become obsolete once #5964 gets merged (after the 24.11 release) |
* hard-code mapleader for now until nix-community/home-manager#2391 is resolved
Description
The last PR was truly messy (#2244) so I've closed it and I'm opening a new one now.
Checklist
Change is backwards compatible.
Code formatted with
./format.Code tested through
nix-shell --pure tests -A run.all.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Added myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS.ping @berbiche