Compare commits

..

12 commits

Author SHA1 Message Date
Soliprem
55666d6b4c
Merge 8268f13bdd into 57067e85ed 2024-11-08 13:04:14 +01:00
57067e85ed flake: rename input for nvim-scrollbar 2024-11-08 10:15:23 +00:00
1b16c6b19f tabline/nvim-bufferline: remove assertion; enable nvim-web-devicons by default 2024-11-08 10:15:23 +00:00
a6bb6e1b3e modules/visuals: migrate plugins to setupOpts 2024-11-08 10:15:23 +00:00
raf
b3f51048db
Merge branch 'main' into v0.7 2024-11-08 09:33:15 +00:00
Noire
8997e62b3b
utility/precognition: init module (#437)
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-html) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-json) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-manpages) (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
* utility/precognition: init

* utility/precognition: fix priority example, add default

* utility/precognition: add files to default.nix

* utility/precognition: fix typos, manual fmt

* utility/precognition: remove useless mappings

i was going to add binds to toggle/enable/disable but ehhh
idk

* utility/precognition: fix hints option

it broke

* utility/precognition: update gutter hints, new description

* utility/precognition: add files to motion defaults

* utility/precognition: add plugin to flake

* utility/precognition: remove comment reference

oops

* utility/precognition: add precognition to maximal configuration

it does work!

* utility/precognition: update descriptions

needs docs link, desc is somewhat obscure.

* docs: add credit to release notes

* utility/precognition: format

* utility/precognition: de-linkify descriptions

* utility/precognition: no more rec

* utility/precognition: convert to setupOpts

honestly raf was cooking with this one.
it's much nicer to use compared to interpolation lol

* utility/precognition: remove unnecessary function parameter

* utility/precognition: format

* utility/precognition: add description to disabled_fts

oops

* utility/precognition: manual format

* utility/precognition: remove periods at the end of descriptions

* utility/precognition: fix configuration.nix entry

oops lol

* utility/precognition: format

* utility/precognition: expand `vim`

* precognition: consistency changes

Just my minor nits.

---------

Co-authored-by: NotAShelf <raf@notashelf.dev>
2024-11-08 09:32:02 +00:00
82c2d4bdd0
flake/packages: rename deprecated xdg_utils 2024-11-08 12:30:39 +03:00
1badee81db
flake: bump nixpkgs 2024-11-08 12:08:12 +03:00
383924d225
meta: update release info 2024-11-07 11:12:38 +03:00
81eda5b340
neovim/spellcheck: add autogroup to spellcheck fts autocmd; fix vim-dirtytalk 2024-11-06 19:33:08 +03:00
f429379e34
docs: update release notes 2024-11-06 19:33:06 +03:00
688bb8d9ba
spellcheck: allow adding arbitrary spellfiles from name-value pairs 2024-11-06 19:32:58 +03:00
40 changed files with 967 additions and 455 deletions

View file

@ -78,20 +78,17 @@ isMaximal: {
};
visuals = {
enable = true;
nvimWebDevicons.enable = true;
scrollBar.enable = isMaximal;
smoothScroll.enable = true;
cellularAutomaton.enable = false;
nvim-scrollbar.enable = isMaximal;
nvim-web-devicons.enable = true;
nvim-cursorline.enable = true;
cinnamon-nvim.enable = true;
fidget-nvim.enable = true;
highlight-undo.enable = true;
indent-blankline.enable = true;
indentBlankline.enable = true;
cursorline = {
enable = true;
lineTimeout = 0;
};
# Fun
cellular-automaton.enable = false;
};
statusline = {
@ -165,6 +162,7 @@ isMaximal: {
motion = {
hop.enable = true;
leap.enable = true;
precognition.enable = isMaximal;
};
images = {

View file

@ -185,6 +185,7 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
default.
- Refactor of `nvim-cmp` and completion related modules
- Remove `autocomplete.type` in favor of per-plugin enable options such as
[](#opt-vim.autocomplete.nvim-cmp.enable).
- Deprecate legacy Vimsnip in favor of Luasnip, and integrate
@ -277,9 +278,13 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
- Update `lualine.nvim` input and add missing themes:
- Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`,
`powerline_dark` and `solarized_light` themes.
- Add [](#opt-vim.spellcheck.extraSpellWords) to allow adding arbitrary
spellfiles to Neovim's runtime with ease.
[ppenguin](https://github.com/ppenguin):
- Telescope:
@ -317,3 +322,8 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
[](#opt-vim.languages.svelte.format.type) respectively.
- Replace [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) with
[nixfmt](https://github.com/NixOS/nixfmt) (nixfmt-rfc-style).
[Nowaaru](https://github.com/Nowaaru):
- Add `precognition-nvim`.

View file

@ -98,11 +98,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1726871744,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
"lastModified": 1730958623,
"narHash": "sha256-JwQZIGSYnRNOgDDoIgqKITrPVil+RMWHsZH1eE1VGN0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
"rev": "85f7e662eda4fa3a995556527c87b2524b691933",
"type": "github"
},
"original": {
@ -1390,6 +1390,22 @@
"type": "github"
}
},
"plugin-nvim-scrollbar": {
"flake": false,
"locked": {
"lastModified": 1729162132,
"narHash": "sha256-/nB7eP2Rz/A9zMXrNEH4FReo6eZS0C/SEGvKhxV7AUA=",
"owner": "petertriho",
"repo": "nvim-scrollbar",
"rev": "6994eb9f73d5fdc36ee2c8717940e8c853e51a49",
"type": "github"
},
"original": {
"owner": "petertriho",
"repo": "nvim-scrollbar",
"type": "github"
}
},
"plugin-nvim-session-manager": {
"flake": false,
"locked": {
@ -1614,6 +1630,22 @@
"type": "github"
}
},
"plugin-precognition-nvim": {
"flake": false,
"locked": {
"lastModified": 1730325090,
"narHash": "sha256-onY1Aa+dwLR1wRua52hpSXj6zZOZXjkUlDjDa0xEEcE=",
"owner": "tris203",
"repo": "precognition.nvim",
"rev": "0189e8d6f96275a079b2805d68d49414871885cd",
"type": "github"
},
"original": {
"owner": "tris203",
"repo": "precognition.nvim",
"type": "github"
}
},
"plugin-project-nvim": {
"flake": false,
"locked": {
@ -1694,22 +1726,6 @@
"type": "github"
}
},
"plugin-scrollbar-nvim": {
"flake": false,
"locked": {
"lastModified": 1684886154,
"narHash": "sha256-zLBexSxQCn9HPY04a9w/UCJP1F5ShI2X12I9xE9H0cM=",
"owner": "petertriho",
"repo": "nvim-scrollbar",
"rev": "35f99d559041c7c0eff3a41f9093581ceea534e8",
"type": "github"
},
"original": {
"owner": "petertriho",
"repo": "nvim-scrollbar",
"type": "github"
}
},
"plugin-smartcolumn": {
"flake": false,
"locked": {
@ -2071,6 +2087,7 @@
"plugin-nvim-neoclip": "plugin-nvim-neoclip",
"plugin-nvim-nio": "plugin-nvim-nio",
"plugin-nvim-notify": "plugin-nvim-notify",
"plugin-nvim-scrollbar": "plugin-nvim-scrollbar",
"plugin-nvim-session-manager": "plugin-nvim-session-manager",
"plugin-nvim-surround": "plugin-nvim-surround",
"plugin-nvim-tree-lua": "plugin-nvim-tree-lua",
@ -2085,12 +2102,12 @@
"plugin-oxocarbon": "plugin-oxocarbon",
"plugin-pathlib-nvim": "plugin-pathlib-nvim",
"plugin-plenary-nvim": "plugin-plenary-nvim",
"plugin-precognition-nvim": "plugin-precognition-nvim",
"plugin-project-nvim": "plugin-project-nvim",
"plugin-registers": "plugin-registers",
"plugin-rose-pine": "plugin-rose-pine",
"plugin-rtp-nvim": "plugin-rtp-nvim",
"plugin-rustaceanvim": "plugin-rustaceanvim",
"plugin-scrollbar-nvim": "plugin-scrollbar-nvim",
"plugin-smartcolumn": "plugin-smartcolumn",
"plugin-sqls-nvim": "plugin-sqls-nvim",
"plugin-tabular": "plugin-tabular",

View file

@ -443,7 +443,7 @@
flake = false;
};
plugin-scrollbar-nvim = {
plugin-nvim-scrollbar = {
url = "github:petertriho/nvim-scrollbar";
flake = false;
};
@ -566,6 +566,11 @@
flake = false;
};
plugin-precognition-nvim = {
url = "github:tris203/precognition.nvim";
flake = false;
};
# Note-taking
plugin-obsidian-nvim = {
url = "github:epwalsh/obsidian.nvim";

View file

@ -19,7 +19,7 @@
docs-html-wrapped = pkgs.writeScriptBin "docs-html-wrapped" ''
#!${pkgs.stdenv.shell}
# use xdg-open to open the docs in the browser
${pkgs.xdg_utils}/bin/xdg-open ${docs.manual.html}
${pkgs.xdg-utils}/bin/xdg-open ${docs.manual.html}
'';
# Exposed neovim configurations
@ -29,10 +29,10 @@
# Published docker images
docker-nix = let
inherit (pkgs) bash gitFull buildEnv dockerTools;
inherit (pkgs) bash gitFull buildEnv;
inherit (config.legacyPackages) neovim-nix;
in
dockerTools.buildImage {
pkgs.dockerTools.buildImage {
name = "nvf";
tag = "latest";

View file

@ -1,11 +1,14 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) listOf str;
inherit (lib.strings) concatLines;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.types) listOf str attrsOf;
inherit (lib.nvim.lua) listToLuaTable;
inherit (lib.nvim.dag) entryAfter;
@ -24,10 +27,48 @@ in {
description = ''
A list of languages that should be used for spellchecking.
To add your own language files, you may place your `spell`
directory in either `~/.config/nvim` or the
[additionalRuntimePaths](#opt-vim.additionalRuntimePaths)
directory provided by **nvf**.
To add your own language files, you may place your `spell` directory in either
{file}`$XDG_CONFIG_HOME/nvf` or in a path that is included in the
[additionalRuntimePaths](#opt-vim.additionalRuntimePaths) list provided by nvf.
'';
};
extraSpellWords = mkOption {
type = attrsOf (listOf str);
default = {};
example = literalExpression ''{"en.utf-8" = ["nvf" "word_you_want_to_add"];}'';
description = ''
Additional words to be used for spellchecking. The names of each key will be
used as the language code for the spell file. For example
```nix
"en.utf-8" = [ ... ];
```
will result in `en.utf-8.add.spl` being added to Neovim's runtime in the
{file}`spell` directory.
::: {.warning}
The attribute keys must be in `"<name>.<encoding>"` format for Neovim to
compile your spellfiles without mangling the resulting file names. Please
make sure that you enter the correct value, as nvf does not do any kind of
internal checking. Please see {command}`:help mkspell` for more details.
Example:
```nix
# "en" is the name, and "utf-8" is the encoding. For most use cases, utf-8
# will be enough, however, you may change it to any encoding format Neovim
# accepts, e.g., utf-16.
"en.utf-8" = ["nvf" "word_you_want_to_add"];
=> $out/spell/en-utf-8.add.spl
```
:::
Note that while adding a new language, you will still need to add the name of
the language (e.g. "en") to the {option}`vim.spellcheck.languages` list by name
in order to enable spellchecking for the language. By default only `"en"` is in
the list.
'';
};
@ -38,38 +79,75 @@ in {
description = ''
A list of filetypes for which spellchecking will be disabled.
You may use `echo &filetype` in Neovim to find out the
::: {.tip}
You may use {command}`:echo &filetype` in Neovim to find out the
filetype for a specific buffer.
:::
'';
};
/*
# FIXME: This needs to be revisited. It tries to install
# the spellfile to an user directory, but it cannot do so
# as we sanitize runtime paths.
programmingWordlist.enable = mkEnableOption ''
vim-dirtytalk, a wordlist for programmers containing
common programming terms.
Setting this value as `true` has the same effect
as setting {option}`vim.spellCheck.enable`
::: {.note}
Enabling this option will unconditionally set
{option}`vim.spellcheck.enable` to true as vim-dirtytalk
depends on spellchecking having been set up.
:::
'';
*/
};
config = mkIf cfg.enable {
vim.luaConfigRC.spellcheck = entryAfter ["basic"] ''
vim.opt.spell = true
vim.opt.spelllang = ${listToLuaTable cfg.languages}
vim = {
additionalRuntimePaths = let
compileJoinedSpellfiles =
pkgs.runCommandLocal "nvf-compile-spellfiles" {
# Use the same version of Neovim as the user's configuration
nativeBuildInputs = [config.vim.package];
-- Disable spellchecking for certain filetypes
-- as configured by `vim.spellcheck.ignoredFiletypes`
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = ${listToLuaTable cfg.ignoredFiletypes},
callback = function()
vim.opt_local.spell = false
end,
})
'';
spellfilesJoined = pkgs.symlinkJoin {
name = "nvf-spellfiles-joined";
paths = mapAttrsToList (name: value: pkgs.writeTextDir "spell/${name}.add" (concatLines value)) cfg.extraSpellWords;
postBuild = "echo Spellfiles joined";
};
} ''
# Fail on unset variables and non-zero exit codes
# this might be the only way to trace when `nvim --headless`
# fails in batch mode
set -eu
mkdir -p "$out/spell"
for spellfile in "$spellfilesJoined"/spell/*.add; do
name="$(basename "$spellfile" ".add")"
echo "Compiling spellfile: $spellfile"
nvim --headless --clean \
--cmd "mkspell $out/spell/$name.add.spl $spellfile" -Es -n
done
'';
in
mkIf (cfg.extraSpellWords != {}) [
# If .outPath is missing, additionalRuntimePaths receives the *function*
# instead of a path, causing errors.
compileJoinedSpellfiles.outPath
];
luaConfigRC.spellcheck = entryAfter ["basic"] ''
vim.opt.spell = true
vim.opt.spelllang = ${listToLuaTable cfg.languages}
-- Disable spellchecking for certain filetypes
-- as configured by `vim.spellcheck.ignoredFiletypes`
vim.api.nvim_create_augroup("nvf_autocmds", {clear = false})
vim.api.nvim_create_autocmd({ "FileType" }, {
group = "nvf_autocmds",
pattern = ${listToLuaTable cfg.ignoredFiletypes},
callback = function()
vim.opt_local.spell = false
end,
})
'';
};
};
}

View file

@ -7,16 +7,26 @@
inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.spellcheck;
in {
config = mkIf (cfg.enable && cfg.programmingWordlist.enable) {
config = mkIf cfg.programmingWordlist.enable {
vim = {
startPlugins = ["vim-dirtytalk"];
# vim-dirtytalk doesn't have any setup
# but we would like to append programming to spelllang
# as soon as possible while the plugin is enabled
pluginRC.vim-dirtytalk = entryAfter ["basic"] ''
-- append programming to spelllang
vim.opt.spelllang:append("programming")
spellcheck.enable = true;
# vim-dirtytalk doesn't have any setup but we would
# like to append programming to spelllangs as soon as
# possible while the plugin is enabled and the state
# directory can be found.
pluginRC.vim-dirtytalk = entryAfter ["spellcheck"] ''
-- If Neovim can find (or access) the state directory
-- then append "programming" wordlist from vim-dirtytalk
-- to spelllang table. If path cannot be found, display
-- an error and avoid appending the programming words
if vim.fn.isdirectory(vim.fn.stdpath('state')) == 1 then
vim.opt.spelllang:append("programming")
else
vim.notify("State path does not exist: " .. state_path, vim.log.levels.ERROR)
end
'';
};
};

View file

@ -15,10 +15,14 @@ in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
(assert config.vim.visuals.nvimWebDevicons.enable; "nvim-bufferline-lua")
"nvim-bufferline-lua"
"bufdelete-nvim"
];
# Soft-dependency for bufferline.
# Recommended by upstream, so enabled here.
visuals.nvim-web-devicons.enable = true;
maps.normal = mkMerge [
(mkLuaBinding cfg.mappings.closeCurrent "require(\"bufdelete\").bufdelete" mappings.closeCurrent.description)
(mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext<CR>" mappings.cycleNext.description)

View file

@ -2,5 +2,6 @@ _: {
imports = [
./hop
./leap
./precognition
];
}

View file

@ -0,0 +1,18 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.motion.precognition;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["precognition-nvim"];
luaConfigRC.precognition = lib.nvim.dag.entryAnywhere ''
require('precognition').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./precognition.nix
./config.nix
];
}

View file

@ -0,0 +1,66 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.types) attrsOf listOf str bool int submodule;
inherit (lib.nvim.types) mkPluginSetupOption;
mkHintType = description:
mkOption {
inherit description;
default = {};
type = attrsOf (submodule {
options = {
text = mkOption {
type = str;
description = "The easier-to-read depiction of the motion";
};
prio = mkOption {
type = int;
default = 1;
description = "The priority of the hint";
example = 10;
};
};
});
};
in {
options.vim.utility.motion.precognition = {
enable = mkEnableOption "assisted motion discovery[precognition.nvim]";
setupOpts = mkPluginSetupOption "precognition.nvim" {
startVisible = mkOption {
type = bool;
default = true;
description = "Whether to start 'precognition' automatically";
};
showBlankVirtLine = mkOption {
type = bool;
default = true;
description = "Whether to show a blank virtual line when no movements are shown";
};
highlightColor = mkOption {
type = attrsOf str;
default = {link = "Comment";};
example = literalExpression ''
{ link = "Comment"; }
# or
{ foreground = "#0000FF"; background = "#000000"; };
'';
description = "The highlight for the virtual text";
};
disabled_fts = mkOption {
type = listOf str;
default = ["startify"];
example = literalExpression ''["startify"]'';
description = "Filetypes that automatically disable 'precognition'";
};
hints = mkHintType "What motions display, and at what priority";
gutterHints = mkHintType ''
What motions display and at what priority. Only appears in gutters
'';
};
};
}

View file

@ -0,0 +1,60 @@
{lib, ...}: let
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.nvim.types) luaInline;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.generators) mkLuaInline;
in {
imports = [
(mkRenamedOptionModule ["vim" "visuals" "cellularAutomaton"] ["vim" "visuals" "cellular-automaton"])
];
options.vim.visuals.cellular-automaton = {
enable = mkEnableOption "cellular-automaton to help you cope with stubborn code [cellular-automaton]";
mappings = {
makeItRain = mkMappingOption "Make it rain [cellular-automaton]" "<leader>fml";
};
animation = {
register = mkEnableOption "registering configured animation(s) automatically" // {default = true;};
setup = mkOption {
type = luaInline;
default = mkLuaInline ''
local ca_config = {
fps = 50,
name = 'slide',
}
-- init function is invoked only once at the start
-- config.init = function (grid)
--
-- end
-- update function
ca_config.update = function (grid)
for i = 1, #grid do
local prev = grid[i][#(grid[i])]
for j = 1, #(grid[i]) do
grid[i][j], prev = prev, grid[i][j]
end
end
return true
end
'';
description = ''
Configuration used to generate an animation to be registered.
The final value for `ca_config` will be used to register a new
animation using `require("cellular-automaton").register_animation(ca_config)`
::: {.warning}
`ca_config` **must** eval to a valid Lua table. nvf does not and cannot
perform any kind of validation on your Lua code, so bogus values will
result in errors when the animation is registered.
:::
'';
};
};
};
}

View file

@ -0,0 +1,39 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere entryAfter;
inherit (lib.nvim.binds) mkBinding;
cfg = config.vim.visuals.cellular-automaton;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["cellular-automaton"];
maps.normal = mkBinding cfg.mappings.makeItRain "<cmd>CellularAutomaton make_it_rain<CR>" "Make it rain";
pluginRC = {
# XXX: This has no error handling. User can set
# `animation.setup` to a bogus value, and we would
# have an error in our hands. I don't think there
# is a good way to check for errors, so I'm leaving
# it like this under the assumption that the user
# will not mess it up for no reason.
cellular-automaton-anim = entryAnywhere (optionalString cfg.animation.register ''
-- Coerce user animation config into pluginRC
${toLuaObject cfg.animation.setup}
'');
cellular-automaton = entryAfter ["cellular-automaton-anim"] ''
-- Register the animation
require("cellular-automaton").register_animation(ca_config)
'';
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./cellular-automaton.nix
];
}

View file

@ -0,0 +1,35 @@
{lib, ...}: let
inherit (lib.modules) mkRemovedOptionModule;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) submodule attrs attrsOf;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
imports = [
(mkRemovedOptionModule ["vim" "visuals" "smoothScroll"] ''
`vim.visuals.smoothScroll` has been removed. You may consider enabling the
option `vim.visuals.cinnamon-nvim` to repliace previous smooth scrolling
behaviour.
'')
];
options.vim.visuals.cinnamon-nvim = {
enable = mkEnableOption "smooth scrolling for ANY command [cinnamon-nvim]";
setupOpts = mkPluginSetupOption "cinnamon.nvim" {
options = mkOption {
type = attrs;
default = {
# Defaults provided for the sake of documentation only!
# Who would've guessed setupOpts.options would be confusing?
mode = "cursor";
count_only = false;
};
description = "Scroll options";
};
keymaps = {
basic = mkEnableOption "basic animation keymaps";
extra = mkEnableOption "extra animation keymaps";
};
};
};
}

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.cinnamon-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["cinnamon-nvim"];
pluginRC.cursorline = entryAnywhere ''
require("cinnamon").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./cinnamon-nvim.nix
];
}

View file

@ -1,118 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.trivial) boolToString;
inherit (lib.nvim.binds) mkBinding;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.visuals;
in {
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.indentBlankline.enable {
vim.startPlugins = ["indent-blankline"];
vim.pluginRC.indent-blankline = entryAnywhere ''
require("ibl").setup(${toLuaObject cfg.indentBlankline.setupOpts})
'';
})
(mkIf cfg.cursorline.enable {
vim.startPlugins = ["nvim-cursorline"];
vim.pluginRC.cursorline = entryAnywhere ''
require('nvim-cursorline').setup {
cursorline = {
timeout = ${toString cfg.cursorline.lineTimeout},
number = ${boolToString (!cfg.cursorline.lineNumbersOnly)},
}
}
'';
})
(mkIf cfg.nvimWebDevicons.enable {
vim.startPlugins = ["nvim-web-devicons"];
})
(mkIf cfg.scrollBar.enable {
vim.startPlugins = ["scrollbar-nvim"];
vim.pluginRC.scrollBar = entryAnywhere ''
require('scrollbar').setup{
excluded_filetypes = {
'prompt',
'TelescopePrompt',
'noice',
'NvimTree',
'alpha',
'notify',
'Navbuddy'
},
}
'';
})
(mkIf cfg.smoothScroll.enable {
vim.startPlugins = ["cinnamon-nvim"];
vim.pluginRC.smoothScroll = entryAnywhere ''
require('cinnamon').setup()
'';
})
(mkIf cfg.cellularAutomaton.enable {
vim.startPlugins = ["cellular-automaton"];
vim.maps.normal = mkBinding cfg.cellularAutomaton.mappings.makeItRain "<cmd>CellularAutomaton make_it_rain<CR>" "Make it rain";
vim.pluginRC.cellularAUtomaton = entryAnywhere ''
local config = {
fps = 50,
name = 'slide',
}
-- init function is invoked only once at the start
-- config.init = function (grid)
--
-- end
-- update function
config.update = function (grid)
for i = 1, #grid do
local prev = grid[i][#(grid[i])]
for j = 1, #(grid[i]) do
grid[i][j], prev = prev, grid[i][j]
end
end
return true
end
require("cellular-automaton").register_animation(config)
'';
})
(mkIf cfg.highlight-undo.enable {
vim.startPlugins = ["highlight-undo"];
vim.pluginRC.highlight-undo = entryAnywhere ''
require('highlight-undo').setup({
duration = ${toString cfg.highlight-undo.duration},
highlight_for_count = ${boolToString cfg.highlight-undo.highlightForCount},
undo = {
hlgroup = ${cfg.highlight-undo.undo.hlGroup},
mode = 'n',
lhs = 'u',
map = 'undo',
opts = {}
},
redo = {
hlgroup = ${cfg.highlight-undo.redo.hlGroup},
mode = 'n',
lhs = '<C-r>',
map = 'redo',
opts = {}
},
})
'';
})
]);
}

View file

@ -1,7 +1,19 @@
{...}: {
{lib, ...}: let
inherit (lib.modules) mkRemovedOptionModule;
in {
imports = [
./config.nix
./visuals.nix
./fidget
(mkRemovedOptionModule ["vim" "visuals" "enable"] ''
As top-level toggles are being deprecated, you are encouraged
to handle plugin toggles under individual options.
'')
./cellular-automaton
./cinnamon-nvim
./fidget-nvim
./highlight-undo
./indent-blankline
./nvim-cursorline
./nvim-scrollbar
./nvim-web-devicons
];
}

View file

@ -12,8 +12,11 @@
in {
imports = [
(mkRenamedOptionModule ["vim" "visuals" "fidget-nvim" "align" "bottom"] ["vim" "visuals" "fidget-nvim" "setupOpts" "notification" "window" "align"])
(mkRemovedOptionModule ["vim" "visuals" "fidget-nvim" "align" "right"]
"Option `vim.fidget-nvim.align.right` has been removed and does not have an equivalent replacement in rewritten fidget.nvim configuration.")
(mkRemovedOptionModule ["vim" "visuals" "fidget-nvim" "align" "right"] ''
Option `vim.fidget-nvim.align.right` has been removed and does not have an
equivalent replacement in rewritten fidget.nvim configuration. Please remove
it from your configuration.
'')
];
options.vim.visuals.fidget-nvim = {

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.highlight-undo;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["highlight-undo"];
pluginRC.highlight-undo = entryAnywhere ''
require("highlight-undo").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./highlight-undo.nix
];
}

View file

@ -0,0 +1,32 @@
{lib, ...}: let
inherit (lib.modules) mkRemovedOptionModule;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) int;
inherit (lib.nvim.types) mkPluginSetupOption;
checkDocsMsg = ''
highlight-undo.nvim has deprecated previously used configuration options in
a recent update, so previous values will no longer work as expected.
Please use `vim.visuals.highlight-undo.setupOpts` with upstream instructions
'';
in {
imports = [
# This gives a lot of error messages for those with default values set or modified. Could
# there be a better way to handle his? Perhaps an assertion?
(mkRemovedOptionModule ["vim" "visuals" "highlight-undo" "highlightForCount"] checkDocsMsg)
(mkRemovedOptionModule ["vim" "visuals" "highlight-undo" "undo" "hlGroup"] checkDocsMsg)
(mkRemovedOptionModule ["vim" "visuals" "highlight-undo" "redo" "hlGroup"] checkDocsMsg)
];
options.vim.visuals.highlight-undo = {
enable = mkEnableOption "highlight undo [highlight-undo]";
setupOpts = mkPluginSetupOption "highlight-undo" {
duration = mkOption {
type = int;
default = 500;
description = "Duration of the highlight";
};
};
};
}

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.indent-blankline;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["indent-blankline"];
pluginRC.indent-blankline = entryAnywhere ''
require("ibl").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./indent-blankline.nix
];
}

View file

@ -0,0 +1,195 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) int bool str nullOr either listOf attrsOf;
cfg = config.vim.visuals;
in {
imports = [
(mkRenamedOptionModule ["vim" "visuals" "indentBlankline"] ["vim" "visuals" "indent-blankline"])
];
options.vim.visuals.indent-blankline = {
enable = mkEnableOption "indentation guides [indent-blankline]";
setupOpts = {
debounce = mkOption {
type = int;
description = "Debounce time in milliseconds";
default = 200;
};
viewport_buffer = {
min = mkOption {
type = int;
description = "Number of lines above and below of what is currently
visible in the window";
default = 30;
};
max = mkOption {
type = int;
description = "Number of lines above and below of what is currently
visible in the window";
default = 500;
};
};
indent = {
char = mkOption {
type = either str (listOf str);
description = "Character(s) for indentation guide";
default = "";
};
tab_char = mkOption {
type = nullOr (either str (listOf str));
description = ''
Character(s) for tab indentation guide.
See `:help ibl.config.indent.tab_char`.
'';
default = null;
};
highlight = mkOption {
type = nullOr (either str (listOf str));
description = ''
The highlight group(s) applied to the indentation guide.
See `:help ibl.config.indent.highlight`.
'';
default = null;
};
smart_indent_cap = mkOption {
type = bool;
description = "Caps the number of indentation levels based on surrounding code";
default = true;
};
priority = mkOption {
type = int;
description = "Virtual text priority for the indentation guide";
default = 1;
};
repeat_linebreak = mkOption {
type = bool;
description = "Repeat indentation guides on wrapped lines";
default = true;
};
};
whitespace = {
highlight = mkOption {
type = nullOr (either str (listOf str));
description = ''
The highlight group(s) applied to whitespace.
See `:help ibl.config.whitespace.highlight`.
'';
default = null;
};
remove_blankline_trail = mkOption {
type = bool;
description = "Remove trailing whitespace on blanklines";
default = true;
};
};
scope = {
enabled = mkOption {
description = "Highlight current scope from treesitter";
type = bool;
default = config.vim.treesitter.enable;
defaultText = literalExpression "config.vim.treesitter.enable";
};
char = mkOption {
type = either str (listOf str);
description = "The character(s) for the scope indentation guide";
default = cfg.indent-blankline.setupOpts.indent.char;
defaultText = literalExpression "config.vim.visuals.indent-blankline.setupOpts.indent.char";
};
show_start = mkOption {
type = bool;
description = "Show an underline on the first line of the scope";
default = false;
};
show_end = mkOption {
type = bool;
description = "Show an underline on the last line of the scope";
default = false;
};
show_exact_scope = mkOption {
type = bool;
description = "Show the scope underline at the exact start of the scope, even if that's to the right of the indentation guide";
default = false;
};
injected_languages = mkOption {
type = bool;
description = "Check for injected languages (treesitter)";
default = config.vim.treesitter.enable;
defaultText = literalExpression "config.vim.treesitter.enable";
};
highlight = mkOption {
type = nullOr (either str (listOf str));
description = ''
The highlight group(s) applied to the scope.
See `:help `ibl.config.scope.highlight`.
'';
default = null;
};
priority = mkOption {
type = int;
description = "Virtual text priority for the scope";
default = 1024;
};
include.node_type = mkOption {
type = attrsOf (listOf str);
description = "Additional nodes to be used for scope checking, per language";
default = {};
};
exclude = {
language = mkOption {
type = listOf str;
description = ''
The list of treesitter languages to disable scope for.
`*` can be used as a wildcard for every language/node type.
'';
default = [];
};
node_type = mkOption {
type = attrsOf (listOf str);
description = ''
Nodes to ignore in scope checking, per language.
`*` can be used as a wildcard for every language.
'';
default = {
"*" = ["source_file" "program"];
lua = ["chunk"];
python = ["module"];
};
};
};
};
};
};
}

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.nvim-cursorline;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-cursorline"];
pluginRC.nvim-cursorline = entryAnywhere ''
require("nvim-cursorline").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./nvim-cursorline.nix
];
}

