-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
wrap neovim but without its configuration file #101265
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
Conversation
cc @timokau (just tell me if I should stop nagging you :p ) |
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.
No worries, I'm glad somebody with the necessary know-how is improving the infrastructure :) Generally looks good to me, I haven't tried to understand every detail though.
Here I've provided an home-manager example on how to use it to generate ~/.config/nvim/init.vim https://github.com/teto/home-manager/blob/8509c5821acc2cb5c83d65af68dc7c74579700ee/modules/programs/neovim.nix#L260 . Next step (in other PRs) would be to replace the opaque |
I'm not sure if that is what you mean, but it would be really neat if it was possible to specify both the plugins and the related vimrc snippets (to be executed pre/post load) in the same place. This is what I currently do (I think its partly broken and assumes everything is loaded at startup though): |
Yes the goal is to be able to specify the kind of config you have. |
Maybe @doronbehar you could test that it doesn't break your config ? (just a rebuild). I sense you may have an advanced configuration :) |
Haven't done a full review or a test, but I am on the imperative side of these kind of configurations, so my nix Neovim config is not that complicated: |
Endgoal is to be able to more easily generate per project neovim (with python config for a python project etc). Also one desirable feature is to be able to wrap neovim without the `-u` command: for instance home-manager could thus write the config in the expected $XDG_CONFIG_HOME/nvim/init.vim and neovim works as expected with .exrc / MYVIMRC (features that `-u` interferes with).
to preserve backwards compatibility while introducing a lower level wrapper called wrapperNeovim2. This gives more possibilities to the caller.
thanks to the review, it's in much better shape. I fixed the manifest issue. From my point of view it's ready to be squashed and merged notwithstanding CI. It should be fully equivalent to the current state. Once that's merged, it will be easier to improve plugin support. |
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.
Looks good to me. Just some comments on the exact "unstable" semantics to address or not, based on your judgement and plans.
Alright, then 🚀? |
next step will be to map some config with a plugin. I would like to make it easy to merge configs. |
@teto This broke with import ./. {};
neovim.override {
configure = {
packages.nix.start = with vimPlugins; [ ale deoplete-nvim ];
customRC = ''
echoe "Hello World!"
'';
};
} |
my bad will try to fix it by tomorrow. |
@LnL7 to be honest, I had not thought of the override usecase, especially to modify the customRC part. I think it's fair to break the override scenario which is more a hacker-like scenario IMO (hoping it doesn't break for too many people). Would you mind using Also this broke home-manager in some cases (doubly so since I messed up the lib.warn call to explain wrapper arguments should now be a list instead of a string an array :s Since it's not a super useful change I will revert wrap arguments to be a string again). nix-community/home-manager#1577 |
@teto I'm not particularly opposed to changing it but it's not something that should be changed without warning. The snipped I showed is what's documented in various places like the the nixpkgs manual, wiki, etc... and thus will be the way almost everybody configures it currently. Given that most of the references and usages are outside of nixpkgs I consider this part of the api that should go through a deprecation cycle if it's changed. |
oh shit you are right ! didn't realize this was the |
the compatibility layer for `wrapNeovim` introduced in NixOS#101265 broke the recommended way of configuration: https://nixos.org/manual/nixpkgs/stable/#custom-configuration https://nixos.wiki/wiki/Vim#Customizations restore the old ways.
@teto seems like nodejs plugin is broken now, my overlay enables nodejs and disables ruby:
I get opposite effect, bin contains ruby host prog but no nodejs
|
ok I will look into it in a few hours. |
@kalekseev I've submitted a fix. I am glad unstable is blocked for now :| maybe I would need to write some tests before further refactoring but maybe after the 0.5 release. So much to do till then. |
Users of the home-manager neovim module are also broken by this. |
@jonringer shouldnt' be the cae on master anmore (I have yet to check vimAlias but should be fixed too). |
When I originally rebased my other PR, it was before your build fixes. aliases do need to be fixed
I just developed a muscle memory around tryping vim, and a lot of my "aliases" were written in mind with this. |
module configuration was broken in NixOS/nixpkgs#101265
honestly, i think this should all be reverted, and continued in another branch. EDIT: This has evolved over several years, and many users consume this in non-obvious ways. There's a nixos module, home-manager module, and wiki's which have code in which this does not play well with these changes. At the very least, move this over to a different top-level attr, and allow some people some time to migrate over to the "new API" with some deprecation process similar to @LnL7 was saying. |
I've tried before to do it out of tree but 1/ it was hard to maintain. 2/ It means I would drop a huge patch. I've written both the home-manager and nixos modules. My endgoal is to make it possible to generate vim configs and write them anywhere (init.vim / .nvimrc) without the drawbacks of using The goal with this PR is to make this work easier to maintain while not impacting users via a thin legacy wrapper. I kinda messed up the compatibility layer but now all should be fine. Lucky us I could fix those before it reached nixos-unstable. |
Motivation for this change
Follow up of #101100.
Wrapping the init.vim has some sideeffects #55376 .
This PR allows to call wrapNeovim without wrapping its configuration file. Makes sense for home-manager where it can just drop the init.vim in the correct position (also for hackers who would prefer
--cmd "source generatedinit.vim
instead of the current-u generatedinit.vim
.I've tried to make commits valid on their own but if we agree on the architecture I can squash them:
I haven't thoroughly tested the part with the manifest generation.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)