mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-10-02 23:13:30 +00:00
Merge branch 'v0.8' into notashelf/push-qzzvtnwpuqmr
This commit is contained in:
commit
07b00f4f33
18 changed files with 522 additions and 357 deletions
|
@ -38,7 +38,7 @@
|
|||
type = nullOr luaInline;
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
mkLuaInline '''
|
||||
lib.generators.mkLuaInline '''
|
||||
function()
|
||||
print("Saving a Lua file...")
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"nvim-bufferline-lua"
|
||||
"bufferline-nvim"
|
||||
"bufdelete-nvim"
|
||||
];
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
|
||||
inherit (lib.types) enum bool either nullOr str int listOf attrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
|
@ -24,17 +24,28 @@ in {
|
|||
movePrevious = mkMappingOption "Move previous buffer" "<leader>bmp";
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
|
||||
setupOpts = mkPluginSetupOption "bufferline-nvim" {
|
||||
highlights = mkOption {
|
||||
type = either attrs luaInline;
|
||||
default =
|
||||
if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
|
||||
then
|
||||
mkLuaInline
|
||||
''
|
||||
require("catppuccin.groups.integrations.bufferline").get()
|
||||
mkLuaInline ''
|
||||
(function()
|
||||
local integration = require("catppuccin.groups.integrations.bufferline")
|
||||
return (integration.get_theme or integration.get)()
|
||||
end)()
|
||||
''
|
||||
else {};
|
||||
defaultText = literalMD ''
|
||||
```lua
|
||||
(function()
|
||||
local integration = require("catppuccin.groups.integrations.bufferline")
|
||||
return (integration.get_theme or integration.get)()
|
||||
end)()
|
||||
```
|
||||
if the active theme is Catppuccin, `{}` otherwise.
|
||||
'';
|
||||
description = ''
|
||||
Overrides the highlight groups of bufferline.
|
||||
|
||||
|
@ -59,10 +70,11 @@ in {
|
|||
themable = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description = ''
|
||||
Whether or not to allow highlight groups to be overridden.
|
||||
|
||||
While false, bufferline.nvim sets highlights as default.
|
||||
While `false`, bufferline.nvim sets highlights as default.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -71,6 +71,9 @@ in {
|
|||
require('catppuccin').setup {
|
||||
flavour = "${style}",
|
||||
transparent_background = ${boolToString transparent},
|
||||
float = {
|
||||
transparent = ${boolToString transparent},
|
||||
},
|
||||
term_colors = true,
|
||||
integrations = {
|
||||
nvimtree = {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
./borders
|
||||
./breadcrumbs
|
||||
./colorful-menu-nvim
|
||||
./nvim-highlight-colors
|
||||
./colorizer
|
||||
./fastaction
|
||||
./illuminate
|
||||
|
|
28
modules/plugins/ui/nvim-highlight-colors/config.nix
Normal file
28
modules/plugins/ui/nvim-highlight-colors/config.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.ui.nvim-highlight-colors;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"nvim-highlight-colors"
|
||||
];
|
||||
|
||||
# enable display of 24-bit RGB colors in neovim
|
||||
# via the terminal. This is required for nvim-highlight-colors
|
||||
# to display arbitrary RGB highlights.
|
||||
options.termguicolors = true;
|
||||
|
||||
pluginRC.nvim-highlight-colors = entryAnywhere ''
|
||||
require('nvim-highlight-colors').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/ui/nvim-highlight-colors/default.nix
Normal file
6
modules/plugins/ui/nvim-highlight-colors/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./nvim-highlight-colors.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf enum nullOr submodule bool str;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
in {
|
||||
options.vim.ui.nvim-highlight-colors = {
|
||||
enable = mkEnableOption "color highlighting [nvim-highlight-colors.lua]";
|
||||
|
||||
setupOpts = mkPluginSetupOption "nvim-highlight-colors" {
|
||||
render = mkOption {
|
||||
type = enum ["background" "foreground" "virtual"];
|
||||
default = "background";
|
||||
example = "virtual";
|
||||
description = ''
|
||||
Style to render color highlighting with.
|
||||
|
||||
::: {.note}
|
||||
Each render style works as follows:
|
||||
- 'background' sets the background
|
||||
highlight of the matched color string
|
||||
to the RGB color it describes.
|
||||
|
||||
- 'foreground' sets the foreground
|
||||
highlight of the matched color string
|
||||
to the RGB color it describes.
|
||||
|
||||
- 'virtual' displays the matched color
|
||||
with virtual text alongside the color
|
||||
string in the buffer. Virtual text can
|
||||
be configured to display the color in
|
||||
various ways, i.e custom virtual symbol
|
||||
(via `virtual_symbol`) positioning
|
||||
relative to string, suffix/prefix, etc.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
virtual_symbol_position = mkOption {
|
||||
type = enum ["inline" "eol" "eow"];
|
||||
default = "inline";
|
||||
example = "eol";
|
||||
description = ''
|
||||
Where to render the virtual symbol in
|
||||
relation to the color string.
|
||||
|
||||
::: {.note}
|
||||
Each render style works as follows:
|
||||
- 'inline' render virtual text inline,
|
||||
similar to the style of VSCode color
|
||||
hinting.
|
||||
|
||||
- 'eol' render virtual text at the end
|
||||
of the line which the color string
|
||||
occurs (last column). Recommended to
|
||||
set `virtual_symbol_suffix` to an
|
||||
empty string when used.
|
||||
|
||||
- 'eow' render virtual text at the end
|
||||
of the word where the color string
|
||||
occurs. Recommended to set
|
||||
`virtual_symbol_prefix` to a single
|
||||
space for padding and the suffix to
|
||||
an empty string for no padding.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -9,14 +9,16 @@ in {
|
|||
|
||||
setupOpts = mkPluginSetupOption "image.nvim" {
|
||||
backend = mkOption {
|
||||
type = enum ["kitty" "ueberzug"];
|
||||
type = enum ["kitty" "ueberzug" "sixel"];
|
||||
default = "ueberzug";
|
||||
description = ''
|
||||
The backend to use for rendering images.
|
||||
|
||||
- kitty - best in class, works great and is very snappy
|
||||
- ueberzug - backed by ueberzugpp, supports any terminal,
|
||||
* `kitty` - best in class, works great and is very snappy. Recommended
|
||||
by upstream.
|
||||
* `ueberzug` - backed by ueberzugpp, supports any terminal,
|
||||
but has lower performance
|
||||
* `sixel` - uses the Sixel graphics protocol, widely supported by many terminals
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
passthru.vimPlugin = false;
|
||||
};
|
||||
|
||||
# build a vim plugin with the given name and arguments
|
||||
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
||||
# instead
|
||||
# Build a Vim plugin with the given name and arguments.
|
||||
buildPlug = attrs: let
|
||||
pin = getPin attrs.pname;
|
||||
in
|
||||
|
@ -36,6 +34,7 @@
|
|||
// attrs
|
||||
);
|
||||
|
||||
# Build a given Treesitter grammar.
|
||||
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
||||
|
||||
pluginBuilders = {
|
||||
|
@ -48,6 +47,9 @@
|
|||
doCheck = false;
|
||||
};
|
||||
|
||||
# Get plugins built from source from self.packages
|
||||
# If adding a new plugin to be built from source, it must also be inherited
|
||||
# here.
|
||||
inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp avante-nvim;
|
||||
};
|
||||
|
||||
|
@ -71,29 +73,38 @@
|
|||
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
|
||||
# generate a wrapped Neovim package.
|
||||
neovim-wrapped = inputs.mnw.lib.wrap {inherit pkgs;} {
|
||||
appName = "nvf";
|
||||
neovim = config.vim.package;
|
||||
initLua = config.vim.builtLuaConfigRC;
|
||||
luaFiles = config.vim.extraLuaFiles;
|
||||
|
||||
# Plugin configurations
|
||||
plugins = {
|
||||
start = buildConfigPlugins config.vim.startPlugins;
|
||||
opt = buildConfigPlugins config.vim.optPlugins;
|
||||
};
|
||||
appName = "nvf";
|
||||
extraBinPath = config.vim.extraPackages;
|
||||
initLua = config.vim.builtLuaConfigRC;
|
||||
luaFiles = config.vim.extraLuaFiles;
|
||||
|
||||
# Providers for Neovim
|
||||
providers = {
|
||||
ruby.enable = config.vim.withRuby;
|
||||
nodeJs.enable = config.vim.withNodeJs;
|
||||
python3 = {
|
||||
enable = config.vim.withPython3;
|
||||
extraPackages = ps: map (flip builtins.getAttr ps) config.vim.python3Packages;
|
||||
};
|
||||
ruby.enable = config.vim.withRuby;
|
||||
nodeJs.enable = config.vim.withNodeJs;
|
||||
};
|
||||
|
||||
# Aliases to link `nvim` to
|
||||
aliases = lib.optional config.vim.viAlias "vi" ++ lib.optional config.vim.vimAlias "vim";
|
||||
|
||||
# Additional packages or Lua packages to be made available to Neovim
|
||||
extraBinPath = config.vim.extraPackages;
|
||||
extraLuaPackages = ps: map (flip builtins.getAttr ps) config.vim.luaPackages;
|
||||
};
|
||||
|
||||
# A store path representing the built Lua configuration.
|
||||
dummyInit = pkgs.writeText "nvf-init.lua" config.vim.builtLuaConfigRC;
|
||||
|
||||
# Additional helper scripts for printing and displaying nvf configuration
|
||||
# in your commandline.
|
||||
printConfig = pkgs.writers.writeDashBin "nvf-print-config" "cat ${dummyInit}";
|
||||
|
@ -106,10 +117,20 @@
|
|||
paths = [neovim-wrapped printConfig printConfigPath];
|
||||
postBuild = "echo Helpers added";
|
||||
|
||||
# Allow evaluating config.vim, i.e., config.vim from the packages' passthru
|
||||
# attribute. For example, packages.x86_64-linux.neovim.passthru.neovimConfig
|
||||
# will return the configuration in full.
|
||||
passthru.neovimConfig = config.vim;
|
||||
passthru = {
|
||||
# Allow evaluating config.vim, i.e., config.vim from the packages' passthru
|
||||
# attribute. For example, packages.x86_64-linux.neovim.passthru.neovimConfig
|
||||
# will return the configuration in full.
|
||||
neovimConfig = config.vim;
|
||||
|
||||
# Also expose the helper scripts in passthru.
|
||||
nvfPrintConfig = printConfig;
|
||||
nvfPrintConfigPath = printConfigPath;
|
||||
|
||||
# In systems where we only have a package and no module, this can be used
|
||||
# to access the built init.lua
|
||||
initLua = dummyInit;
|
||||
};
|
||||
|
||||
meta =
|
||||
neovim-wrapped.meta
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
||||
inherit (lib.types) package bool str listOf attrsOf;
|
||||
inherit (lib.nvim.types) pluginsOpt extraPluginType;
|
||||
in {
|
||||
|
@ -11,6 +11,7 @@ in {
|
|||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.neovim-unwrapped;
|
||||
defaultText = literalExpression "pkgs.neovim-unwrapped";
|
||||
description = ''
|
||||
The neovim package to use for the wrapper. This
|
||||
corresponds to the package that will be wrapped
|
||||
|
@ -27,21 +28,20 @@ in {
|
|||
viAlias = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description = "Enable the `vi` alias for `nvim`";
|
||||
};
|
||||
|
||||
vimAlias = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description = "Enable the `vim` alias for `nvim`";
|
||||
};
|
||||
|
||||
startPlugins = pluginsOpt {
|
||||
default = ["plenary-nvim"];
|
||||
example = ''
|
||||
[pkgs.vimPlugins.telescope-nvim]
|
||||
'';
|
||||
|
||||
example = literalExpression "[pkgs.vimPlugins.telescope-nvim]";
|
||||
description = ''
|
||||
List of plugins to load on startup. This is used
|
||||
internally to add plugins to Neovim's runtime.
|
||||
|
@ -54,9 +54,7 @@ in {
|
|||
|
||||
optPlugins = pluginsOpt {
|
||||
default = [];
|
||||
example = ''
|
||||
[pkgs.vimPlugins.vim-ghost]
|
||||
'';
|
||||
example = literalExpression "[pkgs.vimPlugins.vim-ghost]";
|
||||
description = ''
|
||||
List of plugins to optionally load on startup.
|
||||
|
||||
|
@ -108,7 +106,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# 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 =
|
||||
|
@ -120,14 +118,14 @@ in {
|
|||
};
|
||||
|
||||
withNodeJs = mkEnableOption ''
|
||||
NodeJs support in the Neovim wrapper
|
||||
NodeJS support in the Neovim wrapper
|
||||
'';
|
||||
|
||||
luaPackages = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
example = ''["magick" "serpent"]'';
|
||||
description = "List of lua packages to install";
|
||||
description = "List of Lua packages to install";
|
||||
};
|
||||
|
||||
withPython3 = mkEnableOption ''
|
||||
|
@ -144,7 +142,7 @@ in {
|
|||
pluginOverrides = mkOption {
|
||||
type = attrsOf package;
|
||||
default = {};
|
||||
example = ''
|
||||
example = literalExpression ''
|
||||
{
|
||||
lazydev-nvim = pkgs.fetchFromGitHub {
|
||||
owner = "folke";
|
||||
|
|
|
@ -145,7 +145,7 @@ in {
|
|||
];
|
||||
|
||||
lazy.builtLazyConfig = ''
|
||||
require('lz.n').load(${toLuaObject lznSpecs})
|
||||
${optionalString (length lznSpecs > 0) "require('lz.n').load(${toLuaObject lznSpecs})"}
|
||||
${optionalString cfg.enableLznAutoRequire "require('lzn-auto-require').enable()"}
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue