mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-12-29 14:12:23 +00:00
Compare commits
No commits in common. "eb037b7bff62171004e9276d4efb9be7e7ce9d8e" and "b347757f8a1acec4c53f5811bf8af70de5c06129" have entirely different histories.
eb037b7bff
...
b347757f8a
11 changed files with 36 additions and 82 deletions
|
@ -1,7 +1,7 @@
|
|||
# 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.
|
||||
for your convience 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.
|
||||
|
|
|
@ -53,7 +53,6 @@ configuration formats.
|
|||
longer filtered and thus should be used instead.
|
||||
- Add dap-go for better dap configurations
|
||||
- Make noice.nvim customizable
|
||||
- Standardize border style options and add custom borders
|
||||
|
||||
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
||||
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
||||
|
@ -72,8 +71,7 @@ configuration formats.
|
|||
|
||||
- Fix "Emac" typo
|
||||
|
||||
- Add [new-file-template.nvim] to automatically fill new file contents using
|
||||
templates.
|
||||
- Add [new-file-template.nvim] to automatically fill new file contents using templates.
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
|
@ -148,22 +146,11 @@ configuration formats.
|
|||
- Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim
|
||||
closure. Both of those scripts have been automatically added to your PATH upon
|
||||
using neovimConfig or `programs.nvf.enable`.
|
||||
|
||||
- `nvf-print-config` will display your `init.lua`, in full.
|
||||
- `nvf-print-config-path` will display the path to _a clone_ of your
|
||||
`init.lua`. This is not the path used by the Neovim wrapper, but an
|
||||
identical clone.
|
||||
|
||||
- Add `vim.ui.breadcrumbs.lualine` to allow fine-tuning breadcrumbs behaviour on
|
||||
Lualine. Only `vim.ui.breadcrumbs.lualine.winbar` is supported for the time
|
||||
being.
|
||||
- [](#opt-vim.ui.breadcrumbs.lualine.winbar.enable) has been added to allow
|
||||
controlling the default behaviour of the `nvim-navic` component on Lualine,
|
||||
which used to occupy `winbar.lualine_c` as long as breadcrumbs are enabled.
|
||||
- `vim.ui.breadcrumbs.alwaysRender` has been renamed to
|
||||
[](#opt-vim.ui.breadcrumbs.lualine.winbar.alwaysRender) to be conform to the
|
||||
new format.
|
||||
|
||||
[ppenguin](https://github.com/ppenguin):
|
||||
|
||||
- Telescope:
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
typesCustom = import ./custom.nix {inherit lib;};
|
||||
in {
|
||||
inherit (typesDag) dagOf;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType;
|
||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||
inherit (typesCustom) anythingConcatLists char;
|
||||
}
|
||||
|
|
|
@ -51,13 +51,9 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
in {
|
||||
inherit extraPluginType fromInputs pluginType;
|
||||
|
||||
borderType = either (enum borderPresets) (listOf (either str (listOf str)));
|
||||
|
||||
pluginsOpt = {
|
||||
description,
|
||||
example,
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
in {
|
||||
|
@ -23,7 +22,7 @@ in {
|
|||
|
||||
${
|
||||
optionalString config.vim.ui.borders.enable ''
|
||||
require('lspconfig.ui.windows').default_options.border = ${toLuaObject config.vim.ui.borders.globalStyle}
|
||||
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}'
|
||||
''
|
||||
}
|
||||
'';
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
|
@ -26,7 +25,7 @@ in {
|
|||
|
||||
pluginRC.code-action-menu = entryAnywhere ''
|
||||
-- border configuration
|
||||
vim.g.code_action_menu_window_border = ${toLuaObject config.vim.ui.borders.plugins.code-action-menu.style}
|
||||
vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}'
|
||||
|
||||
-- show individual sections of the code action menu
|
||||
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
inherit (lib.generators) mkLuaInline;
|
||||
|
||||
cfg = config.vim.statusline.lualine;
|
||||
bCfg = config.vim.ui.breadcrumbs;
|
||||
breadcrumbsCfg = config.vim.ui.breadcrumbs;
|
||||
in {
|
||||
config = mkMerge [
|
||||
# TODO: move into nvim-tree file
|
||||
|
@ -20,14 +20,13 @@ in {
|
|||
extensions = ["nvim-tree"];
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
|
||||
(mkIf (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") {
|
||||
vim.statusline.lualine.setupOpts = {
|
||||
# TODO: rewrite in new syntax
|
||||
winbar.lualine_c = mkDefault [
|
||||
[
|
||||
"navic"
|
||||
(mkLuaInline "draw_empty = ${boolToString bCfg.lualine.winbar.alwaysRender}")
|
||||
(mkLuaInline "draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}")
|
||||
]
|
||||
];
|
||||
};
|
||||
|
@ -35,6 +34,7 @@ in {
|
|||
(mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["lualine"];
|
||||
|
||||
pluginRC.lualine = entryAnywhere ''
|
||||
local lualine = require('lualine')
|
||||
lualine.setup ${toLuaObject cfg.setupOpts}
|
||||
|
|
|
@ -4,34 +4,31 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.nvim.types) borderType;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.types) enum;
|
||||
|
||||
cfg = config.vim.ui.borders;
|
||||
|
||||
defaultStyles = ["none" "single" "double" "rounded"];
|
||||
in {
|
||||
options.vim.ui.borders = {
|
||||
enable = mkEnableOption "visible borders for most windows";
|
||||
|
||||
globalStyle = mkOption {
|
||||
type = borderType;
|
||||
type = enum defaultStyles;
|
||||
default = "rounded";
|
||||
description = ''
|
||||
The global border style to use.
|
||||
|
||||
If a list is given, it should have a length of eight or any divisor of
|
||||
eight. The array will specify the eight chars building up the border in
|
||||
a clockwise fashion starting with the top-left corner. You can specify
|
||||
a different highlight group for each character by passing a
|
||||
[char, "YourHighlightGroup"] instead
|
||||
'';
|
||||
example = ["╔" "═" "╗" "║" "╝" "═" "╚" "║"];
|
||||
};
|
||||
|
||||
# TODO: make per-plugin borders configurable
|
||||
plugins = let
|
||||
mkPluginStyleOption = name: {
|
||||
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
||||
|
||||
style = mkOption {
|
||||
type = borderType;
|
||||
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
|
||||
default = cfg.globalStyle;
|
||||
description = "The border style to use for the ${name} plugin";
|
||||
};
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) nullOr listOf enum bool str int either;
|
||||
inherit (lib.types) nullOr listOf enum bool str int;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
mkSimpleIconOption = default:
|
||||
mkOption {
|
||||
inherit default;
|
||||
|
@ -31,8 +31,6 @@ in {
|
|||
(renameSetupOpt ["sourceBuffer" "scrolloff"] ["source_buffer" "scrolloff"])
|
||||
# TODO: every option under icon is renamed to first letter capitalized
|
||||
(renameSetupOpt ["icon"] ["icon"])
|
||||
|
||||
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "alwaysRender"] ["vim" "ui" "breadcrumbs" "lualine" "winbar" "alwaysRender"])
|
||||
];
|
||||
|
||||
options.vim.ui.breadcrumbs = {
|
||||
|
@ -45,43 +43,17 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# Options for configuring Lualine integration of nvim-navic
|
||||
lualine.winbar = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = true; # for retaining previous behaviour
|
||||
example = false;
|
||||
description = ''
|
||||
Whether to automatically configure a winbar component for
|
||||
Lualine on the Winbar section.
|
||||
|
||||
::: {.note}
|
||||
This is **set to `true` by default**, which means nvim-navic
|
||||
will occupy `winbar.lualine_c` for the breadcrumbs feature
|
||||
unless this option is set to `false`.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
alwaysRender = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description = ''
|
||||
Whether to always display the breadcrumbs component
|
||||
on winbar.
|
||||
|
||||
::: {.note}
|
||||
This will pass `draw_empty` to the `nvim_navic` winbar
|
||||
component, which causes the component to be drawn even
|
||||
if it's empty
|
||||
:::
|
||||
'';
|
||||
};
|
||||
# maybe this should be an option to *disable* alwaysRender optionally but oh well
|
||||
# too late
|
||||
alwaysRender = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to always display the breadcrumbs component on winbar (always renders winbar)";
|
||||
};
|
||||
|
||||
navbuddy = {
|
||||
enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic";
|
||||
|
||||
mappings = {
|
||||
close = mkOption {
|
||||
type = str;
|
||||
|
@ -240,7 +212,8 @@ in {
|
|||
# position = {}
|
||||
|
||||
border = mkOption {
|
||||
type = borderType;
|
||||
# TODO: let this type accept a custom string
|
||||
type = enum ["single" "rounded" "double" "solid" "none"];
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use";
|
||||
};
|
||||
|
@ -263,7 +236,8 @@ in {
|
|||
*/
|
||||
|
||||
border = mkOption {
|
||||
type = borderType;
|
||||
# TODO: let this type accept a custom string
|
||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the left section of Navbuddy UI";
|
||||
};
|
||||
|
@ -280,7 +254,8 @@ in {
|
|||
*/
|
||||
|
||||
border = mkOption {
|
||||
type = borderType;
|
||||
# TODO: let this type accept a custom string
|
||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the middle section of Navbuddy UI";
|
||||
};
|
||||
|
@ -290,7 +265,8 @@ in {
|
|||
# there is no size option for the right section, it fills the remaining space
|
||||
right = {
|
||||
border = mkOption {
|
||||
type = borderType;
|
||||
# TODO: let this type accept a custom string
|
||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the right section of Navbuddy UI";
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ in {
|
|||
|
||||
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
||||
window = {
|
||||
border = ${toLuaObject config.vim.ui.borders.plugins.which-key.style},
|
||||
border = "${config.vim.ui.borders.plugins.which-key.style}",
|
||||
},
|
||||
''}
|
||||
})
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.strings) toUpper;
|
||||
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline borderType;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
in {
|
||||
imports = [
|
||||
|
@ -453,7 +453,7 @@ in {
|
|||
};
|
||||
border = mkOption {
|
||||
description = "Border style of the notification window";
|
||||
type = borderType;
|
||||
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
default =
|
||||
if config.vim.ui.borders.enable
|
||||
then config.vim.ui.borders.globalStyle
|
||||
|
|
Loading…
Reference in a new issue