2024-04-20 09:42:06 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2022-04-28 19:11:33 -04:00
|
|
|
|
2022-11-29 20:40:15 -07:00
|
|
|
let
|
2022-04-28 19:11:33 -04:00
|
|
|
|
2022-11-29 20:40:15 -07:00
|
|
|
neovim = import ./package {
|
|
|
|
inherit pkgs;
|
2023-04-15 18:38:03 -04:00
|
|
|
colors = config.theme.colors;
|
2023-11-05 20:40:18 -05:00
|
|
|
terraform = config.terraform.enable;
|
|
|
|
github = true;
|
|
|
|
kubernetes = config.kubernetes.enable;
|
2022-11-29 20:40:15 -07:00
|
|
|
};
|
2024-04-20 09:42:06 -04:00
|
|
|
in
|
|
|
|
{
|
2022-11-29 20:40:15 -07:00
|
|
|
|
2022-12-21 14:18:03 -07:00
|
|
|
options.neovim.enable = lib.mkEnableOption "Neovim.";
|
2022-11-29 20:40:15 -07:00
|
|
|
|
2022-12-21 14:18:03 -07:00
|
|
|
config = lib.mkIf config.neovim.enable {
|
|
|
|
home-manager.users.${config.user} =
|
2022-11-29 20:40:15 -07:00
|
|
|
|
2022-12-21 14:18:03 -07:00
|
|
|
{
|
2022-11-29 20:40:15 -07:00
|
|
|
|
2022-12-21 14:18:03 -07:00
|
|
|
home.packages = [ neovim ];
|
|
|
|
|
2023-07-30 20:26:23 -04:00
|
|
|
# Use Neovim as the editor for git commit messages
|
2022-12-21 14:18:03 -07:00
|
|
|
programs.git.extraConfig.core.editor = "nvim";
|
2023-08-06 16:37:53 -04:00
|
|
|
programs.jujutsu.settings.ui.editor = "nvim";
|
2023-07-30 20:26:23 -04:00
|
|
|
|
|
|
|
# Set Neovim as the default app for text editing and manual pages
|
2022-12-21 14:18:03 -07:00
|
|
|
home.sessionVariables = {
|
|
|
|
EDITOR = "nvim";
|
|
|
|
MANPAGER = "nvim +Man!";
|
|
|
|
};
|
2023-07-30 20:26:23 -04:00
|
|
|
|
|
|
|
# Create quick aliases for launching Neovim
|
2022-12-21 14:18:03 -07:00
|
|
|
programs.fish = {
|
2024-04-20 09:42:06 -04:00
|
|
|
shellAliases = {
|
|
|
|
vim = "nvim";
|
|
|
|
};
|
2022-12-21 14:18:03 -07:00
|
|
|
shellAbbrs = {
|
|
|
|
v = lib.mkForce "nvim";
|
|
|
|
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
|
|
|
|
vll = "nvim -c 'Telescope oldfiles'";
|
|
|
|
};
|
2022-11-29 20:40:15 -07:00
|
|
|
};
|
2023-07-30 20:26:23 -04:00
|
|
|
|
|
|
|
# Create a desktop option for launching Neovim from a file manager
|
|
|
|
# (Requires launching the terminal and then executing Neovim)
|
2024-10-19 08:45:26 -04:00
|
|
|
xdg.desktopEntries.nvim = lib.mkIf (pkgs.stdenv.isLinux && config.gui.enable) {
|
2023-03-08 22:55:34 -05:00
|
|
|
name = "Neovim wrapper";
|
2024-10-12 11:57:38 -04:00
|
|
|
exec = "${config.home-manager.users.${config.user}.programs.rofi.terminal} nvim %F";
|
2024-04-20 09:42:06 -04:00
|
|
|
mimeType = [
|
|
|
|
"text/plain"
|
|
|
|
"text/markdown"
|
|
|
|
];
|
2023-03-08 22:55:34 -05:00
|
|
|
};
|
2023-04-03 21:54:53 -04:00
|
|
|
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
|
|
|
|
"text/plain" = [ "nvim.desktop" ];
|
|
|
|
"text/markdown" = [ "nvim.desktop" ];
|
2023-03-08 22:55:34 -05:00
|
|
|
};
|
2022-11-29 20:40:15 -07:00
|
|
|
};
|
2022-12-21 14:18:03 -07:00
|
|
|
};
|
2022-04-28 19:11:33 -04:00
|
|
|
}
|