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
(flip mapAttrsToList config.vim.g (k: set "vim.g.${k}"))
# 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
(map (v: v.genConfig) (filter (v: v.enable) (attrValues config.plugin)))
# Cmd

View file

@ -7,7 +7,7 @@ in
vim.opt = {
# Better Unix support
viewoptions = lib.mkDefault [ "folds" "options" "cursor" "unix" "slash" ];
encoding = lib.mkDefault "utf-8";
fileencoding = lib.mkDefault "utf-8";
# Enable 24-bit color
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, ... }:
let options = import ./options.nix { inherit lib; }; in
{
options.vim = with lib; with types; {
g = mkOption {
type = attrsOf (oneOf [ str bool number ]);
default = { };
};
opt = mkOption {
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`
'';
};
opt = options.all;
# TODO: think more about vim.cmd
namedCmd = mkOption {