Compare commits

...

8 Commits

Author SHA1 Message Date
raf 6144c1126f
Merge 7d077f43f7 into 589b86d378 2024-07-21 22:47:29 +03:00
Gerg-L 589b86d378
fix buildPlug patches, update mnw (#343)
* bald frog (gerg-l)

* modules/default.nix: make patches work on built plugins

* flake.lock: Update

Flake lock file updates:

• Updated input 'mnw':
    'github:Gerg-L/mnw/302b18ddb8498aa9a7e0c01f7026e49d545e6898?narHash=sha256-4Z2FtCuL0lT%2BsM2gb1JMcXOUkeYrWeYZjjs1HuVTlOs%3D' (2024-07-14)
  → 'github:Gerg-L/mnw/4ea225024677e7c3a96080af8624fd3aa5dfa1b6?narHash=sha256-PF/FbgCUZ6mQrKp28G2YoVDlSThBy8AxIT9d2Ju3kTY%3D' (2024-07-20)

---------

Co-authored-by: raf <raf@notashelf.dev>
2024-07-21 15:37:45 +00:00
NotAShelf 2b8d0af2e6
modules: add meta.mainProgram to symlinkJoined Neovim wrapper 2024-07-20 16:55:56 +03:00
raf 8b15271f63
modules: add helper scripts (#346)
* modules: add helpers to display init.lua and its store path

* docs: update 0.7 release notes

* modules: use writeDashBin for helpers
2024-07-20 13:01:40 +00:00
NotAShelf 7d077f43f7
neovim/global: begin adding `vim.diagnostics.config()` options 2024-05-17 19:03:05 +03:00
NotAShelf cb57d3d417
plugins/ui: re-organize imports 2024-05-17 19:02:37 +03:00
NotAShelf 754c29cb7c
neovim/global: add ui/icons 2024-05-17 18:25:26 +03:00
NotAShelf 0e84e4ebed
modules/plugins: move plugins/ui to neovim/global/ui 2024-05-17 18:25:25 +03:00
11 changed files with 267 additions and 69 deletions

View File

@ -46,8 +46,6 @@ configuration formats.
- Fix [](#opt-vim.ui.smartcolumn.setupOpts.custom_colorcolumn) using the wrong
type `int` instead of the expected type `string`.
- Fix unused src and version attributes in `buildPlug`.
[horriblename](https://github.com/horriblename):
- Fix broken treesitter-context keybinds in visual mode
@ -141,3 +139,11 @@ configuration formats.
- Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available
under `vim.filetree.neo-tree`, similar to nvimtree.
- Add `print-nvf-config` & `print-nvf-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`.
- `print-nvf-config` will display your `init.lua`, in full.
- `print-nvf-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.

View File

@ -69,11 +69,11 @@
},
"mnw": {
"locked": {
"lastModified": 1720927281,
"narHash": "sha256-4Z2FtCuL0lT+sM2gb1JMcXOUkeYrWeYZjjs1HuVTlOs=",
"lastModified": 1721440413,
"narHash": "sha256-PF/FbgCUZ6mQrKp28G2YoVDlSThBy8AxIT9d2Ju3kTY=",
"owner": "Gerg-L",
"repo": "mnw",
"rev": "302b18ddb8498aa9a7e0c01f7026e49d545e6898",
"rev": "4ea225024677e7c3a96080af8624fd3aa5dfa1b6",
"type": "github"
},
"original": {

View File

@ -36,11 +36,19 @@ inputs: {
buildPlug = {pname, ...} @ attrs: let
src = getAttr ("plugin-" + pname) inputs;
in
pkgs.runCommand "${pname}-${src.shortRev or src.shortDirtyRev or "dirty"}" attrs
''
mkdir -p $out
cp -r ${src}/. $out
'';
pkgs.stdenvNoCC.mkDerivation ({
inherit src;
version = src.shortRev or src.shortDirtyRev or "dirty";
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r . $out
runHook postInstall
'';
}
// attrs);
noBuildPlug = {pname, ...} @ attrs: let
input = getAttr ("plugin-" + pname) inputs;
@ -105,10 +113,35 @@ inputs: {
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
inherit extraLuaPackages extraPython3Packages;
};
# Additional helper scripts for printing and displaying nvf configuration
# in your commandline.
printConfig = pkgs.writers.writeDashBin "print-nvf-config" ''
cat << EOF
${vimOptions.builtLuaConfigRC}
EOF
'';
printConfigPath = pkgs.writers.writeDashBin "print-nvf-config-path" ''
realpath ${pkgs.writeTextFile {
name = "nvf-init.lua";
text = vimOptions.builtLuaConfigRC;
}}
'';
in {
inherit (module) options config;
inherit (module._module.args) pkgs;
# expose wrapped neovim-package
neovim = neovim-wrapped;
# Expose wrapped neovim-package for userspace
# or module consumption.
neovim = pkgs.symlinkJoin {
name = "nvf-with-helpers";
paths = [neovim-wrapped printConfig printConfigPath];
postBuild = "echo helpers added";
meta = {
description = "Wrapped version of Neovim with additional helper scripts";
mainProgram = "nvim";
};
};
}

View File

@ -10,6 +10,7 @@
# Contains configuration for core neovim features
# such as spellchecking, mappings, and the init script (init.vim).
neovim = map (p: ./neovim + "/${p}") [
"global"
"init"
"mappings"
];

View File

@ -0,0 +1,12 @@
{lib, ...}: let
inherit (lib.lists) concatLists;
inherit (lib.filesystem) listFilesRecursive;
in {
imports = concatLists [
# Configuration options for Neovim UI
(listFilesRecursive ./ui)
# vim.diagnostics
[./diagnostics.nix]
];
}

View File

@ -0,0 +1,115 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) str bool enum either;
in {
options.vim.diagnostics = {
virtual_text = mkOption {
type = bool;
default = true;
description = ''
Whether to use virtual text for diagnostics.
If multiple diagnostics are set for a namespace, one
prefix per diagnostic + the last diagnostic message
are shown.
'';
};
update_in_insert = mkOption {
type = bool;
default = false;
description = ''
Whether to update diagnostics in insert mode.
This is useful for slow diagnostics sources, but can
also cause lag in insert mode.
'';
};
underline = mkOption {
type = bool;
default = true;
description = ''
Whether to underline diagnostics.
'';
};
severity_sort = mkOption {
type = bool;
default = false;
description = ''
Whether to sort diagnostics by severity.
This affects the order in which signs and
virtual text are displayed. When true, higher
severities are displayed before lower severities (e.g.
ERROR is displayed before WARN)
'';
};
float = {
focusable = mkOption {
type = bool;
default = false;
description = ''
Whether the floating window is focusable.
When true, the floating window can be focused and
interacted with. When false, the floating window is
not focusable and will not receive input.
'';
};
border = mkOption {
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
default = config.vim.ui.border.globalStyle;
description = ''
The border style of the floating window.
Possible values:
- none
- single
- double
- rounded
- solid
- shadow
See `:h nvim_open_win` for the available border
styles and their definitions.
'';
};
source = mkOption {
type = either bool (enum ["always" "if_many"]);
default = "auto";
description = ''
The source of the floating window.
Possible values:
- auto: Use the same source as the diagnostics
window.
- window: Use the window source.
- buffer: Use the buffer source.
'';
};
prefix = mkOption {
type = str;
default = "";
description = ''
Prefix string for each diagnostic in the floating window
'';
};
suffix = mkOption {
type = str;
default = "";
description = ''
Suffix string for each diagnostic in the floating window
'';
};
};
};
}

View File

@ -0,0 +1,51 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.attrsets) mapAttrs;
inherit (lib.lists) optionals;
inherit (lib.types) enum;
cfg = config.vim.ui.borders;
# See `:h nvim_open_win` for the available border styles
# this list can be updated if additional styles are added.
defaultStyles = ["none" "single" "double" "rounded" "solid" "shadow"];
in {
options.vim.ui.borders = {
enable = mkEnableOption "visible borders for windows that support configurable borders";
# TODO: support configurable border elements with a lua table converted from a list of str
# e.g. [ "╔" "═" "╗" "║" "╝" "═" "╚" "║" ]
globalStyle = mkOption {
type = enum defaultStyles;
default = "single";
description = ''
The global border style to use.
'';
};
plugins = let
mkPluginStyleOption = name: {
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
style = mkOption {
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
default = cfg.globalStyle;
description = "The border style to use for the ${name} plugin";
};
};
in
mapAttrs (_: mkPluginStyleOption) {
# despite not having it listed in example configuration, which-key does support the rounded type
# additionally, it supports a "shadow" type that is similar to none but is of higher contrast
which-key = "which-key";
lspsaga = "lspsaga";
nvim-cmp = "nvim-cmp";
lsp-signature = "lsp-signature";
code-action-menu = "code-actions-menu";
};
};
}

View File

@ -0,0 +1,32 @@
{lib, ...}: let
inherit (lib.options) mkOption;
inherit (lib.types) str;
in {
options.vim.ui.icons = {
diagnostics = {
ERROR = mkOption {
type = str;
default = " ";
description = "The icon to use for error messages";
};
WARN = mkOption {
type = str;
default = " ";
description = "The icon to use for warning messages";
};
INFO = mkOption {
type = str;
default = " ";
description = "The icon to use for info messages";
};
HINT = mkOption {
type = str;
default = " ";
description = "The icon to use for hint messages";
};
};
};
}

View File

@ -1,46 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption;
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 = enum defaultStyles;
default = "rounded";
description = ''
The global border style to use.
'';
};
# TODO: make per-plugin borders configurable
plugins = let
mkPluginStyleOption = name: {
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
style = mkOption {
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
default = cfg.globalStyle;
description = "The border style to use for the ${name} plugin";
};
};
in {
# despite not having it listed in example configuration, which-key does support the rounded type
# additionally, it supports a "shadow" type that is similar to none but is of higher contrast
which-key = mkPluginStyleOption "which-key";
lspsaga = mkPluginStyleOption "lspsaga";
nvim-cmp = mkPluginStyleOption "nvim-cmp";
lsp-signature = mkPluginStyleOption "lsp-signature";
code-action-menu = mkPluginStyleOption "code-actions-menu";
};
};
}

View File

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

View File

@ -1,12 +1,11 @@
{
imports = [
./noice
./modes
./notifications
./smartcolumn
./breadcrumbs
./colorizer
./illuminate
./breadcrumbs
./borders
./modes
./noice
./notifications
./smartcolumn
];
}