View file

@ -0,0 +1,65 @@
{lib, ...}: let
inherit (lib.modules) mkRenamedOptionModule mkRemovedOptionModule;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) int bool;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
imports = [
(mkRenamedOptionModule ["vim" "visuals" "cursorline"] ["vim" "visuals" "nvim-cursorline"])
(mkRenamedOptionModule ["vim" "visuals" "nvim-cursorline" "lineTimeout"] ["vim" "visuals" "nvim-cursorline" "setupOpts" "line_timeout"])
(mkRemovedOptionModule ["vim" "visuals" "nvim-cursorline" "lineNumbersOnly"] ''
`vim.visuals.nvim-cursorline.lineNumbersOnly` has been removed. Use `vim.visuals.nvim-cursorline.number` instead.
'')
];
options.vim.visuals.nvim-cursorline = {
enable = mkEnableOption "cursor word and line highlighting [nvim-cursorline]";
# Upstream has **zero** documentation whatsoever. I'm making wild assumptions
# on what goes into description based don the source code. I'm sorry. Not.
setupOpts = mkPluginSetupOption "nvim-cursorline" {
cursorline = {
enable = mkEnableOption "cursor line highlighting";
timeout = mkOption {
type = int;
default = 1000;
description = "Cursorline timeout";
};
number = mkOption {
type = bool;
default = false;
description = ''
If true, `vim.wo.cursorlineopt` will be set to "number"
when the trigger conditions are met.
'';
};
};
cursorword = {
enable = mkEnableOption "cursor word highlighting";
timeout = mkOption {
type = int;
default = 1000;
description = "Cursorword timeout";
};
min_length = mkOption {
type = int;
default = 3;
description = ''
The min_length option defines the minimum number of characters
a word must have to be highlighted as a "cursor word." Any word
shorter than this value will be ignored and not highlighted.
'';
};
hl.underline = mkOption {
type = bool;
default = true;
description = "Whether to underline matching cursorword";
};
};
};
};
}

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.nvim-scrollbar;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-scrollbar"];
pluginRC.cursorline = entryAnywhere ''
require("scrollbar").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./scrollbar-nvim.nix
];
}

