-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add initExtra option to neovim #2244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,11 @@ let | |
| (map (x: if x ? plugin && x.optional == true then x.plugin else null) | ||
| cfg.plugins); | ||
| }; | ||
| beforePlugins = ""; | ||
| beforePlugins = '' | ||
| " generated by Home Manager | ||
| set nocompatible | ||
| ${cfg.initExtra} | ||
| ''; | ||
| }; | ||
|
|
||
| extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [ ]) | ||
|
|
@@ -79,6 +83,14 @@ in { | |
| ''; | ||
| }; | ||
|
|
||
| initExtra = mkOption { | ||
| type = types.lines; | ||
| default = ""; | ||
| description = '' | ||
| Configuration to insert on the top of init.vim | ||
| ''; | ||
| }; | ||
|
|
||
| vimAlias = mkOption { | ||
| type = types.bool; | ||
| default = false; | ||
|
|
@@ -121,6 +133,15 @@ in { | |
| ''; | ||
| }; | ||
|
|
||
| generatedConfigViml = mkOption { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why move this ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This got accidentally moved when it got readded after deletion. |
||
| type = types.lines; | ||
| visible = true; | ||
| readOnly = true; | ||
| description = '' | ||
| Generated vimscript config. | ||
| ''; | ||
| }; | ||
|
|
||
| extraPython3Packages = mkOption { | ||
| type = with types; either extraPython3PackageType (listOf package); | ||
| default = (_: [ ]); | ||
|
|
@@ -132,15 +153,6 @@ in { | |
| ''; | ||
| }; | ||
|
|
||
| generatedConfigViml = mkOption { | ||
| type = types.lines; | ||
| visible = true; | ||
| readOnly = true; | ||
| description = '' | ||
| Generated vimscript config. | ||
| ''; | ||
| }; | ||
|
|
||
|
berbiche marked this conversation as resolved.
|
||
| package = mkOption { | ||
| type = types.package; | ||
| default = pkgs.neovim-unwrapped; | ||
|
|
@@ -289,13 +301,14 @@ in { | |
| configure.customRC -> programs.neovim.extraConfig | ||
| ''; | ||
|
|
||
| programs.neovim.generatedConfigViml = neovimConfig.neovimRcContent; | ||
|
|
||
| home.packages = [ cfg.finalPackage ]; | ||
|
|
||
| programs.neovim.generatedConfigViml = neovimConfig.neovimRcContent; | ||
|
|
||
| xdg.configFile."nvim/init.vim" = mkIf (neovimConfig.neovimRcContent != "") { | ||
| text = neovimConfig.neovimRcContent; | ||
| }; | ||
|
|
||
| xdg.configFile."nvim/coc-settings.json" = mkIf cfg.coc.enable { | ||
| source = jsonFormat.generate "coc-settings.json" cfg.coc.settings; | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want home-manager not to generate a file if nothing is configured, this goes against that. Also neovim has
set nocompatibleby default so no need to pass that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you so please provide a better and working solution? This is what I and berbiche were able to make. All the other provided solutions until now lead to nix errors or nvim config duplication, and I do not see why I should write my config trying to work around this, since it's a home-manager bug that should be fixed.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @arcticlimer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I've forgot about that PR. This PR is currently a mess (it has conflicts, I made it from the wrong branch...), do you mind if I close this and apply these changes in a new PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go ahead!