{ config, lib, namespace, ... }: with lib; with lib.${namespace}; let cfg = config.${namespace}.cli.neovim; in { options.${namespace}.cli.neovim = with types; { enable = mkBoolOpt false "Whether or not to enable neovim."; }; config = mkIf cfg.enable { environment.variables.EDITOR = "nvim"; programs.nvf = { defaultEditor = true; enable = true; settings = { vim = { viAlias = true; vimAlias = true; lineNumberMode = "relNumber"; options = { tabstop = 2; shiftwidth = 2; cursorlineopt = "screenline"; }; undoFile.enable = true; keymaps = [ { key = ""; mode = [ "n" ]; action = "Neotree toggle"; desc = "Toggles neo-tree"; } { key = "g="; mode = [ "n" ]; action = "m'ggVG=''"; desc = "Reindent code"; } ]; }; }; }; }; }