voidconf/modules/vim.nix
2025-04-18 09:37:57 +02:00

71 lines
1.6 KiB
Nix

{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.voidconf.vim;
in
{
options.voidconf.vim = {
enable = mkEnableOption "Enables opinionated vim configuration";
enableNvim = mkEnableOption "Enables neovim and alias";
setEnvVar = mkOption {
type = types.bool;
default = true;
description = ''
Set 'vim' as $EDITOR
'';
};
};
config = mkIf cfg.enable {
programs.nano.enable = false;
environment = {
variables = mkIf cfg.setEnvVar { EDITOR = "vim"; };
systemPackages = with pkgs; [
(mkIf cfg.enableNvim (neovim.override { vimAlias = true; }))
((vim_configurable.override { }).customize {
name = "vim";
vimrcConfig = {
packages.myplugs = with pkgs.vimPlugins; {
start = [ vim-nix ];
opt = [ ];
};
customRC = ''
syntax on
set nocompatible
set ignorecase
set hlsearch
set incsearch
set autoindent
set smartindent
set wildmenu
set expandtab
set shiftwidth=4
set tabstop=4
set number
set relativenumber
set mouse=
set listchars=tab:\ ,trail:·
set list
set scrolloff=3
set notimeout
set backspace=2
au FileType nix setlocal shiftwidth=2 tabstop=2 expandtab
au FileType haskell,tex setlocal shiftwidth=4 tabstop=4 expandtab
'';
};
})
];
};
};
}