-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
zsh: refactor zsh configuration for better order control over .zshrc
#6479
base: master
Are you sure you want to change the base?
Conversation
394b2d9
to
315ce87
Compare
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.
this is getting out of hand. We would have
initExtraBeforeCompInit
initExtraLast
initExtra
. I suggest you split all the additions to zshrc with various mkOrder
so one can insert his code wherever he wants
initContents
option for custom .zshrc
content insertion
5879b08
to
472e79e
Compare
thanks for taking on this huge work. I am quite looking forward to it. |
776daea
to
f1fdc33
Compare
initContents
option for custom .zshrc
content insertion.zshrc
on a quick glance it looks fine by me. I have follow up ideas but merging this first is better, it's the hardest part. diffing my ~/.zshrc with and without this just shows a few different newlines which is fine. I would like to let this cook a few days to give the opportunity for users with different zsh setups test this since it's a "dangerous" change :) |
sry I intended to merge than noticed about the lib.mkForce issue. You will have to rebase sorry but I will try to merge it fast after that. Could you maybe mention in the description of |
Should I need to switch back to the previous version?
Sure, I will add examples and descriptions about this. |
Will be nice to help with an issue #6572 Currently, we are inserting into |
@Emin017 I apologize for my bad advice, yes please restore the |
I am not a fan of modules/misc/news.nix in general but this change is worth adding to it as well. |
2a9165b
to
b5f8c61
Compare
zshrc-contents-insert = ./zshrc-contents-insert.nix; | ||
zshrc-contents-insert-before = ./zshrc-contents-insert-before.nix; | ||
zshrc-contents-insert-after = ./zshrc-contents-insert-after.nix; |
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.
I don't think it's worth the extra CI time for these tests, in their current state. It would be better to have a single test that adds to the initContent with different priorities and verifying they are generated in the expected order.
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.
I merged them into a single priorities test in the new commit.
Add a new option called `initExtraLast` to the zsh module. This option allows users to specify shell script code that will be executed as the last step during interactive zsh shell initialization. Signed-off-by: Qiming Chu <[email protected]>
b5f8c61
to
9599c74
Compare
- Users can add content anywhere by using `lib.mkOrder`, `lib.mkBefore` and `lib.mkAfter` custom configurations. - Add test cases to verify the insertion of content before and after existing configurations in `.zshrc`. Signed-off-by: Qiming Chu <[email protected]>
Signed-off-by: Qiming Chu <[email protected]>
Signed-off-by: Qiming Chu <[email protected]>
9599c74
to
f8c1c62
Compare
Description
zsh.nix
to usemkMerge
andmkOrder
for better control over.zshrc
content orderinglib.mkOrder
,lib.mkBefore
andlib.mkAfter
custom configurationszshrc-contents-insert.nix
,zshrc-contents-insert-before.nix
,zshrc-contents-insert-after.nix
andzshrc-contents-init-zprof.nix
) to verify the behavior ofinitExtra
withmkBefore
,mkAfter
, and default insertion.Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
or
nix build --reference-lock-file flake.lock ./tests#test-all
using Flakes.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
Maintainer CC