nix/modules/stuff/vim.nix

67 lines
1.8 KiB
Nix
Raw Normal View History

2024-08-01 21:22:47 +02:00
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.vim;
user = config.chuj.system.user;
in {
options.chuj.stuff.vim = {
enable = mkEnableOption "vim";
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.vim ];
home-manager.users.${user} = {
home.sessionVariables = { "EDITOR" = "vim"; };
# fixme: not .vim
home.file = { ".vim/colors/darcula.vim".source = ../../files/darcula.vim; };
programs.vim = {
enable = true;
defaultEditor = true;
plugins = [
pkgs.vimPlugins.indentLine
pkgs.vimPlugins.vim-gitgutter
];
settings = let
vimCache = "${config.home-manager.users.${user}.xdg.cacheHome}/vim";
in {
background = "dark";
backupdir = [ "${vimCache}/backup/" ];
copyindent = false;
directory = [ "${vimCache}/swap/" ];
expandtab = true;
hidden = false;
history = 420;
ignorecase = false;
modeline = true;
mouse = "a";
mousefocus = false;
mousehide = false;
mousemodel = "popup_setpos";
number = true;
relativenumber = true;
shiftwidth = 4;
smartcase = false;
tabstop = 4;
undodir = [ "${vimCache}/undo/" ];
undofile = false;
};
extraConfig = ''
set updatetime=100
set signcolumn=yes
set termguicolors
set cursorline
colorscheme darcula
let g:indentLine_char = ''
let g:c_no_ansi = 1
let g:c_functions = 1
let g:c_no_c99 = 1
let g:c_no_bsd = 1
let g:c_no_c11 = 1
let g:c_gnu = 1
'';
};
};
programs.nano.enable = false;
};
}