mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-12-28 05:32:23 +00:00
Compare commits
4 commits
81a05c4afc
...
94babc509d
Author | SHA1 | Date | |
---|---|---|---|
94babc509d | |||
b347757f8a | |||
99de583e21 | |||
2c9202a48b |
2 changed files with 143 additions and 95 deletions
12
flake.lock
12
flake.lock
|
@ -69,11 +69,11 @@
|
||||||
},
|
},
|
||||||
"mnw": {
|
"mnw": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1724456641,
|
"lastModified": 1726188505,
|
||||||
"narHash": "sha256-SMgnviF6ofBPbyV3+rljPGcX0Hn9HBOhgXE10Cyjaic=",
|
"narHash": "sha256-3dkxJo6y/aKfwkAg6YnpdiQAoZKgHhWHz7ilGJHCoVU=",
|
||||||
"owner": "Gerg-L",
|
"owner": "Gerg-L",
|
||||||
"repo": "mnw",
|
"repo": "mnw",
|
||||||
"rev": "c261925dbbf02f523af0e8add844df64fddf0359",
|
"rev": "ea00b3d2162d85dd085a6ba6d49aa2a186e588e7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -129,11 +129,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1724395761,
|
"lastModified": 1726142289,
|
||||||
"narHash": "sha256-zRkDV/nbrnp3Y8oCADf5ETl1sDrdmAW6/bBVJ8EbIdQ=",
|
"narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ae815cee91b417be55d43781eb4b73ae1ecc396c",
|
"rev": "280db3decab4cbeb22a4599bd472229ab74d25e1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.strings) optionalString;
|
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.dag) entryAfter;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject mkLuaInline;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
in {
|
in {
|
||||||
|
@ -158,112 +159,159 @@ 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.
|
||||||
|
|
||||||
|
::: {.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 = {
|
||||||
-- Settings that are set for everything
|
vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
||||||
vim.o.encoding = "utf-8"
|
-- Settings that are set for everything
|
||||||
vim.o.hidden = true
|
vim.o.encoding = "utf-8"
|
||||||
vim.opt.shortmess:append("c")
|
vim.o.hidden = true
|
||||||
vim.o.expandtab = true
|
vim.opt.shortmess:append("c")
|
||||||
vim.o.mouse = ${toLuaObject cfg.mouseSupport}
|
vim.o.expandtab = true
|
||||||
vim.o.tabstop = ${toLuaObject cfg.tabWidth}
|
vim.o.mouse = ${toLuaObject cfg.mouseSupport}
|
||||||
vim.o.shiftwidth = ${toLuaObject cfg.tabWidth}
|
vim.o.tabstop = ${toLuaObject cfg.tabWidth}
|
||||||
vim.o.softtabstop = ${toLuaObject cfg.tabWidth}
|
vim.o.shiftwidth = ${toLuaObject cfg.tabWidth}
|
||||||
vim.o.cmdheight = ${toLuaObject cfg.cmdHeight}
|
vim.o.softtabstop = ${toLuaObject cfg.tabWidth}
|
||||||
vim.o.updatetime = ${toLuaObject cfg.updateTime}
|
vim.o.cmdheight = ${toLuaObject cfg.cmdHeight}
|
||||||
vim.o.tm = ${toLuaObject cfg.mapTimeout}
|
vim.o.updatetime = ${toLuaObject cfg.updateTime}
|
||||||
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
|
vim.o.tm = ${toLuaObject cfg.mapTimeout}
|
||||||
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
|
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
|
||||||
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
|
||||||
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
||||||
|
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
||||||
|
|
||||||
${optionalString cfg.splitBelow ''
|
${optionalString cfg.undoFile.enable ''
|
||||||
vim.o.splitbelow = true
|
vim.o.undofile = true
|
||||||
''}
|
vim.o.undodir = ${toLuaObject cfg.undoFile.path}
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString cfg.splitRight ''
|
${optionalString cfg.splitBelow ''
|
||||||
vim.o.splitright = true
|
vim.o.splitbelow = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.showSignColumn ''
|
${optionalString cfg.splitRight ''
|
||||||
vim.o.signcolumn = "yes"
|
vim.o.splitright = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.autoIndent ''
|
${optionalString cfg.showSignColumn ''
|
||||||
vim.o.autoindent = true
|
vim.o.signcolumn = "yes"
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.preventJunkFiles ''
|
${optionalString cfg.autoIndent ''
|
||||||
vim.o.swapfile = false
|
vim.o.autoindent = true
|
||||||
vim.o.backup = false
|
''}
|
||||||
vim.o.writebackup = false
|
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString (cfg.bell == "none") ''
|
${optionalString cfg.preventJunkFiles ''
|
||||||
vim.o.errorbells = false
|
vim.o.swapfile = false
|
||||||
vim.o.visualbell = false
|
vim.o.backup = false
|
||||||
''}
|
vim.o.writebackup = false
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.bell == "on") ''
|
${optionalString (cfg.bell == "none") ''
|
||||||
vim.o.visualbell = false
|
vim.o.errorbells = false
|
||||||
''}
|
vim.o.visualbell = false
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.bell == "visual") ''
|
${optionalString (cfg.bell == "on") ''
|
||||||
vim.o.errorbells = false
|
vim.o.visualbell = false
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.lineNumberMode == "relative") ''
|
${optionalString (cfg.bell == "visual") ''
|
||||||
vim.o.relativenumber = true
|
vim.o.errorbells = false
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.lineNumberMode == "number") ''
|
${optionalString (cfg.lineNumberMode == "relative") ''
|
||||||
vim.o.number = true
|
vim.o.relativenumber = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.lineNumberMode == "relNumber") ''
|
${optionalString (cfg.lineNumberMode == "number") ''
|
||||||
vim.o.number = true
|
vim.o.number = true
|
||||||
vim.o.relativenumber = true
|
''}
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString cfg.useSystemClipboard ''
|
${optionalString (cfg.lineNumberMode == "relNumber") ''
|
||||||
vim.opt.clipboard:append("unnamedplus")
|
vim.o.number = true
|
||||||
''}
|
vim.o.relativenumber = true
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString cfg.syntaxHighlighting ''
|
${optionalString cfg.useSystemClipboard ''
|
||||||
vim.cmd("syntax on")
|
vim.opt.clipboard:append("unnamedplus")
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (!cfg.wordWrap) ''
|
${optionalString cfg.syntaxHighlighting ''
|
||||||
vim.o.wrap = false
|
vim.cmd("syntax on")
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.hideSearchHighlight ''
|
${optionalString (!cfg.wordWrap) ''
|
||||||
vim.o.hlsearch = false
|
vim.o.wrap = false
|
||||||
vim.o.incsearch = true
|
''}
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString cfg.colourTerm ''
|
${optionalString cfg.hideSearchHighlight ''
|
||||||
vim.o.termguicolors = true
|
vim.o.hlsearch = false
|
||||||
''}
|
vim.o.incsearch = true
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString (!cfg.enableEditorconfig) ''
|
${optionalString cfg.colourTerm ''
|
||||||
vim.g.editorconfig = false
|
vim.o.termguicolors = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.searchCase == "ignore") ''
|
${optionalString (!cfg.enableEditorconfig) ''
|
||||||
vim.o.smartcase = false
|
vim.g.editorconfig = false
|
||||||
vim.o.ignorecase = true
|
''}
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString (cfg.searchCase == "smart") ''
|
${optionalString (cfg.searchCase == "ignore") ''
|
||||||
vim.o.smartcase = true
|
vim.o.smartcase = false
|
||||||
vim.o.ignorecase = true
|
vim.o.ignorecase = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.searchCase == "sensitive") ''
|
${optionalString (cfg.searchCase == "smart") ''
|
||||||
vim.o.smartcase = false
|
vim.o.smartcase = true
|
||||||
vim.o.ignorecase = false
|
vim.o.ignorecase = true
|
||||||
''}
|
''}
|
||||||
'';
|
|
||||||
|
${optionalString (cfg.searchCase == "sensitive") ''
|
||||||
|
vim.o.smartcase = false
|
||||||
|
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.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue