modules/vim: init vim options

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-13 14:30:59 +03:00
parent 8495dc730f
commit b2fa93c305
Signed by: pleshevskiy
GPG Key ID: 17041163DA10A9A2
4 changed files with 4236 additions and 13 deletions

View File

@ -38,7 +38,7 @@ in
# Global Opts # Global Opts
(flip mapAttrsToList config.vim.g (k: set "vim.g.${k}")) (flip mapAttrsToList config.vim.g (k: set "vim.g.${k}"))
# Opts # Opts
(flip mapAttrsToList config.vim.opt (k: set "vim.opt.${k}")) (flip mapAttrsToList config.vim.opt (k: v: if v == null then null else set "vim.opt.${k}" v))
# Plugins # Plugins
(map (v: v.genConfig) (filter (v: v.enable) (attrValues config.plugin))) (map (v: v.genConfig) (filter (v: v.enable) (attrValues config.plugin)))
# Cmd # Cmd

View File

@ -7,7 +7,7 @@ in
vim.opt = { vim.opt = {
# Better Unix support # Better Unix support
viewoptions = lib.mkDefault [ "folds" "options" "cursor" "unix" "slash" ]; viewoptions = lib.mkDefault [ "folds" "options" "cursor" "unix" "slash" ];
encoding = lib.mkDefault "utf-8"; fileencoding = lib.mkDefault "utf-8";
# Enable 24-bit color # Enable 24-bit color
termguicolors = lib.mkDefault true; termguicolors = lib.mkDefault true;

4232
modules/vim/options.nix Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +1,13 @@
{ config, lib, ... }: { config, lib, ... }:
let options = import ./options.nix { inherit lib; }; in
{ {
options.vim = with lib; with types; { options.vim = with lib; with types; {
g = mkOption { g = mkOption {
type = attrsOf (oneOf [ str bool number ]); type = attrsOf (oneOf [ str bool number ]);
default = { }; default = { };
}; };
opt = mkOption { opt = options.all;
type = attrsOf anything;
default = { };
description = ''
A special interface |vim.opt| exists for conveniently interacting with list-
and map-style option from Lua: It allows accessing them as Lua tables and
offers object-oriented method for adding and removing entries.
`:help vim.opt`
'';
};
# TODO: think more about vim.cmd # TODO: think more about vim.cmd
namedCmd = mkOption { namedCmd = mkOption {