View file

@ -0,0 +1,21 @@
{lib, ...}: let
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) listOf str;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
imports = [
(mkRenamedOptionModule ["vim" "visuals" "scrollBar"] ["vim" "visuals" "nvim-scrollbar"])
];
options.vim.visuals.nvim-scrollbar = {
enable = mkEnableOption "extensible Neovim Scrollbar [nvim-scrollbar]";
setupOpts = mkPluginSetupOption "scrollbar-nvim" {
excluded_filetypes = mkOption {
type = listOf str;
default = ["prompt" "TelescopePrompt" "noice" "noice" "NvimTree" "neo-tree" "alpha" "notify" "Navbuddy"];
description = "Filetypes to hide the scrollbar on";
};
};
};
}

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.nvim-web-devicons;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-web-devicons"];
pluginRC.nvim-web-devicons = entryAnywhere ''
require("nvim-web-devicons").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./nvim-web-devicons.nix
];
}

View file

@ -0,0 +1,48 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) nullOr attrsOf attrs enum;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
imports = [
(mkRenamedOptionModule ["vim" "visuals" "nvimWebDevicons"] ["vim" "visuals" "nvim-web-devicons"])
];
options.vim.visuals.nvim-web-devicons = {
enable = mkEnableOption "Neovim dev icons [nvim-web-devicons]";
setupOpts = mkPluginSetupOption "nvim-web-devicons" {
color_icons = mkEnableOption "different highlight colors per icon";
variant = mkOption {
type = nullOr (enum ["light" "dark"]);
default = null;
description = "Set the light or dark variant manually, instead of relying on `background`";
};
override = mkOption {
type = attrsOf attrs;
default = {};
example = literalExpression ''
{
zsh = {
name = "Zsh";
icon = "";
color = "#428850";
cterm_color = "65";
};
}
'';
description = ''
Your personal icon overrides.
You can specify color or cterm_color instead of specifying
both of them. DevIcon will be appended to `name`
'';
};
};
};
}

View file

@ -1,261 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.types) int bool str nullOr either listOf attrsOf;
inherit (lib.nvim.binds) mkMappingOption;
cfg = config.vim.visuals;
in {
options.vim.visuals = {
enable = mkEnableOption "Visual enhancements.";
nvimWebDevicons.enable = mkEnableOption "dev icons. Required for certain plugins [nvim-web-devicons].";
scrollBar.enable = mkEnableOption "scrollbar [scrollbar.nvim]";
smoothScroll.enable = mkEnableOption "smooth scrolling [cinnamon-nvim]";
cellularAutomaton = {
enable = mkEnableOption "cellular automaton [cellular-automaton]";
mappings = {
makeItRain = mkMappingOption "Make it rain [cellular-automaton]" "<leader>fml";
};
};
cursorline = {
enable = mkEnableOption "line hightlighting on the cursor [nvim-cursorline]";
lineTimeout = mkOption {
type = int;
description = "Time in milliseconds for cursorline to appear";
default = 0;
};
lineNumbersOnly = mkOption {
type = bool;
description = "Hightlight only in the presence of line numbers";
default = true;
};
};
indentBlankline = {
enable = mkEnableOption "indentation guides [indent-blankline]";
setupOpts = {
debounce = mkOption {
type = int;
description = "Debounce time in milliseconds";
default = 200;
};
viewport_buffer = {
min = mkOption {
type = int;
description = "Number of lines above and below of what is currently
visible in the window";
default = 30;
};
max = mkOption {
type = int;
description = "Number of lines above and below of what is currently
visible in the window";
default = 500;
};
};
indent = {
char = mkOption {
type = either str (listOf str);
description = "Character(s) for indentation guide";
default = "";
};
tab_char = mkOption {
type = nullOr (either str (listOf str));
description = ''
Character(s) for tab indentation guide.
See `:help ibl.config.indent.tab_char`.
'';
default = null;
};
highlight = mkOption {
type = nullOr (either str (listOf str));
description = ''
The highlight group(s) applied to the indentation guide.
See `:help ibl.config.indent.highlight`.
'';
default = null;
};
smart_indent_cap = mkOption {
type = bool;
description = "Caps the number of indentation levels based on surrounding code";
default = true;
};
priority = mkOption {
type = int;
description = "Virtual text priority for the indentation guide";
default = 1;
};
repeat_linebreak = mkOption {
type = bool;
description = "Repeat indentation guides on wrapped lines";
default = true;
};
};
whitespace = {
highlight = mkOption {
type = nullOr (either str (listOf str));
description = ''
The highlight group(s) applied to whitespace.
See `:help ibl.config.whitespace.highlight`.
'';
default = null;
};
remove_blankline_trail = mkOption {
type = bool;
description = "Remove trailing whitespace on blanklines";
default = true;
};
};
scope = {
enabled = mkOption {
description = "Highlight current scope from treesitter";
type = bool;
default = config.vim.treesitter.enable;
defaultText = literalExpression "config.vim.treesitter.enable";
};
char = mkOption {
type = either str (listOf str);
description = "The character(s) for the scope indentation guide";
default = cfg.indentBlankline.setupOpts.indent.char;
defaultText = literalExpression "config.vim.visuals.indentBlankline.setuopOpts.indent.char";
};
show_start = mkOption {
type = bool;
description = "Show an underline on the first line of the scope";
default = false;
};
show_end = mkOption {
type = bool;
description = "Show an underline on the last line of the scope";
default = false;
};
show_exact_scope = mkOption {
type = bool;
description = "Show the scope underline at the exact start of the scope, even if that's to the right of the indentation guide";
default = false;
};
injected_languages = mkOption {
type = bool;
description = "Check for injected languages (treesitter)";
default = config.vim.treesitter.enable;
defaultText = literalExpression "config.vim.treesitter.enable";
};
highlight = mkOption {
type = nullOr (either str (listOf str));
description = ''
The highlight group(s) applied to the scope.
See `:help `ibl.config.scope.highlight`.
'';
default = null;
};
priority = mkOption {
type = int;
description = "Virtual text priority for the scope";
default = 1024;
};
include.node_type = mkOption {
type = attrsOf (listOf str);
description = "Additional nodes to be used for scope checking, per language";
default = {};
};
exclude = {
language = mkOption {
type = listOf str;
description = ''
The list of treesitter languages to disable scope for.
`*` can be used as a wildcard for every language/node type.
'';
default = [];
};
node_type = mkOption {
type = attrsOf (listOf str);
description = ''
Nodes to ignore in scope checking, per language.
`*` can be used as a wildcard for every language.
'';
default = {
"*" = ["source_file" "program"];
lua = ["chunk"];
python = ["module"];
};
};
};
};
};
};
highlight-undo = {
enable = mkEnableOption "highlight undo [highlight-undo]";
highlightForCount = mkOption {
type = bool;
default = true;
description = ''
Enable support for highlighting when a <count> is provided before the key
If set to false it will only highlight when the mapping is not prefixed with a <count>
'';
};
duration = mkOption {
type = int;
description = "Duration of highlight";
default = 500;
};
undo = {
hlGroup = mkOption {
type = str;
description = "Highlight group for undo";
default = "HighlightUndo";
};
};
redo = {
hlGroup = mkOption {
type = str;
description = "Highlight group for redo";
default = "HighlightUndo";
};
};
};
};
}

View file

@ -1,4 +1,4 @@
{
"release": "v0.6",
"isReleaseBranch": true
"release": "v0.7",
"isReleaseBranch": false
}