diff --git a/home/editor.nix b/home/editor.nix new file mode 100644 index 00000000..6b8c185e --- /dev/null +++ b/home/editor.nix @@ -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; + }; +} diff --git a/home/fish.nix b/home/fish.nix index 6e54ca88..550368f9 100644 --- a/home/fish.nix +++ b/home/fish.nix @@ -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 { diff --git a/home/git/global.nix b/home/git/global.nix index d0088245..f2d15a7a 100644 --- a/home/git/global.nix +++ b/home/git/global.nix @@ -118,7 +118,6 @@ autocrlf = "input"; safecrlf = true; whitespace = "fix"; - editor = "nvim"; mergeoptions = "--no-ff"; preloadindex = true; ignorecase = false; diff --git a/home/home.nix b/home/home.nix index 49f7ed01..f764d882 100644 --- a/home/home.nix +++ b/home/home.nix @@ -22,6 +22,7 @@ in { ./dark-mode.nix ./default-applications.nix ./direnv.nix + ./editor.nix ./emacs.nix ./eza.nix ./firefox.nix @@ -84,6 +85,7 @@ in { # custom properties me = { + editor.name = "neovim"; atuin.enable = false; font-name = "JetBrains Mono"; font-style = "Semibold";