mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-06 02:49:33 +00:00
ui/ui2: init
This commit is contained in:
parent
d3304af3d5
commit
96be4d23a9
5 changed files with 105 additions and 0 deletions
|
|
@ -207,6 +207,8 @@
|
|||
- Lazy-load `nvim-autopairs` plugin when using
|
||||
`vim.autopairs.nvim-autopairs.enable`
|
||||
|
||||
- Added support for neovim 0.12's `ui2` feature via `vim.ui.ui2`
|
||||
|
||||
[Machshev](https://github.com/machshev):
|
||||
|
||||
- Added `ruff` and `ty` LSP support for Python under `programs.python`.
|
||||
|
|
|
|||
|
|
@ -12,5 +12,6 @@
|
|||
./notifications
|
||||
./nvim-ufo
|
||||
./smartcolumn
|
||||
./ui2
|
||||
];
|
||||
}
|
||||
|
|
|
|||
19
modules/plugins/ui/ui2/config.nix
Normal file
19
modules/plugins/ui/ui2/config.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.ui.ui2;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
luaConfigRC.ui2 = entryAnywhere ''
|
||||
require('vim._core.ui2').enable(${toLuaObject (cfg.setupOpts // {enable = lib.mkForce true;})})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/ui/ui2/default.nix
Normal file
6
modules/plugins/ui/ui2/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./ui2.nix
|
||||
];
|
||||
}
|
||||
77
modules/plugins/ui/ui2/ui2.nix
Normal file
77
modules/plugins/ui/ui2/ui2.nix
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit
|
||||
(lib.types)
|
||||
nullOr
|
||||
oneOf
|
||||
enum
|
||||
attrsOf
|
||||
number
|
||||
int
|
||||
;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
|
||||
# Top-level targets only accepts `cmd` and `msg`, which is shorter, so we define that one
|
||||
# inline below. This is the accepted targets for ui2 messages when defining it as a table
|
||||
# or an attrset in Nix.
|
||||
msgTargetEnum = enum [
|
||||
"cmd"
|
||||
"msg"
|
||||
"pager"
|
||||
];
|
||||
|
||||
heightOption = target: default:
|
||||
mkOption {
|
||||
description = "Maximum height for the ${target} window";
|
||||
type = number;
|
||||
inherit default;
|
||||
};
|
||||
in {
|
||||
options.vim.ui.ui2 = {
|
||||
enable = mkEnableOption "the Neovim 0.12+ experimental built-in UI overhaul";
|
||||
|
||||
setupOpts = mkPluginSetupOption "ui2" {
|
||||
msg = {
|
||||
targets = mkOption {
|
||||
description = ''
|
||||
Default message target, either commandline or a separate window.
|
||||
Can alternatively specify different targets for different kinds of messages as an attrset.
|
||||
See [`:h ui-messages`](https://neovim.io/doc/user/api-ui-events/#ui-messages)
|
||||
for the different message types you can use in this configration.
|
||||
Separating the message types also allows sending to a 'pager' output.
|
||||
'';
|
||||
type = nullOr (oneOf [
|
||||
(enum [
|
||||
"cmd"
|
||||
"msg"
|
||||
])
|
||||
(attrsOf msgTargetEnum)
|
||||
]);
|
||||
default = "cmd";
|
||||
example = {
|
||||
bufwrite = "cmd";
|
||||
quickfix = "msg";
|
||||
};
|
||||
};
|
||||
cmd = {
|
||||
height = heightOption "cmdline" 0.5;
|
||||
};
|
||||
dialog = {
|
||||
height = heightOption "dialog" 0.5;
|
||||
};
|
||||
msg = {
|
||||
height = heightOption "msg" 0.5;
|
||||
timeout = mkOption {
|
||||
description = "Time a message is visible in the message window";
|
||||
type = int;
|
||||
default = 4000;
|
||||
example = 1500;
|
||||
};
|
||||
};
|
||||
pager = {
|
||||
height = heightOption "pager" 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue