Merge branch 'main' into live-docs-preview

This commit is contained in:
raf 2025-01-10 13:31:55 +03:00 committed by GitHub
commit 15ee6e0a35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 521 additions and 276 deletions

60
.github/README.md vendored
View file

@ -206,6 +206,20 @@ features.
## Credits
### Co-Maintainers
Alongside myself, nvf is developed by those talented folk:
- [**@horriblename**](https://github.com/horriblename)
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
planned features and quality of life updates.
- [**@Diniamo**](https://github.com/Diniamo)
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
pull requests, issues and assistance with maintenance of nvf.
Please do remember to extend your thanks (financially or otherwise) if this
project has been helpful to you.
### Contributors
[mnw]: https://github.com/gerg-l/mnw
@ -213,21 +227,19 @@ features.
nvf would not be what it is today without the awesome people below. Special,
heart-felt thanks to
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts and
invaluable Nix assistance.
- [@FlafyDev](https://github.com/FlafyDev) - For getting home-manager module to
work and Nix assistance.
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
- [**@fufexan**](https://github.com/fufexan) - For the transition to flake-parts
and invaluable Nix assistance.
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
to work and Nix assistance.
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
possible, and other module additions.
- [@horriblename](https://github.com/horriblename) - For actively implementing
planned features and quality of life updates.
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I
could not.
- [@Diniamo](https://github.com/Diniamo) - For actively submitting pull
requests, issues and assistance with maintenance of nvf.
- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, [mnw],
and occasional code improvements.
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
that I could not.
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
[mnw], and occasional code improvements.
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
features and excellent work on new language modules.
and everyone who has submitted issues or pull requests!
@ -237,17 +249,17 @@ This configuration borrows from and is based on a few other configurations,
including:
- [@jordanisaacs's](https://github.com/jordanisaacs)
[neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake
is originally based on.
- [@sioodmy's](https://github.com/sioodmy)
[dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design
choices for UI and plugin defaults.
[**neovim-flake**](https://github.com/jordanisaacs/neovim-flake) that this
flake is originally based on.
- [@wiltaylor's](https://github.com/wiltaylor)
[neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and
design ideas.
- [@gvolpe's](https://github.com/gvolpe)
[neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and
nix concepts.
- [@sioodmy's](https://github.com/sioodmy)
[dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design
choices for UI and plugin defaults.
I am grateful for their previous work and inspiration, and I wholeheartedly
recommend checking their work out.
@ -255,12 +267,12 @@ recommend checking their work out.
## License
Following the license of the
[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), nvf has
been made available under the [**MIT License**](LICENSE). However, all assets
and documentation are published under the
Following the license of
[the original neovim-flake](https://github.com/jordanisaacs/neovim-flake), nvf
has been made available under the [**MIT License**](LICENSE). However, all
assets and documentation are published under the
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE)
under explicit permission by the artist.
under explicit permission by the author or authors.
<h6 align="center">Yes, this includes the logo work too. Stop taking artwork that is not yours!</h6>

View file

@ -10,12 +10,18 @@ To use it, we first add the input flake.
```nix
{
inputs = {
# Optional, if you intend to follow nvf's obsidian-nvim input
# you must also add it as a flake input.
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
# Required, nvf works best and only directly supports flakes
nvf = {
url = "github:notashelf/nvf";
# you can override input nixpkgs
# You can override the input nixpkgs to follow your system's
# instance of nixpkgs. This is safe to do as nvf does not depend
# on a binary cache.
inputs.nixpkgs.follows = "nixpkgs";
# you can also override individual plugins
# Optionally, you can also override individual plugins
# for example:
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
};
@ -27,8 +33,8 @@ Followed by importing the home-manager module somewhere in your configuration.
```nix
{
# assuming nvf is in your inputs and inputs is in the argset
# see example below
# Assuming "nvf" is in your inputs and inputs is in the argument set.
# See example installation below
imports = [ inputs.nvf.homeManagerModules.default ];
}
```
@ -44,12 +50,15 @@ Followed by importing the home-manager module somewhere in your configuration.
};
outputs = { nixpkgs, home-manager, nvf, ... }: let
system = "x86_64-linux"; in {
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
# ↓ this is your home output in the flake schema, expected by home-manager
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options
./home.nix # <- your home entrypoint
./home.nix # <- your home entrypoint, `programs.nvf.*` may be defined here
];
};
};

View file

@ -10,12 +10,18 @@ To use it, we first add the input flake.
```nix
{
inputs = {
# Optional, if you intend to follow nvf's obsidian-nvim input
# you must also add it as a flake input.
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
# Required, nvf works best and only directly supports flakes
nvf = {
url = "github:notashelf/nvf";
# you can override input nixpkgs
# You can override the input nixpkgs to follow your system's
# instance of nixpkgs. This is safe to do as nvf does not depend
# on a binary cache.
inputs.nixpkgs.follows = "nixpkgs";
# you can also override individual plugins
# Optionally, you can also override individual plugins
# for example:
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
};
@ -42,13 +48,12 @@ Followed by importing the NixOS module somewhere in your configuration.
nvf.url = "github:notashelf/nvf";
};
outputs = { nixpkgs, nvf, ... }: let
system = "x86_64-linux"; in {
outputs = { nixpkgs, nvf, ... }: {
# ↓ this is your host output in the flake schema
nixosConfigurations."yourUsername»" = nixpkgs.lib.nixosSystem {
nixosConfigurations."your-hostname" = nixpkgs.lib.nixosSystem {
modules = [
nvf.nixosModules.default # <- this imports the NixOS module that provides the options
./configuration.nix # <- your host entrypoint
./configuration.nix # <- your host entrypoint, `programs.nvf.*` may be defined here
];
};
};

View file

@ -11,6 +11,7 @@ try-it-out.md
default-configs.md
installation.md
configuring.md
tips.md
```
```{=include=} chapters

6
docs/manual/tips.md Normal file
View file

@ -0,0 +1,6 @@
# Helpful Tips {#ch-helpful-tips}
```{=include=} chapters
tips/debugging-nvf.md
tips/offline-docs.md
```

View file

@ -0,0 +1,19 @@
# Debugging nvf {#sec-debugging-nvf}
There may be instances where the your Nix configuration evaluates to invalid
Lua, or times when you will be asked to provide your built Lua configuration for
easier debugging by nvf maintainers. nvf provides two helpful utilities out of
the box.
**nvf-print-config** and **nvf-print-config-path** will be bundled with nvf as
lightweight utilities to help you view or share your built configuration when
necessary.
To view your configuration with syntax highlighting, you may use the
[bat pager](https://github.com/sharkdp/bat).
```bash
nvf-print-config | bat --language=lua
```
Alternatively, `cat` or `less` may also be used.

View file

@ -0,0 +1,11 @@
# Offline Documentation {#sec-offline-documentation}
[https://notashelf.github.io/nvf/options.html]: https://notashelf.github.io/nvf/options.html
The manpages provided by nvf contains an offline version of the option search
normally available at [https://notashelf.github.io/nvf/options.html]. You may
use the `man 5 nvf` command to view option documentation from the comfort of
your terminal.
Note that this is only available for NixOS and Home-Manager module
installations.

View file

@ -28,11 +28,11 @@ configuration formats.
### `vim.maps` rewrite {#sec-vim-maps-rewrite}
Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new
`vim.keymaps` submodule with support for a `mode` option has been introduced. It
can be either a string, or a list of strings, where a string represents the
short-name of the map mode(s), that the mapping should be set for. See
`:help map-modes` for more information.
Instead of specifying map modes using submodules (e.g.: `vim.maps.normal`), a
new `vim.keymaps` submodule with support for a `mode` option has been
introduced. It can be either a string, or a list of strings, where a string
represents the short-name of the map mode(s), that the mapping should be set
for. See `:help map-modes` for more information.
For example:

View file

@ -13,6 +13,19 @@
- Add [render-markdown.nvim] under
`languages.markdown.extensions.render-markdown-nvim`
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
in gitsigns configuration.
- [](#opt-vim.options.mouse) no longer compares values to an enum of available
mouse modes. This means you can provide any string without the module system
warning you that it is invalid. Do keep in mind that this value is no longer
checked, so you will be responsible for ensuring its validity.
- Deprecate `vim.enableEditorconfig` in favor of
[](#opt-vim.globals.editorconfig).
- Deprecate rnix-lsp as it has been abandoned and archived upstream.
[amadaluzia](https://github.com/amadaluzia):
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
@ -25,3 +38,16 @@
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
instead.
[horriblename](https://github.com/horriblename):
[aerial.nvim](https://github.com/stevearc/aerial.nvim)
[nvim-ufo](https://github.com/kevinhwang91/nvim-ufo)
- Add [aerial.nvim]
- Add [nvim-ufo]
[LilleAila](https://github.com/LilleAila):
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
issue with setting the workspace directory.

View file

@ -51,27 +51,6 @@
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
"rnix-lsp",
"nixpkgs"
]
},
"locked": {
"lastModified": 1655042882,
"narHash": "sha256-9BX8Fuez5YJlN7cdPO63InoyBy7dm3VlJkkmTt6fS1A=",
"owner": "nix-community",
"repo": "naersk",
"rev": "cddffb5aa211f50c4b8750adbec0bbbdfb26bb9f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"nil": {
"inputs": {
"flake-utils": [
@ -124,22 +103,6 @@
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1656753965,
"narHash": "sha256-BCrB3l0qpJokOnIVc3g2lHiGhnjUi0MoXiw6t1o8H1E=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0ea7a8f1b939d74e5df8af9a8f7342097cdf69eb",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nmd": {
"flake": false,
"locked": {
@ -156,6 +119,22 @@
"type": "sourcehut"
}
},
"plugin-aerial-nvim": {
"flake": false,
"locked": {
"lastModified": 1736064692,
"narHash": "sha256-7YQtkUTACTMfAGoqoFDPmRrqtw+ypxDbeLCTB3sy4Us=",
"owner": "stevearc",
"repo": "aerial.nvim",
"rev": "b3ec25ca8c347fafa976484a6cace162239112e1",
"type": "github"
},
"original": {
"owner": "stevearc",
"repo": "aerial.nvim",
"type": "github"
}
},
"plugin-alpha-nvim": {
"flake": false,
"locked": {
@ -1502,6 +1481,22 @@
"type": "github"
}
},
"plugin-nvim-ufo": {
"flake": false,
"locked": {
"lastModified": 1735147722,
"narHash": "sha256-etyfm4KpwjYN+kkotOMl0LgbQniILmqMqab4acMtTlw=",
"owner": "kevinhwang91",
"repo": "nvim-ufo",
"rev": "32cb247b893a384f1888b9cd737264159ecf183c",
"type": "github"
},
"original": {
"owner": "kevinhwang91",
"repo": "nvim-ufo",
"type": "github"
}
},
"plugin-nvim-web-devicons": {
"flake": false,
"locked": {
@ -1678,6 +1673,22 @@
"type": "github"
}
},
"plugin-promise-async": {
"flake": false,
"locked": {
"lastModified": 1722813441,
"narHash": "sha256-9eM66brPjiFlY64vmBetRYrKnpDyN7+/URMm4GsGimA=",
"owner": "kevinhwang91",
"repo": "promise-async",
"rev": "119e8961014c9bfaf1487bf3c2a393d254f337e2",
"type": "github"
},
"original": {
"owner": "kevinhwang91",
"repo": "promise-async",
"type": "github"
}
},
"plugin-registers": {
"flake": false,
"locked": {
@ -2062,26 +2073,6 @@
"type": "github"
}
},
"rnix-lsp": {
"inputs": {
"naersk": "naersk",
"nixpkgs": "nixpkgs_2",
"utils": "utils"
},
"locked": {
"lastModified": 1669555118,
"narHash": "sha256-F0s0m62S5bHNVWNHLZD6SeHiLrsDx98VQbRjDyIu+qQ=",
"owner": "nix-community",
"repo": "rnix-lsp",
"rev": "95d40673fe43642e2e1144341e86d0036abd95d9",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "rnix-lsp",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
@ -2090,6 +2081,7 @@
"nil": "nil",
"nixpkgs": "nixpkgs",
"nmd": "nmd",
"plugin-aerial-nvim": "plugin-aerial-nvim",
"plugin-alpha-nvim": "plugin-alpha-nvim",
"plugin-base16": "plugin-base16",
"plugin-bufdelete-nvim": "plugin-bufdelete-nvim",
@ -2174,6 +2166,7 @@
"plugin-nvim-tree-lua": "plugin-nvim-tree-lua",
"plugin-nvim-treesitter-context": "plugin-nvim-treesitter-context",
"plugin-nvim-ts-autotag": "plugin-nvim-ts-autotag",
"plugin-nvim-ufo": "plugin-nvim-ufo",
"plugin-nvim-web-devicons": "plugin-nvim-web-devicons",
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
"plugin-omnisharp-extended": "plugin-omnisharp-extended",
@ -2185,6 +2178,7 @@
"plugin-plenary-nvim": "plugin-plenary-nvim",
"plugin-precognition-nvim": "plugin-precognition-nvim",
"plugin-project-nvim": "plugin-project-nvim",
"plugin-promise-async": "plugin-promise-async",
"plugin-registers": "plugin-registers",
"plugin-render-markdown-nvim": "plugin-render-markdown-nvim",
"plugin-rose-pine": "plugin-rose-pine",
@ -2209,7 +2203,6 @@
"plugin-vim-repeat": "plugin-vim-repeat",
"plugin-vim-startify": "plugin-vim-startify",
"plugin-which-key": "plugin-which-key",
"rnix-lsp": "rnix-lsp",
"systems": "systems_2"
}
},
@ -2263,21 +2256,6 @@
"repo": "default",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View file

@ -89,7 +89,6 @@
};
# Language servers (use master instead of nixpkgs)
rnix-lsp.url = "github:nix-community/rnix-lsp";
nil = {
url = "github:oxalica/nil";
inputs.nixpkgs.follows = "nixpkgs";
@ -720,6 +719,16 @@
flake = false;
};
plugin-promise-async = {
url = "github:kevinhwang91/promise-async";
flake = false;
};
plugin-nvim-ufo = {
url = "github:kevinhwang91/nvim-ufo";
flake = false;
};
plugin-new-file-template-nvim = {
# (required by new-file-template.nvim)
url = "github:otavioschwanck/new-file-template.nvim";
@ -730,5 +739,10 @@
url = "github:mrcjkb/haskell-tools.nvim";
flake = false;
};
plugin-aerial-nvim = {
url = "github:stevearc/aerial.nvim";
flake = false;
};
};
}

View file

@ -8,8 +8,10 @@
inherit system;
overlays = [
inputs.self.overlays.default
(_: _: {
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
# Build nil from source to get most recent
# features as they are added.
nil = inputs'.nil.packages.default;
})
];

View file

@ -6,7 +6,12 @@
inherit (lib.nvim.attrsets) mapListToAttrs;
in {
# Converts a boolean to a yes/no string. This is used in lots of
# configuration formats.
# configuration formats, and is not covered by `toLuaObject`
toVimBool = bool:
if bool
then "yes"
else "no";
diagnosticsToLua = {
lang,
config,
@ -30,8 +35,8 @@ in {
mkEnable = desc:
mkOption {
description = "Turn on ${desc} for enabled languages by default";
type = bool;
default = false;
type = bool;
description = "Turn on ${desc} for enabled languages by default";
};
}

View file

@ -14,6 +14,7 @@
splitRight = "splitright";
autoIndent = "autoindent";
wordWrap = "wrap";
showSignColumn = "signcolumn";
};
in {
imports = concatLists [
@ -35,23 +36,28 @@ in {
vim.autopairs.enable has been removed in favor of per-plugin modules.
You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead.
'')
(mkRemovedOptionModule ["vim" "autopairs" "type"] ''
vim.autopairs.type has been removed in favor of per-plugin modules.
You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead.
'')
(mkRemovedOptionModule ["vim" "autocomplete" "enable"] ''
vim.autocomplete.enable has been removed in favor of per-plugin modules.
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
'')
(mkRemovedOptionModule ["vim" "autocomplete" "type"] ''
vim.autocomplete.type has been removed in favor of per-plugin modules.
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
'')
(mkRemovedOptionModule ["vim" "autocomplete" "sources"] ''
vim.autocomplete.sources has been removed in favor of per-plugin modules.
You can add nvim-cmp sources with vim.autocomplete.nvim-cmp.sources
instead.
'')
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
'')
@ -84,9 +90,12 @@ in {
`tabstop` and `shiftwidth` manually in `vim.options` or per-filetype in a
`ftplugin` directory added to your runtime path.
'')
# 2024-12-02
(mkRenamedOptionModule ["vim" "enableEditorconfig"] ["vim" "globals" "editorconfig"])
]
# 2024-12-1
# 2024-12-01
# Migrated via batchRenameOptions. Further batch renames must be below this line.
renamedVimOpts
];

View file

@ -5,6 +5,7 @@
}: let
inherit (lib.options) mkOption mkEnableOption literalMD;
inherit (lib.strings) optionalString;
inherit (lib.attrsets) optionalAttrs;
inherit (lib.types) enum bool str int either;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryAfter;
@ -58,24 +59,12 @@ in {
description = "Prevent swapfile and backupfile from being created";
};
showSignColumn = mkOption {
type = bool;
default = true;
description = "Show the sign column";
};
bell = mkOption {
type = enum ["none" "visual" "on"];
default = "none";
description = "Set how bells are handled. Options: on, visual or none";
};
enableEditorconfig = mkOption {
type = bool;
default = true;
description = "Follow editorconfig rules in current directory";
};
searchCase = mkOption {
type = enum ["ignore" "smart" "sensitive"];
default = "sensitive";
@ -106,63 +95,55 @@ in {
# Set options that were previously interpolated in 'luaConfigRC.basic' as vim.options (vim.o)
# and 'vim.globals' (vim.g). Future options, if possible, should be added here instead of the
# luaConfigRC section below.
options = pushDownDefault {
options = pushDownDefault (lib.mergeAttrsList [
{
# Options that are always set, with a lower priority
encoding = "utf-8";
hidden = true;
expandtab = true;
};
globals = pushDownDefault {
editorconfig = cfg.enableEditorconfig;
};
# Junkfile Behaviour
swapfile = !cfg.preventJunkFiles;
backup = !cfg.preventJunkFiles;
writebackup = !cfg.preventJunkFiles;
}
# Options that are more difficult to set through 'vim.options'. Fear not, though
# as the Lua DAG is still as powerful as it could be.
(optionalAttrs cfg.undoFile.enable {
undofile = true;
undodir = cfg.undoFile.path;
})
(optionalAttrs (cfg.bell == "none") {
errorbells = false;
visualbell = false;
})
(optionalAttrs (cfg.bell == "on") {
visualbell = false;
})
(optionalAttrs (cfg.bell == "visual") {
visualbell = false;
})
(optionalAttrs (cfg.lineNumberMode == "relative") {
relativenumber = true;
})
(optionalAttrs (cfg.lineNumberMode == "number") {
number = true;
})
(optionalAttrs (cfg.lineNumberMode == "relNumber") {
number = true;
relativenumber = true;
})
]);
# Options that are more difficult to set through 'vim.options'. Namely, appending values
# to pre-set Neovim options. Fear not, though as the Lua DAG is still as powerful as it
# could be.
luaConfigRC.basic = entryAfter ["globalsScript"] ''
-- Settings that are set for everything
vim.opt.shortmess:append("c")
${optionalString cfg.undoFile.enable ''
vim.o.undofile = true
vim.o.undodir = ${toLuaObject cfg.undoFile.path}
''}
${optionalString cfg.showSignColumn ''
vim.o.signcolumn = "yes"
''}
${optionalString cfg.preventJunkFiles ''
vim.o.swapfile = false
vim.o.backup = false
vim.o.writebackup = false
''}
${optionalString (cfg.bell == "none") ''
vim.o.errorbells = false
vim.o.visualbell = false
''}
${optionalString (cfg.bell == "on") ''
vim.o.visualbell = false
''}
${optionalString (cfg.bell == "visual") ''
vim.o.errorbells = false
''}
${optionalString (cfg.lineNumberMode == "relative") ''
vim.o.relativenumber = true
''}
${optionalString (cfg.lineNumberMode == "number") ''
vim.o.number = true
''}
${optionalString (cfg.lineNumberMode == "relNumber") ''
vim.o.number = true
vim.o.relativenumber = true
''}
${optionalString cfg.useSystemClipboard ''
vim.opt.clipboard:append("unnamedplus")
''}

View file

@ -124,7 +124,6 @@ in {
nvim --headless --clean \
--cmd "mkspell $out/spell/$name.add.spl $spellfile" -Es -n
done
'';
in
mkIf (cfg.extraSpellWords != {}) [
@ -133,10 +132,12 @@ in {
compileJoinedSpellfiles.outPath
];
luaConfigRC.spellcheck = entryAfter ["basic"] ''
vim.opt.spell = true
vim.opt.spelllang = ${listToLuaTable cfg.languages}
options = {
spell = true;
spelllang = cfg.languages;
};
luaConfigRC.spellcheck = entryAfter ["basic"] ''
-- Disable spellchecking for certain filetypes
-- as configured by `vim.spellcheck.ignoredFiletypes`
vim.api.nvim_create_augroup("nvf_autocmds", {clear = false})

View file

@ -1,7 +1,7 @@
{
options,
config,
lib,
pkgs,
...
}: let
inherit (lib.strings) optionalString;
@ -11,8 +11,7 @@
inherit (lib.nvim.binds) pushDownDefault;
cfg = config.vim.filetree.nvimTree;
self = import ./nvimtree.nix {inherit pkgs lib;};
inherit (self.options.vim.filetree.nvimTree) mappings;
inherit (options.vim.filetree.nvimTree) mappings;
in {
config = mkIf cfg.enable {
vim = {

View file

@ -7,6 +7,7 @@
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.git.gitsigns;
@ -70,7 +71,7 @@ in {
};
pluginRC.gitsigns = entryAnywhere ''
require('gitsigns').setup{}
require('gitsigns').setup(${toLuaObject cfg.setupOpts})
'';
};
}

View file

@ -6,6 +6,7 @@
inherit (lib.options) mkEnableOption;
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
imports = [
(mkRenamedOptionModule ["vim" "git" "gitsigns" "codeActions" "vim" "gitsigns" "codeActions"] ["vim" "git" "gitsigns" "codeActions" "enable"])
@ -13,6 +14,7 @@ in {
options.vim.git.gitsigns = {
enable = mkEnableOption "gitsigns" // {default = config.vim.git.enable;};
setupOpts = mkPluginSetupOption "gitsigns" {};
codeActions.enable = mkEnableOption "gitsigns codeactions through null-ls";

View file

@ -130,7 +130,6 @@ in {
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
})

View file

@ -71,7 +71,7 @@ in {
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper"}''
else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper", "--lsp"}''
},
on_attach = function(client, bufnr, ht)
default_on_attach(client, bufnr, ht)

View file

@ -26,22 +26,6 @@
then expToLua package
else ''{"${package}/bin/${defaultCmd}"}'';
servers = {
rnix = {
package = pkgs.rnix-lsp;
internalFormatter = cfg.format.type == "nixpkgs-fmt";
lspConfig = ''
lspconfig.rnix.setup{
capabilities = capabilities,
${
if (cfg.format.enable && cfg.format.type == "nixpkgs-fmt")
then useFormat
else noFormat
},
cmd = ${packageToCmd cfg.lsp.package "rnix-lsp"},
}
'';
};
nil = {
package = pkgs.nil;
internalFormatter = true;
@ -165,6 +149,7 @@ in {
type = enum (attrNames formats);
default = defaultFormat;
};
package = mkOption {
description = "Nix formatter package";
type = package;
@ -188,7 +173,18 @@ in {
assertions = [
{
assertion = cfg.format.type != "nixpkgs-fmt";
message = "nixpkgs-fmt has been archived upstream. Please use one of the following instead: ${concatStringsSep ", " (attrNames formats)}";
message = ''
nixpkgs-fmt has been archived upstream. Please use one of the following available formatters:
${concatStringsSep ", " (attrNames formats)}
'';
}
{
assertion = cfg.lsp.server != "rnix";
message = ''
rnix-lsp has been archived upstream. Please use one of the following available language servers:
${concatStringsSep ", " (attrNames servers)}
'';
}
];
vim.pluginRC.nix = ''

View file

@ -24,12 +24,6 @@ in {
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
setupOpts = mkPluginSetupOption "Obsidian.nvim" {
dir = mkOption {
type = str;
default = "~/my-vault";
description = "Obsidian vault directory";
};
daily_notes = {
folder = mkOption {
type = nullOr str;

View file

@ -2,6 +2,7 @@
imports = [
./noice
./modes
./nvim-ufo
./notifications
./smartcolumn
./colorizer

View file

@ -0,0 +1,20 @@
{
lib,
config,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.ui.nvim-ufo;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["promise-async"];
lazy.plugins.nvim-ufo = {
package = "nvim-ufo";
setupModule = "ufo";
inherit (cfg) setupOpts;
};
};
};
}

View file

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

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.ui.nvim-ufo = {
enable = mkEnableOption "nvim-ufo";
setupOpts = mkPluginSetupOption "nvim-ufo" {};
};
}

View file

@ -1,5 +1,6 @@
{
imports = [
./outline
./binds
./ccc
./gestures

View file

@ -15,9 +15,10 @@
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in {
config = mkIf cfg.enable {
vim.startPlugins = ["gesture-nvim"];
vim = {
startPlugins = ["gesture-nvim"];
vim.maps.normal = mkMerge [
maps.normal = mkMerge [
(mkSetLuaBinding mappings.draw "require('gesture').draw")
(mkSetLuaBinding mappings.finish "require('gesture').finish")
(mkIf (mappings.draw.value == "<RightDrag>") {
@ -25,20 +26,21 @@ in {
})
];
vim.pluginRC.gesture-nvim = entryAnywhere ''
vim.opt.mouse = "a"
options.mouse = "a";
pluginRC.gesture-nvim = entryAnywhere ''
local gesture = require("gesture")
gesture.register({
name = "scroll to bottom",
inputs = { gesture.up(), gesture.down() },
action = "normal! G",
})
gesture.register({
name = "next tab",
inputs = { gesture.right() },
action = "tabnext",
})
gesture.register({
name = "previous tab",
inputs = { gesture.left() },
@ -46,6 +48,7 @@ in {
vim.cmd.tabprevious()
end,
})
gesture.register({
name = "go back",
inputs = { gesture.right(), gesture.left() },
@ -54,4 +57,5 @@ in {
})
'';
};
};
}

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./gesture-nvim.nix
./config.nix

View file

@ -0,0 +1,14 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.utility.outline.aerial-nvim = {
enable = mkEnableOption "Aerial.nvim";
setupOpts = mkPluginSetupOption "aerial.nvim" {};
mappings = {
toggle = mkMappingOption "Toggle aerial window" "gO";
};
};
}

View file

@ -0,0 +1,42 @@
{
options,
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) mkKeymap;
cfg = config.vim.utility.outline.aerial-nvim;
inherit (options.vim.utility.outline.aerial-nvim) mappings;
in {
config = mkIf cfg.enable {
vim = {
lazy.plugins.aerial-nvim = {
package = "aerial-nvim";
setupModule = "aerial";
inherit (cfg) setupOpts;
cmd = [
"AerialClose"
"AerialCloseAll"
"AerialGo"
"AerialInfo"
"AerialNavClose"
"AerialNavOpen"
"AerialNavToggle"
"AerialNext"
"AerialOpen"
"AerialOpenAll"
"AerialPrev"
"AerialToggle"
];
keys = [
(mkKeymap "n" cfg.mappings.toggle ":AerialToggle<CR>" {desc = mappings.toggle.description;})
];
};
};
};
}

View file

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

View file

@ -0,0 +1,5 @@
{
imports = [
./aerial-nvim
];
}

View file

@ -22,6 +22,12 @@ in {
package = "telescope";
setupModule = "telescope";
inherit (cfg) setupOpts;
# HACK: workaround until https://github.com/NotAShelf/nvf/issues/535 gets resolved
before = ''
vim.g.loaded_telescope = nil
'';
after = ''
local telescope = require("telescope")
${optionalString config.vim.ui.noice.enable "telescope.load_extension('noice')"}

View file

@ -1,18 +1,22 @@
{
config,
lib,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.meta) getExe;
cfg = config.vim.utility.vim-wakatime;
in {
config = mkIf cfg.enable {
vim.startPlugins = [pkgs.vimPlugins.vim-wakatime];
vim = {
startPlugins = [pkgs.vimPlugins.vim-wakatime];
vim.pluginRC.vim-wakatime = mkIf (cfg.cli-package != null) ''
vim.g.wakatime_CLIPath = "${cfg.cli-package}"
'';
# Wakatime configuration is stored as vim globals.
globals = {
"wakatime_CLIPath" = mkIf (cfg.cli-package != null) "${getExe cfg.cli-package}";
};
};
};
}

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./config.nix
./vim-wakatime.nix

View file

@ -1,18 +1,24 @@
{
lib,
pkgs,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) nullOr package;
in {
options.vim.utility.vim-wakatime = {
enable = mkEnableOption "vim-wakatime: live code statistics";
enable = mkEnableOption ''
automatic time tracking and metrics generated from your programming activity [vim-wakatime]
'';
cli-package = mkOption {
type = nullOr package;
default = pkgs.wakatime;
description = "The package that should be used for wakatime-cli. Set as null to use the default path in `$XDG_DATA_HOME`";
default = pkgs.wakatime-cli;
example = null;
description = ''
The package that should be used for wakatime-cli.
Set as null to use the default path in {env}`$XDG_DATA_HOME`
'';
};
};
}

View file

@ -49,6 +49,17 @@
flutter-tools-patched = buildPlug {
pname = "flutter-tools";
patches = [./patches/flutter-tools.patch];
# Disable failing require check hook checks
nvimSkipModule = [
"flutter-tools.devices"
"flutter-tools.dap"
"flutter-tools.runners.job_runner"
"flutter-tools.decorations"
"flutter-tools.commands"
"flutter-tools.executable"
"flutter-tools.dev_tools"
];
};
};

View file

@ -3,9 +3,11 @@
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
inherit (lib.options) mkOption literalMD literalExpression;
inherit (lib.strings) optionalString;
inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything;
inherit (lib.trivial) isBool;
inherit (lib.nvim.languages) toVimBool;
inherit (lib.nvim.types) dagOf;
inherit (lib.nvim.lua) listToLuaTable;
@ -17,7 +19,7 @@ in {
default = false;
example = true;
description = ''
[{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
[official documentation]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
the experimental Lua module loader to speed up the start up process
@ -29,7 +31,7 @@ in {
::: {.note}
The Lua module loader is *disabled* by default. Before setting this option, please
take a look at the [{option}`official documentation`]. This option may be enabled by
take a look at the {option}`[official documentation]`. This option may be enabled by
default in the future.
:::
'';
@ -81,7 +83,7 @@ in {
./nvim/my-lua-file.lua
# source type path - pure and reproducible
(builtins.source {
(builtins.path {
path = ./nvim/my-lua-file.lua;
name = "my-lua-file";
})
@ -121,6 +123,21 @@ in {
default = ",";
description = "The key used for `<localleader>` mappings";
};
editorconfig = mkOption {
type = bool;
default = true;
description = ''
Whether to enable EditorConfig integration in Neovim.
This defaults to true as it is enabled by default in stock
Neovim, setting this option to false disables EditorConfig
integration entirely.
See [Neovim documentation](https://neovim.io/doc/user/editorconfig.html)
for more details on configuring EditorConfig behaviour.
'';
};
};
};
@ -150,16 +167,25 @@ in {
};
mouse = mkOption {
type = enum ["a" "n" "v" "i" "c"];
default = "a";
type = str;
default = "nvi";
example = "a";
description = ''
Set modes for mouse support.
* a - all
* n - normal
* v - visual
* i - insert
* c - command
* c - command-line
* h - all modes when editing a help file
* a - all modes
* r - for hit-enter and more-prompt prompt
[neovim documentation]: https://neovim.io/doc/user/options.html#'mouse'"
This option takes a string to ensure proper conversion to the corresponding Lua type.
As such, we do not check the value passed to this option. Please ensure that any value
that is set here is a valid value as per [neovim documentation].
'';
};
@ -211,6 +237,16 @@ in {
description = "Enable word wrapping.";
};
signcolumn = mkOption {
type = either str bool;
default = true;
apply = x:
if isBool x
then toVimBool x # convert to a yes/no str
else x;
description = "Show the sign column";
};
tabstop = mkOption {
type = int;
default = 8; # Neovim default
@ -263,7 +299,11 @@ in {
vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths})
''}
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
${optionalString cfg.enableLuaLoader ''
if vim.loader then
vim.loader.enable()
end
''}
'';
defaultText = literalMD ''
@ -273,7 +313,7 @@ in {
if [](#opt-vim.enableLuaLoader) is set to true.
'';
example = literalExpression ''"$${builtins.readFile ./my-lua-config-pre.lua}"'';
example = literalExpression ''''${builtins.readFile ./my-lua-config-pre.lua}'';
description = ''
Verbatim lua code that will be inserted **before**