Skip to content
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

Use zed for VISUAL editor in both NixOS and macOS #772

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/zed/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"toml": true,
"lua": true,
"basher": true,
"base16": true
"base16": true,
"iceberg": true
}
}
1 change: 0 additions & 1 deletion home-manager/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
# Do NOT set GIT_EDITOR, it overrides `core.editor` in git config
# https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference
EDITOR = lib.getExe pkgs.helix;
VISUAL = lib.getExe pkgs.helix; # vscode is heavy even if in VISUAL use
PAGER = "less";

# https://github.com/sharkdp/bat/blob/v0.24.0/README.md?plain=1#L201-L219
Expand Down
9 changes: 9 additions & 0 deletions home-manager/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
# https://github.com/nix-community/home-manager/issues/414#issuecomment-427163925
lib.mkMerge [
(lib.mkIf pkgs.stdenv.isDarwin {
home = {
sessionVariables = {
# * Do not specify Nix store path for zed in macOS
# https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219
# * `cli: install` action installs into this path in macOS
VISUAL = "/usr/local/bin/zed --wait";
};
};

# https://github.com/NixOS/nixpkgs/issues/240819#issuecomment-1616760598
# https://github.com/midchildan/dotfiles/blob/fae87a3ef327c23031d8081333678f9472e4c0ed/nix/home/modules/gnupg/default.nix#L38
xdg.dataFile."gnupg/gpg-agent.conf".text = ''
Expand Down
4 changes: 4 additions & 0 deletions home-manager/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,8 @@ with pkgs;

source-han-code-jp # Includes many definitions, useful for fallback
inconsolata

# Don't add zed in macOS with nixpkgs
# https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219
# edge-pkgs.zed-editor
])
4 changes: 3 additions & 1 deletion nixos/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

EDITOR = lib.getExe pkgs.helix;
SYSTEMD_EDITOR = lib.getExe pkgs.helix;
VISUAL = lib.getExe pkgs.helix;
VISUAL = "${lib.getExe edge-pkgs.zed-editor} --wait";
};

# List packages installed in system profile. To search, run:
Expand Down Expand Up @@ -204,6 +204,8 @@

## Unfree packages

# TODO: Consider using vscodium again
# TODO: Consider to drop the unuseful vscode until fixed the Wayland problems
(edge-pkgs.vscode.override (prev: {
# https://wiki.archlinux.org/title/Wayland#Electron
# https://github.com/NixOS/nixpkgs/blob/3f8b7310913d9e4805b7e20b2beabb27e333b31f/pkgs/applications/editors/vscode/generic.nix#L207-L214
Expand Down