Compare commits

...

4 commits

Author SHA1 Message Date
raf
94babc509d
Merge 2c9202a48b into b347757f8a 2024-09-13 16:57:59 +03:00
b347757f8a
flake: bump nixpkgs input
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Validate flake & check formatting / Validate Flake (push) Waiting to run
Validate flake & check formatting / Formatting via Alejandra (push) Waiting to run
Fixes #368
2024-09-13 12:07:46 +03:00
99de583e21
flake: bump mnw
Prioritize nvf's instance of neovim over pkgs.neovim
2024-09-13 11:59:53 +03:00
2c9202a48b
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.
2024-08-27 23:46:44 +03:00
2 changed files with 143 additions and 95 deletions

View file

@ -69,11 +69,11 @@
},
"mnw": {
"locked": {
"lastModified": 1724456641,
"narHash": "sha256-SMgnviF6ofBPbyV3+rljPGcX0Hn9HBOhgXE10Cyjaic=",
"lastModified": 1726188505,
"narHash": "sha256-3dkxJo6y/aKfwkAg6YnpdiQAoZKgHhWHz7ilGJHCoVU=",
"owner": "Gerg-L",
"repo": "mnw",
"rev": "c261925dbbf02f523af0e8add844df64fddf0359",
"rev": "ea00b3d2162d85dd085a6ba6d49aa2a186e588e7",
"type": "github"
},
"original": {
@ -129,11 +129,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1724395761,
"narHash": "sha256-zRkDV/nbrnp3Y8oCADf5ETl1sDrdmAW6/bBVJ8EbIdQ=",
"lastModified": 1726142289,
"narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ae815cee91b417be55d43781eb4b73ae1ecc396c",
"rev": "280db3decab4cbeb22a4599bd472229ab74d25e1",
"type": "github"
},
"original": {

View file

@ -3,11 +3,12 @@
lib,
...
}: let
inherit (lib.options) mkOption literalExpression;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.strings) optionalString;
inherit (lib.types) enum bool str int;
inherit (lib.types) enum bool str int nullOr either;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.lua) toLuaObject mkLuaInline;
inherit (lib.nvim.types) luaInline;
cfg = config.vim;
in {
@ -158,9 +159,39 @@ in {
default = "sensitive";
description = "Set the case sensitivity of search";
};
undoFile = {
enable = mkEnableOption ''
undofile for Neovim.
::: {.warning}
[{option}`vim.undoFile.path`](#opt-vim.undoFile.path) **must** be set to a valid
path for this option to have any effect.
:::
'';
path = mkOption {
type = nullOr (either str luaInline);
default = null;
example = "os.getenv('XDG_DATA_HOME') .. '/nvf/undo'";
description = ''
Path to the file in which undo history will be saved. Must
an absolute path in a world-writable directory such as
{file}`~/.local/share`.
::: {.tip}
You can use use variable substitution as you normally would in Neovim to
pick directories that conform with XDG spec. **nvf**, by, default creates
{file}`$XDG_DATA_HOME/nvf` - which you may choose to use for storing
state such as the undofile.
:::
'';
};
};
};
config.vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
config = {
vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
-- Settings that are set for everything
vim.o.encoding = "utf-8"
vim.o.hidden = true
@ -178,6 +209,11 @@ in {
vim.g.mapleader = ${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 ''
vim.o.splitbelow = true
''}
@ -266,4 +302,16 @@ in {
vim.o.ignorecase = false
''}
'';
assertions = [
{
assertion = cfg.undoFile.enable -> cfg.undoFile.path != null;
message = ''
`vim.undoFile.enable` is set to true, but `vim.undoFile.path` is not set
as a valid path. Please set `vim.undoFile.path` to a valid path, or disable
the undoFile feature.
'';
}
];
};
}