mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
Merge branch 'main' into colorful-menu
This commit is contained in:
commit
b4dac8d635
264 changed files with 5007 additions and 1795 deletions
|
@ -12,6 +12,7 @@
|
|||
inherit
|
||||
(
|
||||
(lib.evalModules {
|
||||
specialArgs = {inherit inputs;};
|
||||
modules =
|
||||
import ../modules/modules.nix {
|
||||
inherit lib pkgs;
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
# Configuring nvf {#ch-configuring}
|
||||
|
||||
[helpful tips section]: #ch-helpful-tips
|
||||
|
||||
nvf allows for _very_ extensive configuration in Neovim through the Nix module
|
||||
interface. The below chapters describe several of the options exposed in nvf for
|
||||
your convenience. You might also be interested in the [helpful tips section] for
|
||||
more advanced or unusual configuration options supported by nvf.
|
||||
|
||||
Note that this section does not cover module _options_. For an overview of all
|
||||
module options provided by nvf, please visit the [appendix](/nvf/options.html)
|
||||
|
||||
```{=include=} chapters
|
||||
configuring/custom-package.md
|
||||
configuring/custom-plugins.md
|
||||
|
@ -7,4 +17,5 @@ configuring/overriding-plugins.md
|
|||
configuring/languages.md
|
||||
configuring/dags.md
|
||||
configuring/dag-entries.md
|
||||
configuring/autocmds.md
|
||||
```
|
||||
|
|
119
docs/manual/configuring/autocmds.md
Normal file
119
docs/manual/configuring/autocmds.md
Normal file
|
@ -0,0 +1,119 @@
|
|||
# Autocommands and Autogroups {#ch-autocmds-augroups}
|
||||
|
||||
This module allows you to declaratively configure Neovim autocommands and
|
||||
autogroups within your Nix configuration.
|
||||
|
||||
## Autogroups (`vim.augroups`) {#sec-vim-augroups}
|
||||
|
||||
Autogroups (`augroup`) organize related autocommands. This allows them to be
|
||||
managed collectively, such as clearing them all at once to prevent duplicates.
|
||||
Each entry in the list is a submodule with the following options:
|
||||
|
||||
| Option | Type | Default | Description | Example |
|
||||
| :------- | :----- | :------ | :--------------------------------------------------------------------------------------------------- | :---------------- |
|
||||
| `enable` | `bool` | `true` | Enables or disables this autogroup definition. | `true` |
|
||||
| `name` | `str` | _None_ | **Required.** The unique name for the autogroup. | `"MyFormatGroup"` |
|
||||
| `clear` | `bool` | `true` | Clears any existing autocommands within this group before adding new ones defined in `vim.autocmds`. | `true` |
|
||||
|
||||
**Example:**
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.augroups = [
|
||||
{
|
||||
name = "MyCustomAuGroup";
|
||||
clear = true; # Clear previous autocommands in this group on reload
|
||||
}
|
||||
{
|
||||
name = "Formatting";
|
||||
# clear defaults to true
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Autocommands (`vim.autocmds`) {#sec-vim-autocmds}
|
||||
|
||||
Autocommands (`autocmd`) trigger actions based on events happening within Neovim
|
||||
(e.g., saving a file, entering a buffer). Each entry in the list is a submodule
|
||||
with the following options:
|
||||
|
||||
| Option | Type | Default | Description | Example |
|
||||
| :--------- | :-------------------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------- |
|
||||
| `enable` | `bool` | `true` | Enables or disables this autocommand definition. | `true` |
|
||||
| `event` | `nullOr (listOf str)` | `null` | **Required.** List of Neovim events that trigger this autocommand (e.g., `BufWritePre`, `FileType`). | `[ "BufWritePre" ]` |
|
||||
| `pattern` | `nullOr (listOf str)` | `null` | List of file patterns (globs) to match against (e.g., `*.py`, `*`). If `null`, matches all files for the given event. | `[ "*.lua", "*.nix" ]` |
|
||||
| `callback` | `nullOr luaInline` | `null` | A Lua function to execute when the event triggers. Use `lib.nvim.types.luaInline` or `lib.options.literalExpression "mkLuaInline '''...'''"`. **Cannot be used with `command`.** | `lib.nvim.types.luaInline "function() print('File saved!') end"` |
|
||||
| `command` | `nullOr str` | `null` | A Vimscript command to execute when the event triggers. **Cannot be used with `callback`.** | `"echo 'File saved!'"` |
|
||||
| `group` | `nullOr str` | `null` | The name of an `augroup` (defined in `vim.augroups`) to associate this autocommand with. | `"MyCustomAuGroup"` |
|
||||
| `desc` | `nullOr str` | `null` | A description for the autocommand (useful for introspection). | `"Format buffer on save"` |
|
||||
| `once` | `bool` | `false` | If `true`, the autocommand runs only once and then automatically removes itself. | `false` |
|
||||
| `nested` | `bool` | `false` | If `true`, allows this autocommand to trigger other autocommands. | `false` |
|
||||
|
||||
:::{.warning}
|
||||
|
||||
You cannot define both `callback` (for Lua functions) and `command` (for
|
||||
Vimscript) for the same autocommand. Choose one.
|
||||
|
||||
:::
|
||||
|
||||
**Examples:**
|
||||
|
||||
```nix
|
||||
{ lib, ... }:
|
||||
{
|
||||
vim.augroups = [ { name = "UserSetup"; } ];
|
||||
|
||||
vim.autocmds = [
|
||||
# Example 1: Using a Lua callback
|
||||
{
|
||||
event = [ "BufWritePost" ];
|
||||
pattern = [ "*.lua" ];
|
||||
group = "UserSetup";
|
||||
desc = "Notify after saving Lua file";
|
||||
callback = lib.nvim.types.luaInline ''
|
||||
function()
|
||||
vim.notify("Lua file saved!", vim.log.levels.INFO)
|
||||
end
|
||||
'';
|
||||
}
|
||||
|
||||
# Example 2: Using a Vim command
|
||||
{
|
||||
event = [ "FileType" ];
|
||||
pattern = [ "markdown" ];
|
||||
group = "UserSetup";
|
||||
desc = "Set spellcheck for Markdown";
|
||||
command = "setlocal spell";
|
||||
}
|
||||
|
||||
# Example 3: Autocommand without a specific group
|
||||
{
|
||||
event = [ "BufEnter" ];
|
||||
pattern = [ "*.log" ];
|
||||
desc = "Disable line numbers in log files";
|
||||
command = "setlocal nonumber";
|
||||
# No 'group' specified
|
||||
}
|
||||
|
||||
# Example 4: Using Lua for callback
|
||||
{
|
||||
event = [ "BufWinEnter" ];
|
||||
pattern = [ "*" ];
|
||||
desc = "Simple greeting on entering a buffer window";
|
||||
callback = lib.generators.mkLuaInline ''
|
||||
function(args)
|
||||
print("Entered buffer: " .. args.buf)
|
||||
end
|
||||
'';
|
||||
|
||||
# Run only once per session trigger
|
||||
once = true;
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
These definitions are automatically translated into the necessary Lua code to
|
||||
configure `vim.api.nvim_create_augroup` and `vim.api.nvim_create_autocmd` when
|
||||
Neovim starts.
|
|
@ -1,12 +1,12 @@
|
|||
# Custom Neovim Package {#ch-custom-package}
|
||||
|
||||
As of v0.5, you may now specify the Neovim package that will be wrapped with
|
||||
your configuration. This is done with the `vim.package` option.
|
||||
your configuration. This is done with the [](#opt-vim.package) option.
|
||||
|
||||
```nix
|
||||
{inputs, pkgs, ...}: {
|
||||
# using the neovim-nightly overlay
|
||||
vim.package = inputs.neovim-overlay.packages.${pkgs.system}.neovim;
|
||||
vim.package = inputs.neovim-overlay.packages.${pkgs.stdenv.system}.neovim;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,22 +1,33 @@
|
|||
# Custom Plugins {#ch-custom-plugins}
|
||||
|
||||
**nvf**, by default, exposes a wide variety of plugins as module options for
|
||||
your convenience and bundles necessary dependencies into **nvf**'s runtime. In
|
||||
case a plugin is not available in **nvf**, you may consider making a pull
|
||||
request to **nvf** to include it as a module or you may add it to your
|
||||
configuration locally.
|
||||
**nvf** exposes a very wide variety of plugins by default, which are consumed by
|
||||
module options. This is done for your convenience, and to bundle all necessary
|
||||
dependencies into **nvf**'s runtime with full control of versioning, testing and
|
||||
dependencies. In the case a plugin you need is _not_ available, you may consider
|
||||
making a pull request to add the package you're looking for, or you may add it
|
||||
to your configuration locally. The below section describes how new plugins may
|
||||
be added to the user's configuration.
|
||||
|
||||
## Adding Plugins {#ch-adding-plugins}
|
||||
|
||||
There are multiple ways of adding custom plugins to your **nvf** configuration.
|
||||
Per **nvf**'s design choices, there are several ways of adding custom plugins to
|
||||
your configuration as you need them. As we aim for extensive configuration, it
|
||||
is possible to add custom plugins (from nixpkgs, pinning tools, flake inputs,
|
||||
etc.) to your Neovim configuration before they are even implemented in **nvf**
|
||||
as a module.
|
||||
|
||||
You can use custom plugins, before they are implemented in the flake. To add a
|
||||
plugin to the runtime, you need to add it to the [](#opt-vim.startPlugins) list
|
||||
in your configuration.
|
||||
:::{.info}
|
||||
|
||||
Adding a plugin to `startPlugins` will not allow you to configure the plugin
|
||||
that you have added, but **nvf** provides multiple way of configuring any custom
|
||||
plugins that you might have added to your configuration.
|
||||
To add a plugin to your runtime, you will need to add it to
|
||||
[](#opt-vim.startPlugins) list in your configuration. This is akin to cloning a
|
||||
plugin to `~/.config/nvim`, but they are only ever placed in the Nix store and
|
||||
never exposed to the outside world for purity and full isolation.
|
||||
|
||||
:::
|
||||
|
||||
As you would configure a cloned plugin, you must configure the new plugins that
|
||||
you've added to `startPlugins.` **nvf** provides multiple ways of configuring
|
||||
any custom plugins that you might have added to your configuration.
|
||||
|
||||
```{=include=} sections
|
||||
custom-plugins/configuring.md
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
# Configuring {#sec-configuring-plugins}
|
||||
|
||||
Just making the plugin to your Neovim configuration available might not always
|
||||
be enough. In that case, you can write custom lua config using either
|
||||
`config.vim.lazy.plugins.*.setupOpts` `config.vim.extraPlugins.*.setup` or
|
||||
`config.vim.luaConfigRC`.
|
||||
be enough., for example, if the plugin requires a setup table. In that case, you
|
||||
can write custom Lua configuration using one of
|
||||
|
||||
The first option uses an extended version of `lz.n`'s PluginSpec. `setupModule`
|
||||
and `setupOpt` can be used if the plugin uses a `require('module').setup(...)`
|
||||
pattern. Otherwise, the `before` and `after` hooks should do what you need.
|
||||
- `config.vim.lazy.plugins.*.setupOpts`
|
||||
- `config.vim.extraPlugins.*.setup`
|
||||
- `config.vim.luaConfigRC`.
|
||||
|
||||
## Lazy Plugins {#ch-vim-lazy-plugins}
|
||||
|
||||
`config.vim.lazy.plugins.*.setupOpts` is useful for lazy-loading plugins, and
|
||||
uses an extended version of `lz.n's` `PluginSpec` to expose a familiar
|
||||
interface. `setupModule` and `setupOpt` can be used if the plugin uses a
|
||||
`require('module').setup(...)` pattern. Otherwise, the `before` and `after`
|
||||
hooks should do what you need.
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -25,50 +32,61 @@ pattern. Otherwise, the `before` and `after` hooks should do what you need.
|
|||
}
|
||||
```
|
||||
|
||||
The second option uses an attribute set, which maps DAG section names to a
|
||||
## Standard API {#ch-vim-extra-plugins}
|
||||
|
||||
`vim.extraPlugins` uses an attribute set, which maps DAG section names to a
|
||||
custom type, which has the fields `package`, `after`, `setup`. They allow you to
|
||||
set the package of the plugin, the sections its setup code should be after (note
|
||||
that the `extraPlugins` option has its own DAG scope), and the its setup code
|
||||
respectively. For example:
|
||||
|
||||
```nix
|
||||
config.vim.extraPlugins = with pkgs.vimPlugins; {
|
||||
aerial = {
|
||||
package = aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
{pkgs, ...}: {
|
||||
config.vim.extraPlugins = {
|
||||
aerial = {
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
|
||||
harpoon = {
|
||||
package = harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"]; # place harpoon configuration after aerial
|
||||
harpoon = {
|
||||
package = pkgs.vimPlugins.harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"]; # place harpoon configuration after aerial
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
The third option also uses an attribute set, but this one is resolved as a DAG
|
||||
### Setup using luaConfigRC {#setup-using-luaconfigrc}
|
||||
|
||||
`vim.luaConfigRC` also uses an attribute set, but this one is resolved as a DAG
|
||||
directly. The attribute names denote the section names, and the values lua code.
|
||||
For example:
|
||||
|
||||
```nix
|
||||
{
|
||||
# this will create an "aquarium" section in your init.lua with the contents of your custom config
|
||||
# which will be *appended* to the rest of your configuration, inside your init.vim
|
||||
# This will create a section called "aquarium" in the 'init.lua' with the
|
||||
# contents of your custom configuration. By default 'entryAnywhere' is implied
|
||||
# in DAGs, so this will be inserted to an arbitrary position. In the case you
|
||||
# wish to control the position of this section with more precision, please
|
||||
# look into the DAGs section of the manual.
|
||||
config.vim.luaConfigRC.aquarium = "vim.cmd('colorscheme aquiarum')";
|
||||
}
|
||||
```
|
||||
|
||||
<!-- deno-fmt-ignore-start -->
|
||||
[DAG system]: #ch-using-dags
|
||||
[DAG section]: #ch-dag-entries
|
||||
|
||||
::: {.note}
|
||||
One of the greatest strengths of nvf is the ability to order
|
||||
snippets of configuration via the DAG system. It will allow specifying positions
|
||||
of individual sections of configuration as needed. nvf provides helper functions
|
||||
One of the **greatest strengths** of **nvf** is the ability to order
|
||||
configuration snippets precisely using the [DAG system]. DAGs
|
||||
are a very powerful mechanism that allows specifying positions
|
||||
of individual sections of configuration as needed. We provide helper functions
|
||||
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
|
||||
use.
|
||||
|
||||
Please refer to the [DAG section](#ch-dag-entries) in the nvf manual
|
||||
Please refer to the [DAG section] in the nvf manual
|
||||
to find out more about the DAG system.
|
||||
:::
|
||||
|
||||
<!-- deno-fmt-ignore-end -->
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Lazy Method {#sec-lazy-method}
|
||||
|
||||
As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
|
||||
`lz.n` and `lzn-auto-require`.
|
||||
As of version **0.7**, an API is exposed to allow configuring lazy-loaded
|
||||
plugins via `lz.n` and `lzn-auto-require`. Below is a comprehensive example of
|
||||
how it may be loaded to lazy-load an arbitrary plugin.
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -41,7 +42,8 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
|
|||
|
||||
## LazyFile event {#sec-lazyfile-event}
|
||||
|
||||
You can use the `LazyFile` user event to load a plugin when a file is opened:
|
||||
**nvf** re-implements `LazyFile` as a familiar user event to load a plugin when
|
||||
a file is opened:
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -55,5 +57,6 @@ You can use the `LazyFile` user event to load a plugin when a file is opened:
|
|||
}
|
||||
```
|
||||
|
||||
You can consider `LazyFile` as an alias to
|
||||
`["BufReadPost" "BufNewFile" "BufWritePre"]`
|
||||
You can consider the `LazyFile` event as an alias to the combination of
|
||||
`"BufReadPost"`, `"BufNewFile"` and `"BufWritePre"`, i.e., a list containing all
|
||||
three of those events: `["BufReadPost" "BufNewFile" "BufWritePre"]`
|
||||
|
|
|
@ -1,26 +1,31 @@
|
|||
# Legacy Method {#sec-legacy-method}
|
||||
|
||||
Prior to version v0.5, the method of adding new plugins was adding the plugin
|
||||
package to `vim.startPlugins` and add its configuration as a DAG under one of
|
||||
`vim.configRC` or `vim.luaConfigRC`. Users who have not yet updated to 0.5, or
|
||||
prefer a more hands-on approach may use the old method where the load order of
|
||||
the plugins is determined by DAGs.
|
||||
Prior to version **0.5**, the method of adding new plugins was adding the plugin
|
||||
package to [](#opt-vim.startPlugins) and adding its configuration as a DAG under
|
||||
one of `vim.configRC` or [](#opt-vim.luaConfigRC). While `configRC` has been
|
||||
deprecated, users who have not yet updated to 0.5 or those who prefer a more
|
||||
hands-on approach may choose to use the old method where the load order of the
|
||||
plugins is explicitly determined by DAGs without internal abstractions.
|
||||
|
||||
## Adding plugins {#sec-adding-plugins}
|
||||
## Adding New Plugins {#sec-adding-new-plugins}
|
||||
|
||||
To add a plugin not available in nvf as a module to your configuration, you may
|
||||
add it to [](#opt-vim.startPlugins) in order to make it available to Neovim at
|
||||
runtime.
|
||||
To add a plugin not available in **nvf** as a module to your configuration using
|
||||
the legacy method, you must add it to [](#opt-vim.startPlugins) in order to make
|
||||
it available to Neovim at runtime.
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
# Add a Neovim plugin from Nixpkgs to the runtime.
|
||||
# This does not need to come explicitly from packages. 'vim.startPlugins'
|
||||
# takes a list of *string* (to load internal plugins) or *package* to load
|
||||
# a Neovim package from any source.
|
||||
vim.startPlugins = [pkgs.vimPlugins.aerial-nvim];
|
||||
}
|
||||
```
|
||||
|
||||
And to configure the added plugin, you can use the `luaConfigRC` option to
|
||||
provide configuration as a DAG using the **nvf** extended library.
|
||||
Once the package is available in Neovim's runtime, you may use the `luaConfigRC`
|
||||
option to provide configuration as a DAG using the **nvf** extended library in
|
||||
order to configure the added plugin,
|
||||
|
||||
```nix
|
||||
{inputs, ...}: let
|
||||
|
@ -29,6 +34,8 @@ provide configuration as a DAG using the **nvf** extended library.
|
|||
# to specialArgs, the 'inputs' prefix may be omitted.
|
||||
inherit (inputs.nvf.lib.nvim.dag) entryAnywhere;
|
||||
in {
|
||||
# luaConfigRC takes Lua configuration verbatim and inserts it at an arbitrary
|
||||
# position by default or if 'entryAnywhere' is used.
|
||||
vim.luaConfigRC.aerial-nvim= entryAnywhere ''
|
||||
require('aerial').setup {
|
||||
-- your configuration here
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
# Non-lazy Method {#sec-non-lazy-method}
|
||||
|
||||
As of version **0.5**, we have a more extensive API for configuring plugins,
|
||||
under `vim.extraPlugins`. Instead of using DAGs exposed by the library, you may
|
||||
use the extra plugin module as follows:
|
||||
As of version **0.5**, we have a more extensive API for configuring plugins that
|
||||
should be preferred over the legacy method. This API is available as
|
||||
[](#opt-vim.extraPlugins). Instead of using DAGs exposed by the library
|
||||
_directly_, you may use the extra plugin module as follows:
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.extraPlugins = with pkgs.vimPlugins; {
|
||||
{pkgs, ...}: {
|
||||
config.vim.extraPlugins = {
|
||||
aerial = {
|
||||
package = aerial-nvim;
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
setup = ''
|
||||
require('aerial').setup {
|
||||
-- some lua configuration here
|
||||
|
@ -17,10 +18,12 @@ use the extra plugin module as follows:
|
|||
};
|
||||
|
||||
harpoon = {
|
||||
package = harpoon;
|
||||
package = pkgs.vimPlugins.harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
This provides a level of abstraction over the DAG system for faster iteration.
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
# LSP Custom Packages/Command {#sec-languages-custom-lsp-packages}
|
||||
|
||||
In any of the `opt.languages.<language>.lsp.package` options you can provide
|
||||
your own LSP package, or provide the command to launch the language server, as a
|
||||
list of strings. You can use this to skip automatic installation of a language
|
||||
server, and instead use the one found in your `$PATH` during runtime, for
|
||||
example:
|
||||
One of the strengths of **nvf** is convenient aliases to quickly configure LSP
|
||||
servers through the Nix module system. By default the LSP packages for relevant
|
||||
language modules will be pulled into the closure. If this is not desirable, you
|
||||
may provide **a custom LSP package** (e.g., a Bash script that calls a command)
|
||||
or **a list of strings** to be interpreted as the command to launch the language
|
||||
server. By using a list of strings, you can use this to skip automatic
|
||||
installation of a language server, and instead use the one found in your `$PATH`
|
||||
during runtime, for example:
|
||||
|
||||
```nix
|
||||
vim.languages.java = {
|
||||
lsp = {
|
||||
enable = true;
|
||||
# this expects jdt-language-server to be in your PATH
|
||||
# or in `vim.extraPackages`
|
||||
|
||||
# This expects 'jdt-language-server' to be in your PATH or in
|
||||
# 'vim.extraPackages.' There are no additional checks performed to see
|
||||
# if the command provided is valid.
|
||||
package = ["jdt-language-server" "-data" "~/.cache/jdtls/workspace"];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
The [additional plugins section](#sec-additional-plugins) details the addition
|
||||
of new plugins to nvf under regular circumstances, i.e. while making a pull
|
||||
request to the project. You may _override_ those plugins in your config
|
||||
to change source versions, e.g., to use newer versions of plugins
|
||||
that are not yet updated in **nvf**.
|
||||
request to the project. You may _override_ those plugins in your config to
|
||||
change source versions, e.g., to use newer versions of plugins that are not yet
|
||||
updated in **nvf**.
|
||||
|
||||
```nix
|
||||
vim.pluginOverrides = {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# Default Configs {#ch-default-configs}
|
||||
|
||||
While you can configure **nvf** yourself using the builder, you can also use the
|
||||
pre-built configs that are available. Here are a few default configurations you
|
||||
can use.
|
||||
|
||||
```{=include=} chapters
|
||||
default-configs/maximal.md
|
||||
default-configs/nix.md
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
# Maximal {#sec-default-maximal}
|
||||
|
||||
```bash
|
||||
$ nix shell github:notashelf/nvf#maximal test.nix
|
||||
```
|
||||
|
||||
It is the same fully configured Neovim as with the [Nix](#sec-default-nix)
|
||||
configuration, but with every supported language enabled.
|
||||
|
||||
::: {.note} Running the maximal config will download _a lot_ of packages as it
|
||||
is downloading language servers, formatters, and more. :::
|
|
@ -1,9 +0,0 @@
|
|||
# Nix {#sec-default-nix}
|
||||
|
||||
```bash
|
||||
$ nix run github:notashelf/nvf#nix test.nix
|
||||
```
|
||||
|
||||
Enables all the of Neovim plugins, with language support for specifically Nix.
|
||||
This lets you see what a fully configured neovim setup looks like without
|
||||
downloading a whole bunch of language servers and associated tools.
|
|
@ -1,25 +1,92 @@
|
|||
# Adding Plugins {#sec-additional-plugins}
|
||||
|
||||
To add a new Neovim plugin, use `npins`
|
||||
There are two methods for adding new Neovim plugins to **nvf**. npins is the
|
||||
faster option that should be preferred if the plugin consists of pure Lua or
|
||||
Vimscript code. In which case there is no building required, and we can easily
|
||||
handle the copying of plugin files. Alternative method, which is required when
|
||||
plugins try to build their own libraries (e.g., in Rust or C) that need to be
|
||||
built with Nix to function correctly.
|
||||
|
||||
Use:
|
||||
## With npins {#sec-npins-for-plugins}
|
||||
|
||||
`nix-shell -p npins` or `nix shell nixpkgs#npins`
|
||||
npins is the standard method of adding new plugins to **nvf**. You simply need
|
||||
the repository URL for the plugin, and can add it as a source to be built
|
||||
automatically with one command. To add a new Neovim plugin, use `npins`. For
|
||||
example:
|
||||
|
||||
```bash
|
||||
nix-shell -p npins # or nix shell nixpkgs#npins if using flakes
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
`npins add --name <plugin name> github <owner> <repo> -b <branch>`
|
||||
```bash
|
||||
npins add --name <plugin name> github <owner> <repo> -b <branch>
|
||||
```
|
||||
|
||||
Be sure to replace any non-alphanumeric characters with `-` for `--name`
|
||||
::: {.note}
|
||||
|
||||
For example
|
||||
Be sure to replace any non-alphanumeric characters with `-` for `--name`. For
|
||||
example
|
||||
|
||||
`npins add --name lazydev-nvim github folke lazydev.nvim -b main`
|
||||
```bash
|
||||
npins add --name lazydev-nvim github folke lazydev.nvim -b main
|
||||
```
|
||||
|
||||
You can now reference this plugin as a **string**.
|
||||
:::
|
||||
|
||||
Once the `npins` command is done, you can start referencing the plugin as a
|
||||
**string**.
|
||||
|
||||
```nix
|
||||
config.vim.startPlugins = ["lazydev-nvim"];
|
||||
{
|
||||
config.vim.startPlugins = ["lazydev-nvim"];
|
||||
}
|
||||
```
|
||||
|
||||
## Packaging Complex Plugins {#sec-pkgs-for-plugins}
|
||||
|
||||
[blink.cmp]: https://github.com/Saghen/blink.cmp
|
||||
|
||||
Some plugins require additional packages to be built and substituted to function
|
||||
correctly. For example [blink.cmp] requires its own fuzzy matcher library, built
|
||||
with Rust, to be installed or else defaults to a much slower Lua implementation.
|
||||
In the Blink documentation, you are advised to build with `cargo` but that is
|
||||
not ideal since we are leveraging the power of Nix. In this case the ideal
|
||||
solution is to write a derivation for the plugin.
|
||||
|
||||
We use `buildRustPackage` to build the library from the repository root, and
|
||||
copy everything in the `postInstall` phase.
|
||||
|
||||
```nix
|
||||
postInstall = ''
|
||||
cp -r {lua,plugin} "$out"
|
||||
|
||||
mkdir -p "$out/doc"
|
||||
cp 'doc/'*'.txt' "$out/doc/"
|
||||
|
||||
mkdir -p "$out/target"
|
||||
mv "$out/lib" "$out/target/release"
|
||||
'';
|
||||
```
|
||||
|
||||
In a similar fashion, you may utilize `stdenv.mkDerivation` and other Nixpkgs
|
||||
builders to build your library from source, and copy the relevant files and Lua
|
||||
plugin files in the `postInstall` phase. Do note, however, that you still need
|
||||
to fetch the plugin sources somehow. npins is, once again, the recommended
|
||||
option to fetch the plugin sources. Refer to the previous section on how to use
|
||||
npins to add a new plugin.
|
||||
|
||||
Plugins built from source must go into the `flake/pkgs/by-name` overlay. It will
|
||||
automatically create flake outputs for individual packages. Lastly, you must add
|
||||
your package to the plugin builder (`pluginBuilders`) function manually in
|
||||
`modules/wrapper/build/config.nix`. Once done, you may refer to your plugin as a
|
||||
**string**.
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.startPlugins = ["blink-cmp"];
|
||||
}
|
||||
```
|
||||
|
||||
## Modular setup options {#sec-modular-setup-options}
|
||||
|
@ -70,7 +137,7 @@ in {
|
|||
}
|
||||
```
|
||||
|
||||
This above config will result in this lua script:
|
||||
This above config will result in this Lua script:
|
||||
|
||||
```lua
|
||||
require('plugin-name').setup({
|
||||
|
@ -101,23 +168,41 @@ own fields!
|
|||
As you've seen above, `toLuaObject` is used to convert our nix attrSet
|
||||
`cfg.setupOpts`, into a lua table. Here are some rules of the conversion:
|
||||
|
||||
1. nix `null` converts to lua `nil`
|
||||
2. number and strings convert to their lua counterparts
|
||||
3. nix attrSet/list convert into lua tables
|
||||
4. you can write raw lua code using `lib.generators.mkLuaInline`. This function
|
||||
is part of nixpkgs.
|
||||
1. Nix `null` converts to lua `nil`
|
||||
2. Number and strings convert to their lua counterparts
|
||||
3. Nix attribute sets (`{}`) and lists (`[]`) convert into Lua dictionaries and
|
||||
tables respectively. Here is an example of Nix -> Lua conversion.
|
||||
- `{foo = "bar"}` -> `{["foo"] = "bar"}`
|
||||
- `["foo" "bar"]` -> `{"foo", "bar"}`
|
||||
4. You can write raw Lua code using `lib.generators.mkLuaInline`. This function
|
||||
is part of nixpkgs, and is accessible without relying on **nvf**'s extended
|
||||
library.
|
||||
- `mkLuaInline "function add(a, b) return a + b end"` will yield the
|
||||
following result:
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
_type = "lua-inline";
|
||||
expr = "function add(a, b) return a + b end";
|
||||
}
|
||||
```
|
||||
|
||||
```nix
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
}
|
||||
```
|
||||
The above expression will be interpreted as a Lua expression in the final
|
||||
config. Without the `mkLuaInline` function, you will only receive a string
|
||||
literal. You can use it to feed plugin configuration tables Lua functions
|
||||
that return specific values as expected by the plugins.
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Lazy plugins {#sec-lazy-plugins}
|
||||
|
||||
|
@ -126,25 +211,24 @@ Lazy plugins are managed by `lz.n`.
|
|||
|
||||
```nix
|
||||
# in modules/.../your-plugin/config.nix
|
||||
{lib, config, ...}:
|
||||
let
|
||||
{config, ...}: let
|
||||
cfg = config.vim.your-plugin;
|
||||
in {
|
||||
vim.lazy.plugins.your-plugin = {
|
||||
# instead of vim.startPlugins, use this:
|
||||
# Instead of vim.startPlugins, use this:
|
||||
package = "your-plugin";
|
||||
|
||||
# if your plugin uses the `require('your-plugin').setup{...}` pattern
|
||||
# ıf your plugin uses the `require('your-plugin').setup{...}` pattern
|
||||
setupModule = "your-plugin";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
# events that trigger this plugin to be loaded
|
||||
# Events that trigger this plugin to be loaded
|
||||
event = ["DirChanged"];
|
||||
cmd = ["YourPluginCommand"];
|
||||
|
||||
# keymaps
|
||||
# Plugin Keymaps
|
||||
keys = [
|
||||
# we'll cover this in detail in the keymaps section
|
||||
# We'll cover this in detail in the 'keybinds' section
|
||||
{
|
||||
key = "<leader>d";
|
||||
mode = "n";
|
||||
|
@ -152,7 +236,6 @@ in {
|
|||
}
|
||||
];
|
||||
};
|
||||
;
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -163,7 +246,9 @@ require('lz.n').load({
|
|||
{
|
||||
"name-of-your-plugin",
|
||||
after = function()
|
||||
require('your-plugin').setup({--[[ your setupOpts ]]})
|
||||
require('your-plugin').setup({
|
||||
--[[ your setupOpts ]]--
|
||||
})
|
||||
end,
|
||||
|
||||
event = {"DirChanged"},
|
||||
|
@ -175,5 +260,7 @@ require('lz.n').load({
|
|||
})
|
||||
```
|
||||
|
||||
A full list of options can be found
|
||||
[here](https://notashelf.github.io/nvf/options.html#opt-vim.lazy.plugins
|
||||
[`vim.lazy.plugins` spec]: https://notashelf.github.io/nvf/options.html#opt-vim.lazy.plugins
|
||||
|
||||
A full list of options can be found in the [`vim.lazy.plugins` spec] on the
|
||||
rendered manual.
|
||||
|
|
|
@ -30,8 +30,8 @@ There are many settings available in the options. Please refer to the
|
|||
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.keymaps) to
|
||||
see a list of them.
|
||||
|
||||
**nvf** provides a helper function, so that you don't have to write the
|
||||
mapping attribute sets every time:
|
||||
**nvf** provides a helper function, so that you don't have to write the mapping
|
||||
attribute sets every time:
|
||||
|
||||
- `mkKeymap`, which mimics neovim's `vim.keymap.set` function
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ An example flake that exposes your custom Neovim configuration might look like
|
|||
theme.enable = true;
|
||||
|
||||
# Enable Treesitter
|
||||
tree-sitter.enable = true;
|
||||
treesitter.enable = true;
|
||||
|
||||
# Other options will go here. Refer to the config
|
||||
# reference in Appendix B of the nvf manual.
|
||||
|
|
33
docs/manual/installation/modules/flakes.md
Normal file
33
docs/manual/installation/modules/flakes.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
### Prerequisites {#sec-flakes-prerequisites}
|
||||
|
||||
To install nvf with flakes, you must make sure the following requirements are
|
||||
met.
|
||||
|
||||
1. Nix 2.4 or later must be installed. You may use `nix-shell` to get a later
|
||||
version of Nix from nixpkgs.
|
||||
2. Flake-related experimental features must be enabled. Namely, you need
|
||||
`nix-command` and `flakes`. Some Nix vendors enable those by default, please
|
||||
consult their documentation if you are not using mainstream Nix.
|
||||
- When using NixOS, add the following to your `configuration.nix` and rebuild
|
||||
your system.
|
||||
|
||||
```nix
|
||||
nix.settings.experimental-features = "nix-command flakes";
|
||||
```
|
||||
|
||||
- If you are not using NixOS, add the following to `nix.conf` (located at
|
||||
`~/.config/nix/` or `/etc/nix/nix.conf`).
|
||||
|
||||
```bash
|
||||
experimental-features = nix-command flakes
|
||||
```
|
||||
|
||||
- You may need to restart the Nix daemon with, for example,
|
||||
`sudo systemctl restart nix-daemon.service`.
|
||||
|
||||
- Alternatively, you can enable flakes on a per-command basis with the
|
||||
following additional flags to `nix` and `home-manager`:
|
||||
|
||||
```sh
|
||||
$ nix --extra-experimental-features "nix-command flakes" <sub-commands>
|
||||
```
|
|
@ -5,9 +5,18 @@ inside the home-manager configuration without having to call for the wrapper
|
|||
yourself. It is the recommended way to use **nvf** alongside the NixOS module
|
||||
depending on your needs.
|
||||
|
||||
To use it, we first add the input flake.
|
||||
## With Flakes {#sec-hm-flakes}
|
||||
|
||||
```{=include=}
|
||||
flakes.md
|
||||
```
|
||||
|
||||
### Usage {#sec-hm-flakes-usage}
|
||||
|
||||
To use **nvf** with flakes, we first need to add the input to our `flake.nix`.
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
inputs = {
|
||||
# Optional, if you intend to follow nvf's obsidian-nvim input
|
||||
|
@ -16,7 +25,7 @@ To use it, we first add the input flake.
|
|||
|
||||
# Required, nvf works best and only directly supports flakes
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
url = "github:NotAShelf/nvf";
|
||||
# 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.
|
||||
|
@ -25,6 +34,8 @@ To use it, we first add the input flake.
|
|||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
|
||||
# ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
@ -39,7 +50,7 @@ Followed by importing the home-manager module somewhere in your configuration.
|
|||
}
|
||||
```
|
||||
|
||||
## Example Installation {#sec-example-installation-hm}
|
||||
### Example Installation {#sec-example-installation-hm}
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -66,7 +77,8 @@ Once the module is properly imported by your host, you will be able to use the
|
|||
`programs.nvf` module option anywhere in your configuration in order to
|
||||
configure **nvf**.
|
||||
|
||||
```nix{
|
||||
```nix
|
||||
{
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
# your settings need to go into the settings attribute set
|
||||
|
@ -89,3 +101,45 @@ installation sections of the manual. You may find all available options in the
|
|||
[appendix](https://notashelf.github.io/nvf/options)
|
||||
|
||||
:::
|
||||
|
||||
## Without Flakes {#sec-hm-flakeless}
|
||||
|
||||
As of v0.8, it is possible to install **nvf** on a system if you are not using
|
||||
flakes. This is possible thanks to the flake-compat project.
|
||||
|
||||
To get started, you must fetch the repository using `builtins.fetchTarball` or a
|
||||
similar mechanism.
|
||||
|
||||
```nix
|
||||
# home.nix
|
||||
let
|
||||
nvf = import (builtins.fetchTarball {
|
||||
url = "https://github.com/notashelf/nvf/archive/<commit or tag>.tar.gz";
|
||||
# Optionally, you can add 'sha256' for verification and caching
|
||||
# sha256 = "<sha256>";
|
||||
});
|
||||
in {
|
||||
imports = [
|
||||
# Import the NixOS module from your fetched input
|
||||
nvf.homeManagerModules.nvf
|
||||
];
|
||||
|
||||
# Once the module is imported, you may use `programs.nvf` as exposed by the
|
||||
# NixOS module.
|
||||
programs.nvf.enable = true;
|
||||
}
|
||||
```
|
||||
|
||||
[npins]: https://github.com/andir/npins
|
||||
[niv]: https://github.com/nmattia/niv
|
||||
|
||||
::: {.tip}
|
||||
|
||||
Nix2 does not have a builtin lockfile mechanism like flakes. As such you must
|
||||
manually update the URL and hash for your input. This is annoying to deal with,
|
||||
and most users choose to defer this task to projects such as [npins] or [niv].
|
||||
If you are new to NixOS, I encourage you to look into Flakes and see if they fit
|
||||
your use case. Alternatively, look into the aforementioned projects for more
|
||||
convenient dependency management mechanisms.
|
||||
|
||||
:::
|
||||
|
|
|
@ -5,9 +5,18 @@ the NixOS configuration without having to call for the wrapper yourself. It is
|
|||
the recommended way to use **nvf** alongside the home-manager module depending
|
||||
on your needs.
|
||||
|
||||
To use it, we first add the input flake.
|
||||
## With Flakes {#sec-nixos-flakes}
|
||||
|
||||
```{=include=}
|
||||
flakes.md
|
||||
```
|
||||
|
||||
### Usage {#sec-nixos-flakes-usage}
|
||||
|
||||
To use **nvf** with flakes, we first need to add the input to our `flake.nix`.
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
inputs = {
|
||||
# Optional, if you intend to follow nvf's obsidian-nvim input
|
||||
|
@ -16,7 +25,7 @@ To use it, we first add the input flake.
|
|||
|
||||
# Required, nvf works best and only directly supports flakes
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
url = "github:NotAShelf/nvf";
|
||||
# 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.
|
||||
|
@ -25,6 +34,8 @@ To use it, we first add the input flake.
|
|||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
|
||||
# ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
@ -39,7 +50,7 @@ Followed by importing the NixOS module somewhere in your configuration.
|
|||
}
|
||||
```
|
||||
|
||||
## Example Installation {#sec-example-installation-nixos}
|
||||
### Example Installation {#sec-example-installation-nixos}
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -64,10 +75,12 @@ Once the module is properly imported by your host, you will be able to use the
|
|||
`programs.nvf` module option anywhere in your configuration in order to
|
||||
configure **nvf**.
|
||||
|
||||
```nix{
|
||||
```nix
|
||||
{
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
# your settings need to go into the settings attribute set
|
||||
|
||||
# Your settings need to go into the settings attribute set
|
||||
# most settings are documented in the appendix
|
||||
settings = {
|
||||
vim.viAlias = false;
|
||||
|
@ -87,3 +100,45 @@ installation sections of the manual. You may find all available options in the
|
|||
[appendix](https://notashelf.github.io/nvf/options)
|
||||
|
||||
:::
|
||||
|
||||
## Without Flakes {#sec-nixos-flakeless}
|
||||
|
||||
As of v0.8, it is possible to install **nvf** on a system if you are not using
|
||||
flakes. This is possible thanks to the flake-compat project.
|
||||
|
||||
To get started, you must fetch the repository using `builtins.fetchTarball` or a
|
||||
similar mechanism.
|
||||
|
||||
```nix
|
||||
# configuration.nix
|
||||
let
|
||||
nvf = import (builtins.fetchTarball {
|
||||
url = "https://github.com/notashelf/nvf/archive/<commit or tag>.tar.gz";
|
||||
# Optionally, you can add 'sha256' for verification and caching
|
||||
# sha256 = "<sha256>";
|
||||
});
|
||||
in {
|
||||
imports = [
|
||||
# Import the NixOS module from your fetched input
|
||||
nvf.nixosModules.nvf
|
||||
];
|
||||
|
||||
# Once the module is imported, you may use `programs.nvf` as exposed by the
|
||||
# NixOS module.
|
||||
programs.nvf.enable = true;
|
||||
}
|
||||
```
|
||||
|
||||
[npins]: https://github.com/andir/npins
|
||||
[niv]: https://github.com/nmattia/niv
|
||||
|
||||
::: {.tip}
|
||||
|
||||
Nix2 does not have a builtin lockfile mechanism like flakes. As such you must
|
||||
manually update the URL and hash for your input. This is annoying to deal with,
|
||||
and most users choose to defer this task to projects such as [npins] or [niv].
|
||||
If you are new to NixOS, I encourage you to look into Flakes and see if they fit
|
||||
your use case. Alternatively, look into the aforementioned projects for more
|
||||
convenient dependency management mechanisms.
|
||||
|
||||
:::
|
||||
|
|
|
@ -49,7 +49,8 @@ the default theme enabled. You may use other options inside `config.vim` in
|
|||
# ...
|
||||
modules = [
|
||||
# This will make wrapped neovim available in your system packages
|
||||
# Can also move this to another config file if you pass inputs/self around with specialArgs
|
||||
# Can also move this to another config file if you pass your own
|
||||
# inputs/self around with specialArgs
|
||||
({pkgs, ...}: {
|
||||
environment.systemPackages = [self.packages.${pkgs.stdenv.system}.neovim];
|
||||
})
|
||||
|
@ -58,4 +59,5 @@ the default theme enabled. You may use other options inside `config.vim` in
|
|||
};
|
||||
};
|
||||
};
|
||||
}```
|
||||
}
|
||||
```
|
||||
|
|
|
@ -8,7 +8,6 @@ try-it-out.md
|
|||
```
|
||||
|
||||
```{=include=} parts
|
||||
default-configs.md
|
||||
installation.md
|
||||
configuring.md
|
||||
tips.md
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
# Helpful Tips {#ch-helpful-tips}
|
||||
|
||||
This section provides helpful tips that may be considered "unorthodox" or "too
|
||||
advanced" for some users. We will cover basic debugging steps, offline
|
||||
documentation, configuring **nvf** with pure Lua and using custom plugin sources
|
||||
in **nvf** in this section. For general configuration tips, please see previous
|
||||
chapters.
|
||||
|
||||
```{=include=} chapters
|
||||
tips/pure-lua-config.md
|
||||
tips/debugging-nvf.md
|
||||
tips/offline-docs.md
|
||||
tips/pure-lua-config.md
|
||||
tips/plugin-sources.md
|
||||
```
|
||||
|
|
131
docs/manual/tips/plugin-sources.md
Normal file
131
docs/manual/tips/plugin-sources.md
Normal file
|
@ -0,0 +1,131 @@
|
|||
# Adding Plugins From Different Sources {#sec-plugin-sources}
|
||||
|
||||
**nvf** attempts to avoid depending on Nixpkgs for Neovim plugins. For the most
|
||||
part, this is accomplished by defining each plugin's source and building them
|
||||
from source.
|
||||
|
||||
[npins]: https://github.com/andir/npins
|
||||
|
||||
To define plugin sources, we use [npins] and pin each plugin source using
|
||||
builtin fetchers. You are not bound by this restriction. In your own
|
||||
configuration, any kind of fetcher or plugin source is fine.
|
||||
|
||||
## Nixpkgs & Friends {#ch-plugins-from-nixpkgs}
|
||||
|
||||
`vim.startPlugins` and `vim.optPlugins` options take either a **string**, in
|
||||
which case a plugin from nvf's internal plugins registry will be used, or a
|
||||
**package**. If your plugin does not require any setup, or ordering for it s
|
||||
configuration, then it is possible to add it to `vim.startPlugins` to load it on
|
||||
startup.
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
# Aerial does require some setup. In the case you pass a plugin that *does*
|
||||
# require manual setup, then you must also call the setup function.
|
||||
vim.startPlugins = [pkgs.vimPlugins.aerial-nvim];
|
||||
}
|
||||
```
|
||||
|
||||
[`vim.extraPlugins`]: https://notashelf.github.io/nvf/options.html#opt-vim.extraPlugins
|
||||
|
||||
This will fetch aerial.nvim from nixpkgs, and add it to Neovim's runtime path to
|
||||
be loaded manually. Although for plugins that require manual setup, you are
|
||||
encouraged to use [`vim.extraPlugins`].
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.extraPlugins = {
|
||||
aerial = {
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
[custom plugins section]: https://notashelf.github.io/nvf/index.xhtml#ch-custom-plugins
|
||||
|
||||
More details on the extraPlugins API is documented in the
|
||||
[custom plugins section].
|
||||
|
||||
## Building Your Own Plugins {#ch-plugins-from-source}
|
||||
|
||||
In the case a plugin is not available in Nixpkgs, or the Nixpkgs package is
|
||||
outdated (or, more likely, broken) it is possible to build the plugins from
|
||||
source using a tool, such as [npins]. You may also use your _flake inputs_ as
|
||||
sources.
|
||||
|
||||
Example using plugin inputs:
|
||||
|
||||
```nix
|
||||
{
|
||||
# In your flake.nix
|
||||
inputs = {
|
||||
aerial-nvim = {
|
||||
url = "github:stevearc/aerial.nvim"
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
# Make sure that 'inputs' is properly propagated into Nvf, for example, through
|
||||
# specialArgs.
|
||||
outputs = { ... };
|
||||
}
|
||||
```
|
||||
|
||||
In the case, you may use the input directly for the plugin's source attribute in
|
||||
`buildVimPlugin`.
|
||||
|
||||
```nix
|
||||
# Make sure that 'inputs' is properly propagated! It will be missing otherwise
|
||||
# and the resulting errors might be too obscure.
|
||||
{inputs, ...}: let
|
||||
aerial-from-source = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "aerial-nvim";
|
||||
src = inputs.aerial-nvim;
|
||||
};
|
||||
in {
|
||||
vim.extraPlugins = {
|
||||
aerial = {
|
||||
package = aerial-from-source;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively, if you do not want to keep track of the source using flake inputs
|
||||
or npins, you may call `fetchFromGitHub` (or other fetchers) directly. An
|
||||
example would look like this.
|
||||
|
||||
```nix
|
||||
regexplainer = buildVimPlugin {
|
||||
name = "nvim-regexplainer";
|
||||
src = fetchFromGitHub {
|
||||
owner = "bennypowers";
|
||||
repo = "nvim-regexplainer";
|
||||
rev = "4250c8f3c1307876384e70eeedde5149249e154f";
|
||||
hash = "sha256-15DLbKtOgUPq4DcF71jFYu31faDn52k3P1x47GL3+b0=";
|
||||
};
|
||||
|
||||
# The 'buildVimPlugin' imposes some "require checks" on all plugins build from
|
||||
# source. Failing tests, if they are not relevant, can be disabled using the
|
||||
# 'nvimSkipModule' argument to the 'buildVimPlugin' function.
|
||||
nvimSkipModule = [
|
||||
"regexplainer"
|
||||
"regexplainer.buffers.init"
|
||||
"regexplainer.buffers.popup"
|
||||
"regexplainer.buffers.register"
|
||||
"regexplainer.buffers.shared"
|
||||
"regexplainer.buffers.split"
|
||||
"regexplainer.component.descriptions"
|
||||
"regexplainer.component.init"
|
||||
"regexplainer.renderers.narrative.init"
|
||||
"regexplainer.renderers.narrative.narrative"
|
||||
"regexplainer.renderers.init"
|
||||
"regexplainer.utils.defer"
|
||||
"regexplainer.utils.init"
|
||||
"regexplainer.utils.treesitter"
|
||||
];
|
||||
}
|
||||
```
|
|
@ -23,7 +23,7 @@ manner.
|
|||
# flake.nix. For the sake of the argument, we will assume that the Neovim lua
|
||||
# configuration is in a nvim/ directory relative to flake.nix.
|
||||
vim = {
|
||||
additionalRuntimeDirectories = [
|
||||
additionalRuntimePaths = [
|
||||
# This will be added to Neovim's runtime paths. Conceptually, this behaves
|
||||
# very similarly to ~/.config/nvim but you may not place a top-level
|
||||
# init.lua to be able to require it directly.
|
||||
|
@ -41,7 +41,7 @@ directory, and call it with [](#opt-vim.luaConfigRC).
|
|||
```nix
|
||||
{pkgs, ...}: {
|
||||
vim = {
|
||||
additionalRuntimeDirectories = [
|
||||
additionalRuntimePaths = [
|
||||
# You can list more than one file here.
|
||||
./nvim-custom-1
|
||||
|
||||
|
|
|
@ -5,19 +5,20 @@ installing it to your machine. Below are the commands you may run to try out
|
|||
different configurations provided by this flake. As of v0.5, two specialized
|
||||
configurations are provided:
|
||||
|
||||
- **Nix** - Nix language server + simple utility plugins
|
||||
- **Maximal** - Variable language servers + utility and decorative plugins
|
||||
- **Nix** (`packages.nix`) - Nix language server + simple utility plugins
|
||||
- **Maximal** (`packages.maximal`) - Variable language servers + utility and
|
||||
decorative plugins
|
||||
|
||||
You may try out any of the provided configurations using the `nix run` command
|
||||
on a system where Nix is installed.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
$ cachix use nvf # Optional: it'll save you CPU resources and time
|
||||
$ nix run github:notashelf/nvf#nix # will run the default minimal configuration
|
||||
$ nix run github:notashelf/nvf#nix # Will run the default minimal configuration
|
||||
```
|
||||
|
||||
Do keep in mind that this is **susceptible to garbage collection** meaning it
|
||||
will be removed from your Nix store once you garbage collect.
|
||||
Do keep in mind that this is **susceptible to garbage collection** meaning that
|
||||
the built outputs will be removed from your Nix store once you garbage collect.
|
||||
|
||||
## Using Prebuilt Configs {#sec-using-prebuilt-configs}
|
||||
|
||||
|
@ -26,7 +27,12 @@ $ nix run github:notashelf/nvf#nix
|
|||
$ nix run github:notashelf/nvf#maximal
|
||||
```
|
||||
|
||||
### Available Configs {#sec-available-configs}
|
||||
### Available Configurations {#sec-available-configs}
|
||||
|
||||
::: {.info}
|
||||
|
||||
The below configurations are provided for demonstration purposes, and are
|
||||
**not** designed to be installed as is. You may
|
||||
|
||||
#### Nix {#sec-configs-nix}
|
||||
|
||||
|
@ -34,15 +40,33 @@ $ nix run github:notashelf/nvf#maximal
|
|||
a set of visual and functional plugins. By running `nix run .#`, which is the
|
||||
default package, you will build Neovim with this config.
|
||||
|
||||
```bash
|
||||
$ nix run github:notashelf/nvf#nix test.nix
|
||||
```
|
||||
|
||||
This command will start Neovim with some opinionated plugin configurations, and
|
||||
is designed specifically for Nix. the `nix` configuration lets you see how a
|
||||
fully configured Neovim setup _might_ look like without downloading too many
|
||||
packages or shell utilities.
|
||||
|
||||
#### Maximal {#sec-configs-maximal}
|
||||
|
||||
`Maximal` is the ultimate configuration that will enable support for more
|
||||
commonly used language as well as additional complementary plugins. Keep in
|
||||
mind, however, that this will pull a lot of dependencies.
|
||||
|
||||
::: {.tip}
|
||||
```bash
|
||||
$ nix run github:notashelf/nvf#maximal -- test.nix
|
||||
```
|
||||
|
||||
You are _strongly_ recommended to use the binary cache if you would like to try
|
||||
the Maximal configuration.
|
||||
It uses the same configuration template with the [Nix](#sec-configs-nix)
|
||||
configuration, but supports many more languages, and enables more utility,
|
||||
companion or fun plugins.
|
||||
|
||||
::: {.warning}
|
||||
|
||||
Running the maximal config will download _a lot_ of packages as it is
|
||||
downloading language servers, formatters, and more. If CPU time and bandwidth
|
||||
are concerns, please use the default package instead.
|
||||
|
||||
:::
|
||||
|
|
|
@ -50,9 +50,8 @@ soon.
|
|||
|
||||
- A new section has been added for language support: `vim.languages.<language>`.
|
||||
|
||||
- The options [](#opt-vim.languages.enableLSP),
|
||||
[](#opt-vim.languages.enableTreesitter), etc. will enable the respective
|
||||
section for all languages that have been enabled.
|
||||
- The options `enableLSP` [](#opt-vim.languages.enableTreesitter), etc. will
|
||||
enable the respective section for all languages that have been enabled.
|
||||
- All LSP languages have been moved here
|
||||
- `plantuml` and `markdown` have been moved here
|
||||
- A new section has been added for `html`. The old
|
||||
|
|
|
@ -91,7 +91,7 @@ Release notes for release 0.5
|
|||
- Updated indent-blankine.nvim to v3 - this comes with a few option changes,
|
||||
which will be migrated with `renamedOptionModule`
|
||||
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
[poz](https://poz.pet):
|
||||
|
||||
- Fixed scrollOffset not being used
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
|
||||
- Added rose-pine theme.
|
||||
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
[poz](https://poz.pet):
|
||||
|
||||
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete
|
||||
window popup only when manually activated.
|
||||
|
|
|
@ -162,7 +162,7 @@ The changes are, in no particular order:
|
|||
- Add [lz.n] support and lazy-load some builtin plugins.
|
||||
- Add simpler helper functions for making keymaps
|
||||
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
[poz](https://poz.pet):
|
||||
|
||||
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
||||
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
|
||||
|
|
|
@ -19,6 +19,15 @@
|
|||
unavailable as they have been refactored out of the main none-ls repository
|
||||
upstream.
|
||||
|
||||
- `vim.useSystemClipboard` has been deprecated as a part of removing most
|
||||
top-level convenience options, and should instead be configured in the new
|
||||
module interface. You may set [](#opt-vim.clipboard.registers) appropriately
|
||||
to configure Neovim to use the system clipboard.
|
||||
|
||||
- Changed which-key group used for gitsigns from `<leader>g` to `<leader>h` to
|
||||
align with the "hunks" themed mapping and avoid conflict with the new [neogit]
|
||||
group.
|
||||
|
||||
[NotAShelf](https://github.com/notashelf):
|
||||
|
||||
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
||||
|
@ -27,6 +36,9 @@
|
|||
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
|
||||
[snacks.nvim]: https://github.com/folke/snacks.nvim
|
||||
[colorful-menu.nvim]: https://github.com/xzbdmw/colorful-menu.nvim
|
||||
[oil.nvim]: https://github.com/stevearc/oil.nvim
|
||||
[hunk.nvim]: https://github.com/julienvincent/hunk.nvim
|
||||
[undotree]: https://github.com/mbbill/undotree
|
||||
|
||||
- Add [typst-preview.nvim] under
|
||||
`languages.typst.extensions.typst-preview-nvim`.
|
||||
|
@ -86,6 +98,18 @@
|
|||
|
||||
- Add [colorful-menu.nvim] to enhance the completion menus, with optional
|
||||
integration for blink-cmp and nvim-cmp
|
||||
- Add [oil.nvim] as an alternative file explorer. It will be available under
|
||||
`vim.utility.oil-nvim`.
|
||||
- Add `vim.diagnostics` to interact with Neovim's diagnostics module. Available
|
||||
options for `vim.diagnostic.config()` can now be customized through the
|
||||
[](#opt-vim.diagnostics.config) in nvf.
|
||||
|
||||
- Add `vim.clipboard` module for easily managing Neovim clipboard providers and
|
||||
relevant packages in a simple UI.
|
||||
- This deprecates `vim.useSystemClipboard` as well, see breaking changes
|
||||
section above for migration options.
|
||||
- Add [hunk.nvim], Neovim plugin & tool for splitting diffs in Neovim. Available
|
||||
as `vim.git.hunk-nvim`
|
||||
|
||||
[amadaluzia](https://github.com/amadaluzia):
|
||||
|
||||
|
@ -102,6 +126,10 @@
|
|||
- Add [blink.cmp] support.
|
||||
- Add `LazyFile` user event.
|
||||
- Migrate language modules from none-ls to conform/nvim-lint
|
||||
- Add tsx support in conform and lint
|
||||
- Moved code setting `additionalRuntimePaths` and `enableLuaLoader` out of
|
||||
`luaConfigPre`'s default to prevent being overridden
|
||||
- Use conform over custom autocmds for LSP format on save
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
|
@ -194,6 +222,7 @@
|
|||
Inspiration from `vim.languages.clang.dap` implementation.
|
||||
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
|
||||
- Add [codecompanion.nvim] plugin under `vim.assistant.codecompanion-nvim`.
|
||||
- Fix [codecompanion-nvim] plugin: nvim-cmp error and setupOpts defaults.
|
||||
|
||||
[nezia1](https://github.com/nezia1):
|
||||
|
||||
|
@ -270,6 +299,7 @@
|
|||
[BANanaD3V](https://github.com/BANanaD3V):
|
||||
|
||||
- `alpha` is now configured with nix.
|
||||
- Add `markview-nvim` markdown renderer.
|
||||
|
||||
[viicslen](https://github.com/viicslen):
|
||||
|
||||
|
@ -283,6 +313,12 @@
|
|||
[rice-cracker-dev](https://github.com/rice-cracker-dev):
|
||||
|
||||
- `eslint_d` now checks for configuration files to load.
|
||||
- Fix an error where `eslint_d` fails to load.
|
||||
- Add required files support for linters under
|
||||
`vim.diagnostics.nvim-lint.linters.*.required_files`.
|
||||
- Add global function `nvf_lint` under
|
||||
`vim.diagnostics.nvim-lint.lint_function`.
|
||||
- Deprecate `vim.scrollOffset` in favor of `vim.options.scrolloff`.
|
||||
|
||||
[Sc3l3t0n](https://github.com/Sc3l3t0n):
|
||||
|
||||
|
@ -292,6 +328,15 @@
|
|||
|
||||
- Add lint (luacheck) and formatting (stylua) support for Lua.
|
||||
- Add lint (markdownlint-cli2) support for Markdown.
|
||||
- Add catppuccin integration for Bufferline, Lspsaga.
|
||||
- Add `neo-tree`, `snacks.explorer` integrations to `bufferline`.
|
||||
- Add more applicable filetypes to illuminate denylist.
|
||||
- Disable mini.indentscope for applicable filetypes.
|
||||
- Fix fzf-lua having a hard dependency on fzf.
|
||||
- Enable inlay hints support - `config.vim.lsp.inlayHints`.
|
||||
- Add `neo-tree`, `snacks.picker` extensions to `lualine`.
|
||||
- Add support for `vim.lsp.formatOnSave` and
|
||||
`vim.lsp.mappings.toggleFormatOnSave`
|
||||
|
||||
[tebuevd](https://github.com/tebuevd):
|
||||
|
||||
|
@ -300,3 +345,144 @@
|
|||
`setupOpts.pickers.find_files`
|
||||
- Update default `telescope.setupOpts.pickers.find_files.find_command` to only
|
||||
include files (and therefore exclude directories from results)
|
||||
|
||||
[ckoehler](https://github.com/ckoehler):
|
||||
|
||||
[flash.nvim]: https://github.com/folke/flash.nvim
|
||||
[gitlinker.nvim]: https://github.com/linrongbin16/gitlinker.nvim
|
||||
[nvim-treesitter-textobjects]: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||
|
||||
- Fix oil config referencing snacks
|
||||
- Add [flash.nvim] plugin to `vim.utility.motion.flash-nvim`
|
||||
- Fix default telescope ignore list entry for '.git/' to properly match
|
||||
- Add [gitlinker.nvim] plugin to `vim.git.gitlinker-nvim`
|
||||
- Add [nvim-treesitter-textobjects] plugin to `vim.treesitter.textobjects`
|
||||
- Default to disabling Conform for Rust if rust-analyzer is used
|
||||
- To force using Conform, set `languages.rust.format.enable = true`.
|
||||
|
||||
[rrvsh](https://github.com/rrvsh):
|
||||
|
||||
- Add custom snippet support to `vim.snippets.luasnip`
|
||||
- Fix namespace of python-lsp-server by changing it to python3Packages
|
||||
|
||||
[Noah765](https://github.com/Noah765):
|
||||
|
||||
[vim-sleuth]: https://github.com/tpope/vim-sleuth
|
||||
|
||||
- Add missing `flutter-tools.nvim` dependency `plenary.nvim`.
|
||||
- Add necessary dependency of `flutter-tools.nvim` on lsp.
|
||||
- Add the `vim.languages.dart.flutter-tools.flutterPackage` option.
|
||||
- Fix the type of the `highlight` color options.
|
||||
- Add [vim-sleuth] plugin under `vim.utility.sleuth`.
|
||||
|
||||
[howird](https://github.com/howird):
|
||||
|
||||
- Change python dap adapter name from `python` to commonly expected `debugpy`.
|
||||
|
||||
[aionoid](https://github.com/aionoid):
|
||||
|
||||
[avante-nvim]: https://github.com/yetone/avante.nvim
|
||||
|
||||
- Fix [render-markdown.nvim] file_types option type to list, to accept merging.
|
||||
- Add [avante.nvim] plugin under `vim.assistant.avante-nvim`.
|
||||
|
||||
[poz](https://poz.pet):
|
||||
|
||||
[everforest]: https://github.com/sainnhe/everforest
|
||||
|
||||
- Fix gitsigns null-ls issue.
|
||||
- Add [everforest] theme support.
|
||||
|
||||
[Haskex](https://github.com/haskex):
|
||||
|
||||
[Hardtime.nvim]: https://github.com/m4xshen/hardtime.nvim
|
||||
|
||||
- Add Plugin [Hardtime.nvim] under `vim.binds.hardtime-nvim` with `enable` and
|
||||
`setupOpts` options
|
||||
|
||||
[taylrfnt](https://github.com/taylrfnt):
|
||||
|
||||
[nvim-tree](https://github.com/nvim-tree/nvim-tree.lua):
|
||||
|
||||
- Add missing `right_align` option for existing `renderer.icons` options.
|
||||
- Add missing `render.icons` options (`hidden_placement`,
|
||||
`diagnostics_placement`, and `bookmarks_placement`).
|
||||
|
||||
[cramt](https://github.com/cramt):
|
||||
|
||||
- Add `rubylsp` option in `vim.languages.ruby.lsp.server` to use shopify's
|
||||
ruby-lsp language server
|
||||
|
||||
[Haskex](https://github.com/haskex):
|
||||
|
||||
[solarized-osaka.nvim]: https://github.com/craftzdog/solarized-osaka.nvim
|
||||
|
||||
- Add [solarized-osaka.nvim] theme
|
||||
|
||||
[img-clip.nvim]: https://github.com/hakonharnes/img-clip.nvim
|
||||
|
||||
- Add [img-clip.nvim] plugin in `vim.utility.images.img-clip` with `enable` and
|
||||
`setupOpts`
|
||||
- Add `vim.utility.images.img-clip.enable = isMaximal` in configuration.nix
|
||||
|
||||
[anil9](https://github.com/anil9):
|
||||
|
||||
[clojure-lsp]: https://github.com/clojure-lsp/clojure-lsp
|
||||
[conjure]: https://github.com/Olical/conjure
|
||||
|
||||
- Add Clojure support under `vim.languages.clojure` using [clojure-lsp]
|
||||
- Add code evaluation environment [conjure] under `vim.repl.conjure`
|
||||
|
||||
[CallumGilly](https://github.com/CallumGilly):
|
||||
|
||||
- Add missing `transparent` option for existing
|
||||
[onedark.nvim](https://github.com/navarasu/onedark.nvim) theme.
|
||||
|
||||
[theutz](https://github.com/theutz):
|
||||
|
||||
- Added "auto" flavour for catppuccin theme
|
||||
|
||||
[lackac](https://github.com/lackac):
|
||||
|
||||
[solarized.nvim]: https://github.com/maxmx03/solarized.nvim
|
||||
[smart-splits.nvim]: https://github.com/mrjones2014/smart-splits.nvim
|
||||
[neogit]: https://github.com/NeogitOrg/neogit
|
||||
|
||||
- Add [solarized.nvim] theme with support for multiple variants
|
||||
- Add [smart-splits.nvim] for navigating between Neovim windows and terminal
|
||||
multiplexer panes. Available at `vim.utility.smart-splits`.
|
||||
- Restore vim-dirtytalk plugin and fix ordering with spellcheck in generated
|
||||
config.
|
||||
- Fix lualine separator options
|
||||
- Add [neogit], an interactive and powerful Git interface for Neovim, inspired
|
||||
by Magit
|
||||
- Allow deregistering which-key binds or groups by setting them to `null`
|
||||
|
||||
[justDeeevin](https://github.com/justDeeevin):
|
||||
|
||||
[supermaven-nvim]: https://github.com/supermaven-inc/supermaven-nvim
|
||||
|
||||
- Add [supermaven-nvim] plugin in `vim.assistant.supermaven-nvim` with `enable`
|
||||
and `setupOpts`
|
||||
|
||||
[trueNAHO](https://github.com/trueNAHO):
|
||||
|
||||
- `flake-parts`'s `nixpkgs-lib` input follows nvf's `nixpkgs` input to reduce
|
||||
download size.
|
||||
|
||||
- `flake-utils`'s `systems` inputs follows nvf's `systems` input to transitively
|
||||
leverage the pattern introduced in commit
|
||||
[fc8206e7a61d ("flake: utilize
|
||||
nix-systems for overridable flake systems")](https://github.com/NotAShelf/nvf/commit/fc8206e7a61d7eb02006f9010e62ebdb3336d0d2).
|
||||
|
||||
[soliprem](https://github.com/soliprem):
|
||||
|
||||
- fix broken `neorg` grammars
|
||||
- remove obsolete warning in the `otter` module
|
||||
|
||||
[Cool-Game-Dev](https://github.com/Cool-Game-Dev):
|
||||
|
||||
[nvim-biscuits]: https://github.com/code-biscuits/nvim-biscuits
|
||||
|
||||
- Add [nvim-biscuits] to show block context. Available at
|
||||
`vim.utility.nvim-biscuits`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue