mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-15 00:58:37 +00:00
Compare commits
11 commits
96b4092b06
...
c83df6ad27
Author | SHA1 | Date | |
---|---|---|---|
c83df6ad27 | |||
![]() |
ed31499ad6 | ||
![]() |
a6f8df6785 | ||
![]() |
b1212b77ce | ||
![]() |
51d76dd515 | ||
![]() |
eedb3dd8c4 | ||
![]() |
da57f955df | ||
7b58caaa9f | |||
15fbd146aa | |||
902ffe710b | |||
b463792348 |
12 changed files with 226 additions and 37 deletions
|
@ -32,16 +32,18 @@ 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
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
|
|
@ -5,10 +5,10 @@ under `vim.extraPlugins`. Instead of using DAGs exposed by the library, 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,7 +17,7 @@ use the extra plugin module as follows:
|
|||
};
|
||||
|
||||
harpoon = {
|
||||
package = harpoon;
|
||||
package = pkgs.vimPlugins.harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"];
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Helpful Tips {#ch-helpful-tips}
|
||||
|
||||
```{=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"
|
||||
];
|
||||
}
|
||||
```
|
|
@ -199,6 +199,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):
|
||||
|
||||
|
@ -288,6 +289,7 @@
|
|||
[rice-cracker-dev](https://github.com/rice-cracker-dev):
|
||||
|
||||
- `eslint_d` now checks for configuration files to load.
|
||||
- Fixed an error where `eslint_d` fails to load.
|
||||
|
||||
[Sc3l3t0n](https://github.com/Sc3l3t0n):
|
||||
|
||||
|
|
|
@ -126,6 +126,20 @@ in {
|
|||
autocmds = mkOption {
|
||||
type = listOf autocommandType;
|
||||
default = [];
|
||||
example = literalExpression ''
|
||||
[
|
||||
{
|
||||
enable = true;
|
||||
desc = "Highlight yanks on copy";
|
||||
pattern = ["*"];
|
||||
callback = lib.generators.mkLuaInline '''
|
||||
function()
|
||||
vim.highlight.on_yank({ timeout = 500 })
|
||||
end
|
||||
''';
|
||||
}
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
A list of Neovim autocommands to be registered.
|
||||
|
||||
|
|
|
@ -9,7 +9,14 @@ in {
|
|||
|
||||
setupOpts = mkPluginSetupOption "codecompanion-nvim" {
|
||||
opts = {
|
||||
send_code = mkEnableOption "code from being sent to the LLM.";
|
||||
send_code =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable code being sent to the LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
log_level = mkOption {
|
||||
type = enum ["DEBUG" "INFO" "ERROR" "TRACE"];
|
||||
|
@ -30,7 +37,10 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "a diff view to see the changes made by the LLM.";
|
||||
description = ''
|
||||
Whether to enable a diff view
|
||||
to see the changes made by the LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
close_chat_at = mkOption {
|
||||
|
@ -64,7 +74,12 @@ in {
|
|||
};
|
||||
|
||||
chat = {
|
||||
auto_scroll = mkEnableOption "automatic page scrolling.";
|
||||
auto_scroll =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Whether to enable automatic page scrolling.";
|
||||
};
|
||||
|
||||
show_settings = mkEnableOption ''
|
||||
LLM settings to appear at the top of the chat buffer.
|
||||
|
@ -85,14 +100,18 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "references in the chat buffer.";
|
||||
description = ''
|
||||
Whether to enable references in the chat buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
show_token_count =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "the token count for each response.";
|
||||
description = ''
|
||||
Whether to enable the token count for each response.
|
||||
'';
|
||||
};
|
||||
|
||||
intro_message = mkOption {
|
||||
|
@ -155,7 +174,10 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "showing default actions in the action palette.";
|
||||
description = ''
|
||||
Whether to enable showing default
|
||||
actions in the action palette.
|
||||
'';
|
||||
};
|
||||
|
||||
show_default_prompt_library =
|
||||
|
@ -163,7 +185,8 @@ in {
|
|||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
showing default prompt library in the action palette.
|
||||
Whether to enable showing default
|
||||
prompt library in the action palette.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -22,6 +22,11 @@ in {
|
|||
};
|
||||
|
||||
treesitter.enable = true;
|
||||
|
||||
autocomplete.nvim-cmp = {
|
||||
sources = {codecompanion-nvim = "[codecompanion]";};
|
||||
sourcePlugins = ["codecompanion-nvim"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
|
|
|
@ -54,9 +54,7 @@ in {
|
|||
|
||||
optPlugins = pluginsOpt {
|
||||
default = [];
|
||||
example = ''
|
||||
[pkgs.vimPlugins.vim-ghost]
|
||||
'';
|
||||
example = "[pkgs.vimPlugins.vim-ghost]";
|
||||
description = ''
|
||||
List of plugins to optionally load on startup.
|
||||
|
||||
|
@ -73,8 +71,8 @@ in {
|
|||
type = attrsOf extraPluginType;
|
||||
default = {};
|
||||
description = ''
|
||||
A list of plugins and their configurations that will be
|
||||
set up after builtin plugins.
|
||||
Plugins and their configurations that will be set up after
|
||||
builtin plugins.
|
||||
|
||||
This option takes a special type that allows you to order
|
||||
your custom plugins using nvf's modified DAG library.
|
||||
|
@ -82,17 +80,31 @@ in {
|
|||
|
||||
example = literalMD ''
|
||||
```nix
|
||||
with pkgs.vimPlugins; {
|
||||
{
|
||||
aerial = {
|
||||
package = aerial-nvim;
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
|
||||
harpoon = {
|
||||
package = harpoon;
|
||||
package = pkgs.vimPlugins.harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"]; # place harpoon configuration after aerial
|
||||
};
|
||||
|
||||
# Example for packages built from source
|
||||
deferred-clipboard = {
|
||||
package = buildVimPlugin {
|
||||
name = "deferred-clipboard";
|
||||
src = (fetchFromGitHub {
|
||||
owner = "EtiamNullam";
|
||||
repo = "deferred-clipboard.nvim";
|
||||
rev = "810a29d166eaa41afc220cc7cd85eeaa3c43b37f";
|
||||
hash = "sha256-nanNQEtpjv0YKEkkrPmq/5FPxq+Yj/19cs0Gf7YgKjU=";
|
||||
};
|
||||
});
|
||||
setup = "require('deferred-clipboard').setup {}";
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
@ -101,21 +113,20 @@ in {
|
|||
extraPackages = mkOption {
|
||||
type = listOf package;
|
||||
default = [];
|
||||
example = ''[pkgs.fzf pkgs.ripgrep]'';
|
||||
example = "[pkgs.fzf pkgs.ripgrep]";
|
||||
description = ''
|
||||
List of additional packages to make available to the Neovim
|
||||
wrapper.
|
||||
'';
|
||||
};
|
||||
|
||||
# this defaults to `true` in the wrapper
|
||||
# This defaults to `true` in the wrapper
|
||||
# and since we pass this value to the wrapper
|
||||
# with an inherit, it should be `true` here as well
|
||||
withRuby =
|
||||
mkEnableOption ''
|
||||
Ruby support in the Neovim wrapper.
|
||||
''
|
||||
mkEnableOption ""
|
||||
// {
|
||||
description = "Whether to enable Ruby support in the Neovim wrapper";
|
||||
default = true;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue