Skip to content

Commit

Permalink
Add editor configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed Oct 15, 2024
1 parent 0e70734 commit 0620ca6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
33 changes: 33 additions & 0 deletions home/editor.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ lib, config, ... }:
with lib;
let
cfg = config.me.editor;

binary-name = {
helix = "hx";
neovim = "nvim";
}.${cfg.name};
in
{
options.me.editor = {
name = mkOption {
type = types.enum [
"helix"
"neovim"
];
};
};

config = {
programs.fish = {
shellAliases = {
vim = binary-name;
nvim = binary-name;
};
interactiveShellInit = ''
set -x EDITOR ${binary-name}
'';
};
programs.git.extraConfig.core.editor = binary-name;
};
}
1 change: 0 additions & 1 deletion home/fish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ in {
tree = "${pkgs.eza}/bin/eza -T";
vup = "nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'";
vimdiff = "nvim -d";
vim = "nvim";
pydoc = "python -m pydoc";
}
// lib.optionalAttrs isLinux {
Expand Down
1 change: 0 additions & 1 deletion home/git/global.nix
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
autocrlf = "input";
safecrlf = true;
whitespace = "fix";
editor = "nvim";
mergeoptions = "--no-ff";
preloadindex = true;
ignorecase = false;
Expand Down
2 changes: 2 additions & 0 deletions home/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ in {
./dark-mode.nix
./default-applications.nix
./direnv.nix
./editor.nix
./emacs.nix
./eza.nix
./firefox.nix
Expand Down Expand Up @@ -84,6 +85,7 @@ in {
# custom properties
me =
{
editor.name = "neovim";
atuin.enable = false;
font-name = "JetBrains Mono";
font-style = "Semibold";
Expand Down

0 comments on commit 0620ca6

Please sign in to comment.