mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 19:11:15 +00:00
neovim/basic: add undofile options
`vim.undoFile.enable` and `vim.undoFile.path` can be used to manipulate whether undofile will be enabled, and the location if it is enabled.
This commit is contained in:
parent
c757d28ff7
commit
95728e4170
1 changed files with 116 additions and 88 deletions
|
@ -3,11 +3,13 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.types) enum bool str int;
|
inherit (lib.types) enum bool str int either;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
in {
|
in {
|
||||||
|
@ -158,9 +160,29 @@ in {
|
||||||
default = "sensitive";
|
default = "sensitive";
|
||||||
description = "Set the case sensitivity of search";
|
description = "Set the case sensitivity of search";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
undoFile = {
|
||||||
|
enable = mkEnableOption "undofile for Neovim";
|
||||||
|
path = mkOption {
|
||||||
|
type = either str luaInline;
|
||||||
|
default = mkLuaInline "vim.fn.stdpath('state') .. '/nvf/undo'";
|
||||||
|
defaultText = literalMD ''
|
||||||
|
```nix
|
||||||
|
mkLuaInline "vim.fn.stdpath('state') .. '/nvf/undo'"
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
example = literalMD ''
|
||||||
|
```nix
|
||||||
|
mkLuaInline "os.getenv('XDG_DATA_HOME') .. '/nvf/undo'"
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
description = "Path to the file in which undo history will be saved";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
config = {
|
||||||
|
vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
||||||
-- Settings that are set for everything
|
-- Settings that are set for everything
|
||||||
vim.o.encoding = "utf-8"
|
vim.o.encoding = "utf-8"
|
||||||
vim.o.hidden = true
|
vim.o.hidden = true
|
||||||
|
@ -178,6 +200,11 @@ in {
|
||||||
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
||||||
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
||||||
|
|
||||||
|
${optionalString cfg.undoFile.enable ''
|
||||||
|
vim.o.undofile = true
|
||||||
|
vim.o.undodir = ${toLuaObject cfg.undoFile.path}
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString cfg.splitBelow ''
|
${optionalString cfg.splitBelow ''
|
||||||
vim.o.splitbelow = true
|
vim.o.splitbelow = true
|
||||||
''}
|
''}
|
||||||
|
@ -266,4 +293,5 @@ in {
|
||||||
vim.o.ignorecase = false
|
vim.o.ignorecase = false
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue