mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 08:39:50 +01:00
feat(neocord): custom setup
This commit is contained in:
parent
6fd35972d9
commit
0e802c03ef
2 changed files with 72 additions and 92 deletions
|
@ -3,12 +3,9 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toString;
|
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.strings) escapeNixString;
|
|
||||||
inherit (lib.nvim.lua) listToLuaTable;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.presence.neocord;
|
cfg = config.vim.presence.neocord;
|
||||||
in {
|
in {
|
||||||
|
@ -17,31 +14,7 @@ in {
|
||||||
|
|
||||||
vim.luaConfigRC.neocord = entryAnywhere ''
|
vim.luaConfigRC.neocord = entryAnywhere ''
|
||||||
-- Description of each option can be found in https://github.com/IogaMaster/neocord#lua
|
-- Description of each option can be found in https://github.com/IogaMaster/neocord#lua
|
||||||
require("neocord").setup({
|
require("neocord").setup(${toLuaObject cfg.setupOpts})
|
||||||
-- General options
|
|
||||||
logo = "${cfg.logo}",
|
|
||||||
logo_tooltip = "${cfg.logo_tooltip}",
|
|
||||||
main_image = "${cfg.main_image}",
|
|
||||||
client_id = "${cfg.client_id}",
|
|
||||||
log_level = ${
|
|
||||||
if cfg.log_level == null
|
|
||||||
then "nil"
|
|
||||||
else "${escapeNixString cfg.log_level}"
|
|
||||||
},
|
|
||||||
debounce_timeout = ${toString cfg.debounce_timeout},
|
|
||||||
blacklist = ${listToLuaTable cfg.blacklist},
|
|
||||||
show_time = "${boolToString cfg.show_time}",
|
|
||||||
|
|
||||||
-- Rich Presence text options
|
|
||||||
editing_text = "${cfg.rich_presence.editing_text}",
|
|
||||||
file_explorer_text = "${cfg.rich_presence.file_explorer_text}",
|
|
||||||
git_commit_text = "${cfg.rich_presence.git_commit_text}",
|
|
||||||
plugin_manager_text = "${cfg.rich_presence.plugin_manager_text}",
|
|
||||||
reading_text = "${cfg.rich_presence.reading_text}",
|
|
||||||
workspace_text = "${cfg.rich_presence.workspace_text}",
|
|
||||||
line_number_text = "${cfg.rich_presence.line_number_text}",
|
|
||||||
terminal_text = "${cfg.rich_presence.terminal_text}",
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,86 +1,93 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.modules) mkRemovedOptionModule;
|
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.types) bool int str enum nullOr listOf;
|
inherit (lib.types) bool int str enum nullOr listOf;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports =
|
||||||
(mkRemovedOptionModule ["vim" "presence" "presence-nvim"] ''
|
[
|
||||||
The option vim.presence.presence-nvim has been deprecated in favor of the new neocord module.
|
(mkRemovedOptionModule ["vim" "presence" "presence-nvim"] ''
|
||||||
Options provided by the plugin remain mostly the same, but manual migration is required.
|
The option vim.presence.presence-nvim has been deprecated in favor of the new neocord module.
|
||||||
|
Options provided by the plugin remain mostly the same, but manual migration is required.
|
||||||
|
|
||||||
Please see neocord documentation and the neovim-flake options for more info
|
Please see neocord documentation and the neovim-flake options for more info
|
||||||
'')
|
'')
|
||||||
];
|
]
|
||||||
|
++ (map
|
||||||
|
(optName: mkRenamedOptionModule ["vim" "presence" "neocord" "rich_presence" optName] ["vim" "presence" "neocord" "setupOpts" optName])
|
||||||
|
["debounce_timeout" "blacklist" "show_time" "editing_text" "file_explorer_text" "git_commit_text" "plugin_manager_text" "reading_text" "workspace_text" "line_number_text" "terminal_text"])
|
||||||
|
++ (map
|
||||||
|
(optName: mkRenamedOptionModule ["vim" "presence" "neocord" optName] ["vim" "presence" "neocord" "setupOpts" optName])
|
||||||
|
["logo" "logo_tooltip" "main_image" "client_id" "log_level" "debounce_timeout" "blacklist" "show_time"]);
|
||||||
|
|
||||||
options.vim.presence.neocord = {
|
options.vim.presence.neocord = {
|
||||||
enable = mkEnableOption "neocord plugin for discord rich presence";
|
enable = mkEnableOption "neocord plugin for discord rich presence";
|
||||||
|
|
||||||
logo = mkOption {
|
setupOpts = lib.nvim.mkPluginSetupOption "neocord" {
|
||||||
type = str; # TODO: can the default be documented better, maybe with an enum?
|
logo = mkOption {
|
||||||
default = "auto";
|
type = str; # TODO: can the default be documented better, maybe with an enum?
|
||||||
description = ''
|
default = "auto";
|
||||||
Logo to be displayed on the RPC item
|
description = ''
|
||||||
|
Logo to be displayed on the RPC item
|
||||||
|
|
||||||
This must be either "auto" or an URL to your image of choice
|
This must be either "auto" or an URL to your image of choice
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
logo_tooltip = mkOption {
|
logo_tooltip = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "The One True Text Editor";
|
default = "The One True Text Editor";
|
||||||
description = "Text displayed when hovering over the Neovim image";
|
description = "Text displayed when hovering over the Neovim image";
|
||||||
};
|
};
|
||||||
|
|
||||||
main_image = mkOption {
|
main_image = mkOption {
|
||||||
type = enum ["language" "logo"];
|
type = enum ["language" "logo"];
|
||||||
default = "language";
|
default = "language";
|
||||||
description = "Main image to be displayed";
|
description = "Main image to be displayed";
|
||||||
};
|
};
|
||||||
|
|
||||||
client_id = mkOption {
|
client_id = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "1157438221865717891";
|
default = "1157438221865717891";
|
||||||
description = "Client ID of the application";
|
description = "Client ID of the application";
|
||||||
};
|
};
|
||||||
|
|
||||||
log_level = mkOption {
|
log_level = mkOption {
|
||||||
type = nullOr (enum ["debug" "info" "warn" "error"]);
|
type = nullOr (enum ["debug" "info" "warn" "error"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Log level to be used by the plugin";
|
description = "Log level to be used by the plugin";
|
||||||
};
|
};
|
||||||
|
|
||||||
debounce_timeout = mkOption {
|
debounce_timeout = mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
default = 10;
|
default = 10;
|
||||||
description = "Number of seconds to debounce events";
|
description = "Number of seconds to debounce events";
|
||||||
};
|
};
|
||||||
|
|
||||||
auto_update = mkOption {
|
auto_update = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Automatically update the presence";
|
description = "Automatically update the presence";
|
||||||
};
|
};
|
||||||
|
|
||||||
enable_line_number = mkOption {
|
enable_line_number = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Show line number on the RPC item";
|
description = "Show line number on the RPC item";
|
||||||
};
|
};
|
||||||
|
|
||||||
show_time = mkOption {
|
show_time = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Show time on the RPC item";
|
description = "Show time on the RPC item";
|
||||||
};
|
};
|
||||||
|
|
||||||
blacklist = mkOption {
|
blacklist = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExpression ''["Alpha"]'';
|
example = literalExpression ''["Alpha"]'';
|
||||||
description = "List of filetypes to ignore";
|
description = "List of filetypes to ignore";
|
||||||
};
|
};
|
||||||
|
|
||||||
rich_presence = {
|
|
||||||
editing_text = mkOption {
|
editing_text = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "Editing %s";
|
default = "Editing %s";
|
||||||
|
|
Loading…
Reference in a new issue