mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-29 12:00:04 +02:00
plugins/neocord: init
Add support for https://github.com/IogaMaster/neocord
This commit is contained in:
parent
22351f4628
commit
ca6240ddc2
3 changed files with 246 additions and 0 deletions
|
@ -142,6 +142,7 @@
|
||||||
./utils/molten.nix
|
./utils/molten.nix
|
||||||
./utils/multicursors.nix
|
./utils/multicursors.nix
|
||||||
./utils/navbuddy.nix
|
./utils/navbuddy.nix
|
||||||
|
./utils/neocord.nix
|
||||||
./utils/neogen.nix
|
./utils/neogen.nix
|
||||||
./utils/neorg.nix
|
./utils/neorg.nix
|
||||||
./utils/netman.nix
|
./utils/netman.nix
|
||||||
|
|
172
plugins/utils/neocord.nix
Normal file
172
plugins/utils/neocord.nix
Normal file
|
@ -0,0 +1,172 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
helpers,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
|
name = "neocord";
|
||||||
|
defaultPackage = pkgs.vimPlugins.neocord;
|
||||||
|
|
||||||
|
maintainers = [maintainers.redyf];
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
# General options.
|
||||||
|
auto_update = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Update activity based on autocmd events.
|
||||||
|
If `false`, map or manually execute
|
||||||
|
`:lua package.loaded.neocord:update()`
|
||||||
|
'';
|
||||||
|
|
||||||
|
logo = helpers.defaultNullOpts.mkEnum ["auto" "url"] "auto" ''
|
||||||
|
Update the Logo to the specified option ("auto" or url).
|
||||||
|
'';
|
||||||
|
|
||||||
|
logo_tooltip = helpers.defaultNullOpts.mkEnum ["null" "string"] "null" ''
|
||||||
|
Sets the logo tooltip
|
||||||
|
'';
|
||||||
|
|
||||||
|
main_image = helpers.defaultNullOpts.mkEnum ["language" "logo"] "language" ''
|
||||||
|
Main image display (either "language" or "logo")
|
||||||
|
'';
|
||||||
|
|
||||||
|
client_id = helpers.defaultNullOpts.mkStr "1157438221865717891" ''
|
||||||
|
Use your own Discord application client id. (not recommended)
|
||||||
|
'';
|
||||||
|
|
||||||
|
log_level = helpers.defaultNullOpts.mkEnum ["debug" "info" "warn" "error"] "null" ''
|
||||||
|
Log messages at or above this level.
|
||||||
|
'';
|
||||||
|
|
||||||
|
debounce_timeout = helpers.defaultNullOpts.mkInt 10 ''
|
||||||
|
Number of seconds to debounce events.
|
||||||
|
(or calls to `:lua package.loaded.neocord:update(<filename>, true)`)
|
||||||
|
'';
|
||||||
|
|
||||||
|
enable_line_number = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Displays the current line number instead of the current project.
|
||||||
|
'';
|
||||||
|
|
||||||
|
blacklist = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
|
A list of strings or Lua patterns that disable Rich Presence if the
|
||||||
|
current file name, path, or workspace matches.
|
||||||
|
'';
|
||||||
|
|
||||||
|
buttons =
|
||||||
|
helpers.defaultNullOpts.mkNullable
|
||||||
|
(with types;
|
||||||
|
either
|
||||||
|
helpers.nixvimTypes.rawLua
|
||||||
|
(listOf (submodule {
|
||||||
|
options = {
|
||||||
|
label = helpers.mkNullOrOption str "";
|
||||||
|
url = helpers.mkNullOrOption str "";
|
||||||
|
};
|
||||||
|
})))
|
||||||
|
"[]"
|
||||||
|
''
|
||||||
|
Button configurations which will always appear in Rich Presence.
|
||||||
|
Can be a list of attribute sets, each with the following attributes:
|
||||||
|
`label`: The label of the button. e.g. `"GitHub Profile"`.
|
||||||
|
`url`: The URL the button leads to. e.g. `"https://github.com/<NAME>"`.
|
||||||
|
Can also be a lua function: `function(buffer: string, repo_url: string|nil): table`
|
||||||
|
'';
|
||||||
|
|
||||||
|
file_assets = helpers.mkNullOrOption (with types; attrsOf (listOf str)) ''
|
||||||
|
Custom file asset definitions keyed by file names and extensions.
|
||||||
|
List elements for each attribute (filetype):
|
||||||
|
`name`: The name of the asset shown as the title of the file in Discord.
|
||||||
|
`source`: The source of the asset, either an art asset key or the URL of an image asset.
|
||||||
|
Example:
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
# Use art assets uploaded in Discord application for the configured client id
|
||||||
|
js = [ "JavaScript" "javascript" ];
|
||||||
|
ts = [ "TypeScript" "typescript" ];
|
||||||
|
# Use image URLs
|
||||||
|
rs = [ "Rust" "https://www.rust-lang.org/logos/rust-logo-512x512.png" ];
|
||||||
|
go = [ "Go" "https://go.dev/blog/go-brand/Go-Logo/PNG/Go-Logo_Aqua.png" ];
|
||||||
|
};
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
|
||||||
|
show_time = helpers.defaultNullOpts.mkBool true "Show the timer.";
|
||||||
|
|
||||||
|
global_timer = helpers.defaultNullOpts.mkBool false "if set true, timer won't update when any event are triggered.";
|
||||||
|
|
||||||
|
# Rich presence text options.
|
||||||
|
editing_text = helpers.defaultNullOpts.mkStr "Editing %s" ''
|
||||||
|
String rendered when an editable file is loaded in the buffer.
|
||||||
|
Can also be a lua function:
|
||||||
|
`function(filename: string): string`
|
||||||
|
'';
|
||||||
|
|
||||||
|
file_explorer_text = helpers.defaultNullOpts.mkStr "Browsing %s" ''
|
||||||
|
String rendered when browsing a file explorer.
|
||||||
|
Can also be a lua function:
|
||||||
|
`function(file_explorer_name: string): string`
|
||||||
|
'';
|
||||||
|
|
||||||
|
git_commit_text = helpers.defaultNullOpts.mkStr "Committing changes" ''
|
||||||
|
String rendered when committing changes in git.
|
||||||
|
Can also be a lua function:
|
||||||
|
`function(filename: string): string`
|
||||||
|
'';
|
||||||
|
|
||||||
|
plugin_manager_text = helpers.defaultNullOpts.mkStr "Managing plugins" ''
|
||||||
|
String rendered when managing plugins.
|
||||||
|
Can also be a lua function:
|
||||||
|
`function(plugin_manager_name: string): string`
|
||||||
|
'';
|
||||||
|
|
||||||
|
reading_text = helpers.defaultNullOpts.mkStr "Reading %s" ''
|
||||||
|
String rendered when a read-only/unmodifiable file is loaded into the buffer.
|
||||||
|
Can also be a lua function:
|
||||||
|
`function(filename: string): string`
|
||||||
|
'';
|
||||||
|
|
||||||
|
workspace_text = helpers.defaultNullOpts.mkStr "Working on %s" ''
|
||||||
|
String rendered when in a git repository.
|
||||||
|
Can also be a lua function:
|
||||||
|
`function(project_name: string|nil, filename: string): string`
|
||||||
|
'';
|
||||||
|
|
||||||
|
line_number_text = helpers.defaultNullOpts.mkStr "Line %s out of %s" ''
|
||||||
|
String rendered when `enableLineNumber` is set to `true` to display the current line number.
|
||||||
|
Can also be a lua function:
|
||||||
|
`function(line_number: number, line_count: number): string`
|
||||||
|
'';
|
||||||
|
|
||||||
|
terminal_text = helpers.defaultNullOpts.mkStr "Using Terminal" ''
|
||||||
|
Format string rendered when in terminal mode.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
settingsExample = {
|
||||||
|
#General options
|
||||||
|
auto_update = true;
|
||||||
|
logo = "auto";
|
||||||
|
logo_tooltip = null;
|
||||||
|
main_image = "language";
|
||||||
|
client_id = "1157438221865717891";
|
||||||
|
log_level = null;
|
||||||
|
debounce_timeout = 10;
|
||||||
|
enable_line_number = false;
|
||||||
|
blacklist = [];
|
||||||
|
file_assets = null;
|
||||||
|
show_time = true;
|
||||||
|
global_timer = false;
|
||||||
|
|
||||||
|
# Rich Presence text options
|
||||||
|
editing_text = "Editing...";
|
||||||
|
file_explorer_text = "Browsing...";
|
||||||
|
git_commit_text = "Committing changes...";
|
||||||
|
plugin_manager_text = "Managing plugins...";
|
||||||
|
reading_text = "Reading...";
|
||||||
|
workspace_text = "Working on %s";
|
||||||
|
line_number_text = "Line %s out of %s";
|
||||||
|
terminal_text = "Using Terminal...";
|
||||||
|
};
|
||||||
|
}
|
73
tests/test-sources/plugins/utils/neocord.nix
Normal file
73
tests/test-sources/plugins/utils/neocord.nix
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
# don't run tests as they try to acess the network.
|
||||||
|
tests.dontRun = true;
|
||||||
|
plugins.neocord.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
# don't run tests as they try to acess the network.
|
||||||
|
tests.dontRun = true;
|
||||||
|
plugins.neocord = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
# General options.
|
||||||
|
logo = "auto";
|
||||||
|
logo_tooltip = null;
|
||||||
|
main_image = "language";
|
||||||
|
client_id = "1157438221865717891";
|
||||||
|
log_level = null;
|
||||||
|
debounce_timeout = 10;
|
||||||
|
blacklist = [];
|
||||||
|
file_assets = null;
|
||||||
|
show_time = true;
|
||||||
|
global_timer = false;
|
||||||
|
|
||||||
|
# Rich presence text options.
|
||||||
|
editing_text = "Editing %s";
|
||||||
|
file_explorer_text = "Browsing %s";
|
||||||
|
git_commit_text = "Committing changes";
|
||||||
|
plugin_manager_text = "Managing plugins";
|
||||||
|
reading_text = "Reading %s";
|
||||||
|
workspace_text = "Working on %s";
|
||||||
|
line_number_text = "Line %s out of %s";
|
||||||
|
terminal_text = "Using Terminal";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
example = {
|
||||||
|
# don't run tests as they try to acess the network.
|
||||||
|
tests.dontRun = true;
|
||||||
|
plugins.neocord = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
#General options
|
||||||
|
auto_update = true;
|
||||||
|
logo = "auto";
|
||||||
|
logo_tooltip = null;
|
||||||
|
main_image = "language";
|
||||||
|
client_id = "1157438221865717891";
|
||||||
|
log_level = null;
|
||||||
|
debounce_timeout = 10;
|
||||||
|
enable_line_number = false;
|
||||||
|
blacklist = [];
|
||||||
|
file_assets = null;
|
||||||
|
show_time = true;
|
||||||
|
global_timer = false;
|
||||||
|
|
||||||
|
# Rich Presence text options
|
||||||
|
editing_text = "Editing...";
|
||||||
|
file_explorer_text = "Browsing...";
|
||||||
|
git_commit_text = "Committing changes...";
|
||||||
|
plugin_manager_text = "Managing plugins...";
|
||||||
|
reading_text = "Reading...";
|
||||||
|
workspace_text = "Working on %s";
|
||||||
|
line_number_text = "Line %s out of %s";
|
||||||
|
terminal_text = "Using Terminal...";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue