mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/languages: move to by-name
This commit is contained in:
parent
9d323f3ec7
commit
b1d0959bc9
71 changed files with 19 additions and 36 deletions
271
plugins/by-name/clangd-extensions/default.nix
Normal file
271
plugins/by-name/clangd-extensions/default.nix
Normal file
|
@ -0,0 +1,271 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.clangd-extensions;
|
||||
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"clangd-extensions"
|
||||
];
|
||||
|
||||
borderOpt = helpers.defaultNullOpts.mkBorder "none" "clangd-extensions" "";
|
||||
in
|
||||
{
|
||||
# All of those warnings were introduced on 08/22/2023.
|
||||
# TODO: Remove them in ~2 months (Oct. 2023).
|
||||
imports =
|
||||
[
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "server" ]) ''
|
||||
To configure the `clangd` language server options, please use
|
||||
`plugins.lsp.servers.clangd.extraSettings`.
|
||||
'')
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPath
|
||||
++ [
|
||||
"extensions"
|
||||
"autoSetHints"
|
||||
]
|
||||
) "")
|
||||
]
|
||||
++ (map
|
||||
(
|
||||
optionPath:
|
||||
mkRenamedOptionModule (basePluginPath ++ [ "extensions" ] ++ optionPath) (
|
||||
basePluginPath ++ optionPath
|
||||
)
|
||||
)
|
||||
[
|
||||
[
|
||||
"inlayHints"
|
||||
"inline"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"onlyCurrentLine"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"onlyCurrentLineAutocmd"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"showParameterHints"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"parameterHintsPrefix"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"otherHintsPrefix"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"maxLenAlign"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"maxLenAlignPadding"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"rightAlign"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"rightAlignPadding"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"highlight"
|
||||
]
|
||||
[
|
||||
"inlayHints"
|
||||
"priority"
|
||||
]
|
||||
[ "ast" ]
|
||||
[ "memoryUsage" ]
|
||||
[ "symbolInfo" ]
|
||||
]
|
||||
);
|
||||
|
||||
options.plugins.clangd-extensions = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "clangd_extensions, plugins implementing clangd LSP extensions";
|
||||
|
||||
package = lib.mkPackageOption pkgs "clangd_extensions.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"clangd_extensions-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
enableOffsetEncodingWorkaround = mkEnableOption ''
|
||||
utf-16 offset encoding. This is used to work around the warning:
|
||||
"multiple different client offset_encodings detected for buffer, this is not supported yet"
|
||||
'';
|
||||
|
||||
inlayHints = {
|
||||
inline = helpers.defaultNullOpts.mkLua ''vim.fn.has("nvim-0.10") == 1'' ''
|
||||
Show hints inline.
|
||||
'';
|
||||
|
||||
onlyCurrentLine = helpers.defaultNullOpts.mkBool false "Only show inlay hints for the current line";
|
||||
|
||||
onlyCurrentLineAutocmd = helpers.defaultNullOpts.mkStr "CursorHold" ''
|
||||
Event which triggers a refersh of the inlay hints.
|
||||
You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
|
||||
not that this may cause higher CPU usage.
|
||||
This option is only respected when `onlyCurrentLine` is true.
|
||||
'';
|
||||
|
||||
showParameterHints = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to show parameter hints with the inlay hints or not.
|
||||
'';
|
||||
|
||||
parameterHintsPrefix = helpers.defaultNullOpts.mkStr "<- " "Prefix for parameter hints.";
|
||||
|
||||
otherHintsPrefix = helpers.defaultNullOpts.mkStr "=> " "Prefix for all the other hints (type, chaining).";
|
||||
|
||||
maxLenAlign = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to align to the length of the longest line in the file.
|
||||
'';
|
||||
|
||||
maxLenAlignPadding = helpers.defaultNullOpts.mkInt 1 ''
|
||||
Padding from the left if max_len_align is true.
|
||||
'';
|
||||
|
||||
rightAlign = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to align to the extreme right or not.
|
||||
'';
|
||||
|
||||
rightAlignPadding = helpers.defaultNullOpts.mkInt 7 ''
|
||||
Padding from the right if right_align is true.
|
||||
'';
|
||||
|
||||
highlight = helpers.defaultNullOpts.mkStr "Comment" "The color of the hints.";
|
||||
|
||||
priority = helpers.defaultNullOpts.mkInt 100 "The highlight group priority for extmark.";
|
||||
};
|
||||
|
||||
ast = {
|
||||
roleIcons = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "") {
|
||||
type = "🄣";
|
||||
declaration = "🄓";
|
||||
expression = "🄔";
|
||||
statement = ";";
|
||||
specifier = "🄢";
|
||||
templateArgument = "🆃";
|
||||
};
|
||||
|
||||
kindIcons = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "") {
|
||||
compound = "🄲";
|
||||
recovery = "🅁";
|
||||
translationUnit = "🅄";
|
||||
packExpansion = "🄿";
|
||||
templateTypeParm = "🅃";
|
||||
templateTemplateParm = "🅃";
|
||||
templateParamObject = "🅃";
|
||||
};
|
||||
|
||||
highlights = {
|
||||
detail = helpers.defaultNullOpts.mkStr "Comment" "";
|
||||
};
|
||||
};
|
||||
|
||||
memoryUsage = {
|
||||
border = borderOpt;
|
||||
};
|
||||
|
||||
symbolInfo = {
|
||||
border = borderOpt;
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inlay_hints = with inlayHints; {
|
||||
inherit inline;
|
||||
only_current_line = onlyCurrentLine;
|
||||
only_current_line_autocmd = onlyCurrentLineAutocmd;
|
||||
show_parameter_hints = showParameterHints;
|
||||
parameter_hints_prefix = parameterHintsPrefix;
|
||||
other_hints_prefix = otherHintsPrefix;
|
||||
max_len_align = maxLenAlign;
|
||||
max_len_align_padding = maxLenAlignPadding;
|
||||
right_align = rightAlign;
|
||||
right_align_padding = rightAlignPadding;
|
||||
inherit highlight priority;
|
||||
};
|
||||
ast = with ast; {
|
||||
role_icons = with roleIcons; {
|
||||
inherit
|
||||
type
|
||||
declaration
|
||||
expression
|
||||
statement
|
||||
specifier
|
||||
;
|
||||
"template argument" = templateArgument;
|
||||
};
|
||||
kind_icons = with kindIcons; {
|
||||
Compound = compound;
|
||||
Recovery = recovery;
|
||||
TranslationUnit = translationUnit;
|
||||
PackExpansion = packExpansion;
|
||||
TemplateTypeParm = templateTypeParm;
|
||||
TemplateTemplateParm = templateTemplateParm;
|
||||
TemplateParamObject = templateParamObject;
|
||||
};
|
||||
highlights = with highlights; {
|
||||
inherit detail;
|
||||
};
|
||||
};
|
||||
memory_usage = with memoryUsage; {
|
||||
inherit border;
|
||||
};
|
||||
symbol_info = with symbolInfo; {
|
||||
inherit border;
|
||||
};
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
warnings = optional (!config.plugins.lsp.enable) ''
|
||||
You have enabled `clangd-extensions` but not the lsp (`plugins.lsp`).
|
||||
You should set `plugins.lsp.enable = true` to make use of the clangd-extensions' features.
|
||||
'';
|
||||
|
||||
plugins.lsp = {
|
||||
servers.clangd = {
|
||||
# Enable the clangd language server
|
||||
enable = true;
|
||||
|
||||
extraOptions = mkIf cfg.enableOffsetEncodingWorkaround {
|
||||
capabilities = {
|
||||
__raw = "__clangdCaps";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
preConfig = optionalString cfg.enableOffsetEncodingWorkaround ''
|
||||
local __clangdCaps = vim.lsp.protocol.make_client_capabilities()
|
||||
__clangdCaps.offsetEncoding = { "utf-16" }
|
||||
'';
|
||||
};
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.lsp.postConfig = ''
|
||||
require("clangd_extensions").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
163
plugins/by-name/cmake-tools/default.nix
Normal file
163
plugins/by-name/cmake-tools/default.nix
Normal file
|
@ -0,0 +1,163 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "cmake-tools";
|
||||
originalName = "cmake-tools.nvim";
|
||||
package = "cmake-tools-nvim";
|
||||
|
||||
maintainers = [ helpers.maintainers.NathanFelber ];
|
||||
|
||||
settingsOptions = {
|
||||
cmake_command = helpers.defaultNullOpts.mkStr "cmake" ''
|
||||
This is used to specify cmake command path.
|
||||
'';
|
||||
|
||||
ctest_command = helpers.defaultNullOpts.mkStr "ctest" ''
|
||||
This is used to specify ctest command path.
|
||||
'';
|
||||
|
||||
cmake_regenerate_on_save = helpers.defaultNullOpts.mkBool true ''
|
||||
Auto generate when save CMakeLists.txt.
|
||||
'';
|
||||
|
||||
cmake_generate_options =
|
||||
helpers.defaultNullOpts.mkAttrsOf lib.types.anything { "-DCMAKE_EXPORT_COMPILE_COMMANDS" = 1; }
|
||||
''
|
||||
This will be passed when invoke `CMakeGenerate`.
|
||||
'';
|
||||
|
||||
cmake_build_options = helpers.defaultNullOpts.mkAttrsOf lib.types.anything { } ''
|
||||
This will be passed when invoke `CMakeBuild`.
|
||||
'';
|
||||
|
||||
cmake_build_directory = helpers.defaultNullOpts.mkStr "out/\${variant:buildType}" ''
|
||||
This is used to specify generate directory for cmake, allows macro expansion, relative to vim.loop.cwd().
|
||||
'';
|
||||
|
||||
cmake_soft_link_compile_commands = helpers.defaultNullOpts.mkBool true ''
|
||||
This will automatically make a soft link from compile commands file to project root dir.
|
||||
'';
|
||||
|
||||
cmake_compile_commands_from_lsp = helpers.defaultNullOpts.mkBool false ''
|
||||
This will automatically set compile commands file location using lsp, to use it, please set `cmake_soft_link_compile_commands` to false.
|
||||
'';
|
||||
|
||||
cmake_kits_path = helpers.defaultNullOpts.mkStr null ''
|
||||
This is used to specify global cmake kits path, see CMakeKits for detailed usage.
|
||||
'';
|
||||
|
||||
cmake_variants_message = {
|
||||
short = helpers.defaultNullOpts.mkAttrsOf lib.types.anything { show = true; } ''
|
||||
Whether to show short message.
|
||||
'';
|
||||
|
||||
long =
|
||||
helpers.defaultNullOpts.mkAttrsOf lib.types.anything
|
||||
{
|
||||
show = true;
|
||||
max_length = 40;
|
||||
}
|
||||
''
|
||||
Whether to show long message.
|
||||
'';
|
||||
};
|
||||
|
||||
cmake_dap_configuration = {
|
||||
name = helpers.defaultNullOpts.mkStr "cpp" ''
|
||||
Name of the launch configuration.
|
||||
'';
|
||||
|
||||
type = helpers.defaultNullOpts.mkStr "codelldb" ''
|
||||
Debug adapter to use.
|
||||
'';
|
||||
|
||||
request = helpers.defaultNullOpts.mkStr "launch" ''
|
||||
Session initiation method.
|
||||
'';
|
||||
};
|
||||
|
||||
cmake_executor = {
|
||||
name = helpers.defaultNullOpts.mkStr "quickfix" ''
|
||||
Name of the executor.
|
||||
'';
|
||||
|
||||
opts = helpers.defaultNullOpts.mkAttrsOf lib.types.anything { } ''
|
||||
The options the executor will get, possible values depend on the executor type.
|
||||
'';
|
||||
};
|
||||
|
||||
cmake_runner = {
|
||||
name = helpers.defaultNullOpts.mkStr "terminal" ''
|
||||
Name of the runner.
|
||||
'';
|
||||
|
||||
opts = helpers.defaultNullOpts.mkAttrsOf lib.types.anything { } ''
|
||||
The options the runner will get, possible values depend on the runner type.
|
||||
'';
|
||||
};
|
||||
|
||||
cmake_notifications = {
|
||||
runner.enabled = helpers.defaultNullOpts.mkBool true "";
|
||||
|
||||
executor.enabled = helpers.defaultNullOpts.mkBool true "";
|
||||
|
||||
spinner =
|
||||
helpers.defaultNullOpts.mkListOf lib.types.str
|
||||
[
|
||||
"⠋"
|
||||
"⠙"
|
||||
"⠹"
|
||||
"⠸"
|
||||
"⠼"
|
||||
"⠴"
|
||||
"⠦"
|
||||
"⠧"
|
||||
"⠇"
|
||||
"⠏"
|
||||
]
|
||||
''
|
||||
Icons used for progress display.
|
||||
'';
|
||||
|
||||
refresh_rate_ms = helpers.defaultNullOpts.mkPositiveInt 100 ''
|
||||
How often to iterate icons.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
cmake_regenerate_on_save = false;
|
||||
cmake_build_directory = "build/\${variant:buildtype}";
|
||||
cmake_soft_link_compile_commands = false;
|
||||
cmake_dap_configuration = {
|
||||
name = "Launch file";
|
||||
type = "codelldb";
|
||||
request = "launch";
|
||||
program.__raw = ''
|
||||
function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end
|
||||
'';
|
||||
cwd = "\${workspaceFolder}";
|
||||
stopOnEntry = false;
|
||||
};
|
||||
cmake_executor.name = "toggleterm";
|
||||
cmake_runner.name = "toggleterm";
|
||||
cmake_notifications = {
|
||||
spinner = [
|
||||
"▱▱▱▱▱▱▱"
|
||||
"▰▱▱▱▱▱▱"
|
||||
"▰▰▱▱▱▱▱"
|
||||
"▰▰▰▱▱▱▱"
|
||||
"▰▰▰▰▱▱▱"
|
||||
"▰▰▰▰▰▱▱"
|
||||
"▰▰▰▰▰▰▱"
|
||||
"▰▰▰▰▰▰▰"
|
||||
];
|
||||
refresh_rate_ms = 80;
|
||||
};
|
||||
};
|
||||
}
|
193
plugins/by-name/debugprint/default.nix
Normal file
193
plugins/by-name/debugprint/default.nix
Normal file
|
@ -0,0 +1,193 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "debugprint";
|
||||
originalName = "debugprint.nvim";
|
||||
package = "debugprint-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-04-07: remove 2024-06-07
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"moveToDebugline"
|
||||
"displayCounter"
|
||||
"displaySnippet"
|
||||
"ignoreTreesitter"
|
||||
"printTag"
|
||||
];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"debugprint"
|
||||
];
|
||||
in
|
||||
[
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "createCommands" ]) ''
|
||||
This option has been deprectaded upstream.
|
||||
Learn more [here](https://github.com/andrewferrier/debugprint.nvim/blob/796d8d4528bc5882d287b26e69cc8d810a9147c8/doc/debugprint.nvim.txt#L203-L213).
|
||||
'')
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "createKeymaps" ]) ''
|
||||
This option has been deprectaded upstream.
|
||||
Learn more [here](https://github.com/andrewferrier/debugprint.nvim/blob/796d8d4528bc5882d287b26e69cc8d810a9147c8/doc/debugprint.nvim.txt#L203-L213).
|
||||
'')
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "filetypes" ]) ''
|
||||
Please use `plugins.debugprint.settings.filetypes` instead.
|
||||
The sub-module options for each filetype are `left`, `right`, `mid_var` and `right_var`.
|
||||
'')
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
keymaps =
|
||||
helpers.defaultNullOpts.mkAttrsOf (with helpers.nixvimTypes; attrsOf (either str rawLua))
|
||||
{
|
||||
normal = {
|
||||
plain_below = "g?p";
|
||||
plain_above = "g?P";
|
||||
variable_below = "g?v";
|
||||
variable_above = "g?V";
|
||||
variable_below_alwaysprompt.__raw = "nil";
|
||||
variable_above_alwaysprompt.__raw = "nil";
|
||||
textobj_below = "g?o";
|
||||
textobj_above = "g?O";
|
||||
toggle_comment_debug_prints.__raw = "nil";
|
||||
delete_debug_prints.__raw = "nil";
|
||||
};
|
||||
visual = {
|
||||
variable_below = "g?v";
|
||||
variable_above = "g?V";
|
||||
};
|
||||
}
|
||||
''
|
||||
By default, the plugin will create some keymappings for use 'out of the box'.
|
||||
There are also some function invocations which are not mapped to any keymappings by
|
||||
default, but could be.
|
||||
This can be overridden using this option.
|
||||
|
||||
You only need to include the keys which you wish to override, others will default as shown
|
||||
in the documentation.
|
||||
Setting any key to `nil` (warning: use `__raw`) will skip it.
|
||||
|
||||
The default keymappings are chosen specifically because ordinarily in NeoVim they are used
|
||||
to convert sections to ROT-13, which most folks don’t use.
|
||||
'';
|
||||
|
||||
commands =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
||||
{
|
||||
toggle_comment_debug_prints = "ToggleCommentDebugPrints";
|
||||
delete_debug_prints = "DeleteDebugPrints";
|
||||
}
|
||||
''
|
||||
By default, the plugin will create some commands for use 'out of the box'.
|
||||
There are also some function invocations which are not mapped to any commands by default,
|
||||
but could be.
|
||||
This can be overridden using this option.
|
||||
|
||||
You only need to include the commands which you wish to override, others will default as
|
||||
shown in the documentation.
|
||||
Setting any command to `nil` (warning: use `__raw`) will skip it.
|
||||
'';
|
||||
|
||||
move_to_debugline = helpers.defaultNullOpts.mkBool false ''
|
||||
When adding a debug line, moves the cursor to that line.
|
||||
'';
|
||||
|
||||
display_counter = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to display/include the monotonically increasing counter in each debug message.
|
||||
'';
|
||||
|
||||
display_snippet = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to include a snippet of the line above/below in plain debug lines.
|
||||
'';
|
||||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
left = mkOption {
|
||||
type = str;
|
||||
description = "Left part of snippet to insert.";
|
||||
};
|
||||
|
||||
right = mkOption {
|
||||
type = str;
|
||||
description = "Right part of snippet to insert (plain debug line mode).";
|
||||
};
|
||||
|
||||
mid_var = mkOption {
|
||||
type = str;
|
||||
description = "Middle part of snippet to insert (variable debug line mode).";
|
||||
};
|
||||
|
||||
right_var = mkOption {
|
||||
type = str;
|
||||
description = "Right part of snippet to insert (variable debug line mode).";
|
||||
};
|
||||
};
|
||||
})
|
||||
)
|
||||
{ }
|
||||
''
|
||||
Custom filetypes.
|
||||
Your new file format will be merged in with those that already exist.
|
||||
If you pass in one that already exists, your configuration will override the built-in
|
||||
configuration.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
filetypes = {
|
||||
python = {
|
||||
left = "print(f'";
|
||||
right = "')";
|
||||
mid_var = "{";
|
||||
right_var = "}')";
|
||||
};
|
||||
};
|
||||
```
|
||||
'';
|
||||
|
||||
print_tag = helpers.defaultNullOpts.mkStr "DEBUGPRINT" ''
|
||||
The string inserted into each print statement, which can be used to uniquely identify
|
||||
statements inserted by `debugprint`.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
keymaps = {
|
||||
normal = {
|
||||
variable_below = "g?v";
|
||||
variable_above = "g?V";
|
||||
variable_below_alwaysprompt.__raw = "nil";
|
||||
variable_above_alwaysprompt.__raw = "nil";
|
||||
};
|
||||
visual = {
|
||||
variable_below = "g?v";
|
||||
variable_above = "g?V";
|
||||
};
|
||||
};
|
||||
commands = {
|
||||
toggle_comment_debug_prints = "ToggleCommentDebugPrints";
|
||||
delete_debug_prints = "DeleteDebugPrints";
|
||||
};
|
||||
move_to_debugline = false;
|
||||
display_counter = true;
|
||||
display_snippet = true;
|
||||
filetypes = {
|
||||
python = {
|
||||
left = "print(f'";
|
||||
right = "')";
|
||||
mid_var = "{";
|
||||
right_var = "}')";
|
||||
};
|
||||
};
|
||||
print_tag = "DEBUGPRINT";
|
||||
};
|
||||
}
|
81
plugins/by-name/glow/default.nix
Normal file
81
plugins/by-name/glow/default.nix
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "glow";
|
||||
originalName = "glow.nvim";
|
||||
package = "glow-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.getchoo ];
|
||||
|
||||
settingsOptions = {
|
||||
glow_path = helpers.defaultNullOpts.mkStr (helpers.mkRaw "vim.fn.exepath('glow')") ''
|
||||
Path to `glow` binary.
|
||||
|
||||
If null or `""`, `glow` in your `$PATH` with be used if available.
|
||||
|
||||
Using `glowPackage` is the recommended way to make `glow` available in your `$PATH`.
|
||||
'';
|
||||
|
||||
install_path = helpers.defaultNullOpts.mkStr "~/.local/bin" ''
|
||||
Path for installing `glow` binary if one is not found at `glow_path` or in your `$PATH`.
|
||||
|
||||
Consider using `glowPackage` instead.
|
||||
'';
|
||||
|
||||
border = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"shadow"
|
||||
"none"
|
||||
"double"
|
||||
"rounded"
|
||||
"solid"
|
||||
"single"
|
||||
] "Style of the floating window's border.";
|
||||
|
||||
style = helpers.defaultNullOpts.mkEnum [
|
||||
"dark"
|
||||
"light"
|
||||
] (helpers.mkRaw "vim.opt.background") "Glow style.";
|
||||
|
||||
pager = helpers.defaultNullOpts.mkBool false ''
|
||||
Display output in a pager style.
|
||||
'';
|
||||
|
||||
width = helpers.defaultNullOpts.mkInt 100 ''
|
||||
Width of the floating window.
|
||||
'';
|
||||
|
||||
height = helpers.defaultNullOpts.mkInt 100 ''
|
||||
Height of the floating window.
|
||||
'';
|
||||
|
||||
width_ratio = helpers.defaultNullOpts.mkNum 0.7 ''
|
||||
Maximum width of the floating window relative to the window size.
|
||||
'';
|
||||
|
||||
height_ratio = helpers.defaultNullOpts.mkNum 0.7 ''
|
||||
Maximum height of the floating window relative to the window size.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
border = "shadow";
|
||||
style = "dark";
|
||||
pager = false;
|
||||
width = 80;
|
||||
height = 100;
|
||||
width_ratio = 0.7;
|
||||
height_ratio = 0.7;
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
glowPackage = lib.mkPackageOption pkgs "glow" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: { extraPackages = [ cfg.glowPackage ]; };
|
||||
}
|
34
plugins/by-name/godot/default.nix
Normal file
34
plugins/by-name/godot/default.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "godot";
|
||||
originalName = "vim-godot";
|
||||
package = "vim-godot";
|
||||
globalPrefix = "godot_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
extraOptions = {
|
||||
godotPackage = lib.mkPackageOption pkgs "godot" {
|
||||
nullable = true;
|
||||
default = "godot_4";
|
||||
};
|
||||
};
|
||||
|
||||
settingsOptions = {
|
||||
executable = helpers.defaultNullOpts.mkStr "godot" ''
|
||||
Path to the `godot` executable.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
executable = "godot";
|
||||
};
|
||||
|
||||
extraConfig = cfg: { extraPackages = [ cfg.godotPackage ]; };
|
||||
}
|
21
plugins/by-name/haskell-scope-highlighting/default.nix
Normal file
21
plugins/by-name/haskell-scope-highlighting/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "haskell-scope-highlighting";
|
||||
originalName = "haskell-scope-highlighting.nvim";
|
||||
package = "haskell-scope-highlighting-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
extraConfig = _: {
|
||||
warnings = optional (!config.plugins.treesitter.enable) ''
|
||||
Nixvim (plugins.haskell-scope-highlighting): haskell-scope-highlighting needs treesitter to function as intended.
|
||||
Please, enable it by setting `plugins.treesitter.enable` to `true`.
|
||||
'';
|
||||
};
|
||||
}
|
27
plugins/by-name/helm/default.nix
Normal file
27
plugins/by-name/helm/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.helm;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.helm = {
|
||||
enable = mkEnableOption "vim-helm";
|
||||
|
||||
package = lib.mkPackageOption pkgs "vim-helm" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"vim-helm"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable { extraPlugins = [ cfg.package ]; };
|
||||
}
|
95
plugins/by-name/julia-cell/default.nix
Normal file
95
plugins/by-name/julia-cell/default.nix
Normal file
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# The keys are the option name in nixvim (under plugins.julia-cell.keymaps)
|
||||
# cmd: Such that the mapping action is ':JuliaCell${cmd}<CR>'
|
||||
# desc: The description of the option.
|
||||
mappings = {
|
||||
executeCell = {
|
||||
cmd = "ExecuteCell";
|
||||
desc = "executing the current code cell";
|
||||
};
|
||||
executeCellJump = {
|
||||
cmd = "ExecuteCellJump";
|
||||
desc = "executing the current code cell and jumping to the next cell";
|
||||
};
|
||||
run = {
|
||||
cmd = "Run";
|
||||
desc = "running the entire file";
|
||||
};
|
||||
clear = {
|
||||
cmd = "Clear";
|
||||
desc = "clearing the REPL";
|
||||
};
|
||||
prevCell = {
|
||||
cmd = "PrevCell";
|
||||
desc = "jumping to the previous cell header";
|
||||
};
|
||||
nextCell = {
|
||||
cmd = "NextCell";
|
||||
desc = "jumping to the next cell header";
|
||||
};
|
||||
};
|
||||
in
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "julia-cell";
|
||||
originalName = "vim-julia-cell";
|
||||
package = "vim-julia-cell";
|
||||
globalPrefix = "julia_cell_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-02-19: remove 2024-04-19
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"delimitCellsBy"
|
||||
"tag"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
delimit_cells_by =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"marks"
|
||||
"tags"
|
||||
]
|
||||
''
|
||||
Specifies if cells are delimited by 'marks' or 'tags'.
|
||||
'';
|
||||
|
||||
tag = helpers.defaultNullOpts.mkStr "##" "Specifies the tag format.";
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
keymaps =
|
||||
{
|
||||
silent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether julia-cell keymaps should be silent";
|
||||
default = false;
|
||||
};
|
||||
}
|
||||
// (mapAttrs (name: value: helpers.mkNullOrOption types.str "Keymap for ${value.desc}.") mappings);
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
keymaps = flatten (
|
||||
mapAttrsToList (
|
||||
name: value:
|
||||
let
|
||||
key = cfg.keymaps.${name};
|
||||
in
|
||||
optional (key != null) {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = ":JuliaCell${value.cmd}<CR>";
|
||||
options.silent = cfg.keymaps.silent;
|
||||
}
|
||||
) mappings
|
||||
);
|
||||
};
|
||||
}
|
64
plugins/by-name/jupytext/default.nix
Normal file
64
plugins/by-name/jupytext/default.nix
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "jupytext";
|
||||
originalName = "jupytext.nvim";
|
||||
package = "jupytext-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
style = helpers.defaultNullOpts.mkStr "hydrogen" ''
|
||||
The jupytext style to use.
|
||||
'';
|
||||
|
||||
output_extension = helpers.defaultNullOpts.mkStr "auto" ''
|
||||
By default, the extension of the plain text file is automatically selected by jupytext.
|
||||
This can be modified by changing the extension from auto to any other file extension supported
|
||||
by Jupytext.
|
||||
This is most useful to those using Quarto or Markdown.
|
||||
Analogously, we can provide a default filetype that will be given to the new buffer by using
|
||||
`force_ft`.
|
||||
Again, this is only really useful to users of Quarto.
|
||||
'';
|
||||
|
||||
force_ft = helpers.mkNullOrStr ''
|
||||
Default filetype. Don't change unless you know what you are doing.
|
||||
'';
|
||||
|
||||
custom_language_formatting = helpers.defaultNullOpts.mkAttrsOf types.anything { } ''
|
||||
By default we use the auto mode of jupytext.
|
||||
This will create a script with the correct extension for each language.
|
||||
However, this can be overridden in a per language basis if you want to.
|
||||
For this you can set this option.
|
||||
|
||||
For example, to convert python files to quarto markdown:
|
||||
```nix
|
||||
{
|
||||
python = {
|
||||
extension = "qmd";
|
||||
style = "quarto";
|
||||
force_ft = "quarto";
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
style = "light";
|
||||
output_extension = "auto";
|
||||
force_ft = null;
|
||||
custom_language_formatting = {
|
||||
python = {
|
||||
extension = "md";
|
||||
style = "markdown";
|
||||
force_ft = "markdown";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
307
plugins/by-name/lean/default.nix
Normal file
307
plugins/by-name/lean/default.nix
Normal file
|
@ -0,0 +1,307 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lean;
|
||||
in
|
||||
{
|
||||
options.plugins.lean = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "lean-nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "lean-nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"lean-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
leanPackage = lib.mkPackageOption pkgs "lean" {
|
||||
nullable = true;
|
||||
default = "lean4";
|
||||
};
|
||||
|
||||
lsp = helpers.defaultNullOpts.mkNullable (
|
||||
with types;
|
||||
submodule {
|
||||
freeformType = types.attrs;
|
||||
options = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable the Lean language server(s) ?
|
||||
|
||||
Set to `false` to disable, otherwise should be a table of options to pass to
|
||||
`leanls`.
|
||||
See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls
|
||||
for details.
|
||||
'';
|
||||
|
||||
on_attach = helpers.mkNullOrOption types.str ''
|
||||
The LSP handler.
|
||||
'';
|
||||
|
||||
init_options = helpers.mkNullOrOption (with types; attrsOf anything) ''
|
||||
The options to configure the lean language server.
|
||||
See `Lean.Lsp.InitializationOptions` for details.
|
||||
'';
|
||||
};
|
||||
}
|
||||
) { } "LSP settings.";
|
||||
|
||||
ft = {
|
||||
default = helpers.defaultNullOpts.mkStr "lean" ''
|
||||
The default filetype for Lean files.
|
||||
'';
|
||||
|
||||
nomodifiable = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
A list of patterns which will be used to protect any matching Lean file paths from being
|
||||
accidentally modified (by marking the buffer as `nomodifiable`).
|
||||
|
||||
By default, this list includes the Lean standard libraries, as well as files within
|
||||
dependency directories (e.g. `_target`)
|
||||
Set this to an empty table to disable.
|
||||
'';
|
||||
};
|
||||
|
||||
abbreviations = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable expanding of unicode abbreviations.
|
||||
'';
|
||||
|
||||
extra = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
||||
Additional abbreviations.
|
||||
|
||||
Example:
|
||||
```
|
||||
{
|
||||
# Add a \wknight abbreviation to insert ♘
|
||||
#
|
||||
# Note that the backslash is implied, and that you of
|
||||
# course may also use a snippet engine directly to do
|
||||
# this if so desired.
|
||||
wknight = "♘";
|
||||
}
|
||||
'';
|
||||
|
||||
leader = helpers.defaultNullOpts.mkStr "\\" ''
|
||||
Change if you don't like the backslash.
|
||||
(comma is a popular choice on French keyboards)
|
||||
'';
|
||||
};
|
||||
|
||||
mappings = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to enable suggested mappings.
|
||||
'';
|
||||
|
||||
infoview = {
|
||||
autoopen = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically open an infoview on entering a Lean buffer?
|
||||
Should be a function that will be called anytime a new Lean file is opened.
|
||||
Return true to open an infoview, otherwise false.
|
||||
Setting this to `true` is the same as `function() return true end`, i.e. autoopen for any
|
||||
Lean file, or setting it to `false` is the same as `function() return false end`,
|
||||
i.e. never autoopen.
|
||||
'';
|
||||
|
||||
autopause = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
width = helpers.defaultNullOpts.mkPositiveInt 50 ''
|
||||
Set infoview windows' starting width.
|
||||
Windows are opened horizontally or vertically depending on spacing.
|
||||
'';
|
||||
|
||||
height = helpers.defaultNullOpts.mkPositiveInt 20 ''
|
||||
Set infoview windows' starting height.
|
||||
Windows are opened horizontally or vertically depending on spacing.
|
||||
'';
|
||||
|
||||
horizontalPosition =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"top"
|
||||
"bottom"
|
||||
]
|
||||
"bottom"
|
||||
''
|
||||
Put the infoview on the top or bottom when horizontal.
|
||||
'';
|
||||
|
||||
separateTab = helpers.defaultNullOpts.mkBool false ''
|
||||
Always open the infoview window in a separate tabpage.
|
||||
Might be useful if you are using a screen reader and don't want too many dynamic updates
|
||||
in the terminal at the same time.
|
||||
Note that `height` and `width` will be ignored in this case.
|
||||
'';
|
||||
|
||||
indicators =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"always"
|
||||
"never"
|
||||
"auto"
|
||||
]
|
||||
"auto"
|
||||
''
|
||||
Show indicators for pin locations when entering an infoview window.
|
||||
`"auto"` = only when there are multiple pins.
|
||||
'';
|
||||
|
||||
lean3 = {
|
||||
showFilter = helpers.defaultNullOpts.mkBool true "";
|
||||
|
||||
mouseEvents = helpers.defaultNullOpts.mkBool false ''
|
||||
Setting this to `true` will simulate mouse events in the Lean 3 infoview, this is buggy
|
||||
at the moment so you can use the I/i keybindings to manually trigger these.
|
||||
'';
|
||||
};
|
||||
|
||||
showProcessing = helpers.defaultNullOpts.mkBool true "";
|
||||
|
||||
showNoInfoMessage = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
useWidgets = helpers.defaultNullOpts.mkBool true "Whether to use widgets.";
|
||||
|
||||
mappings = helpers.defaultNullOpts.mkAttrsOf types.str {
|
||||
K = "click";
|
||||
"<CR>" = "click";
|
||||
gd = "go_to_def";
|
||||
gD = "go_to_decl";
|
||||
gy = "go_to_type";
|
||||
I = "mouse_enter";
|
||||
i = "mouse_leave";
|
||||
"<Esc>" = "clear_all";
|
||||
C = "clear_all";
|
||||
"<LocalLeader><Tab>" = "goto_last_window";
|
||||
} "Mappings.";
|
||||
};
|
||||
|
||||
progressBars = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable the progress bars.
|
||||
'';
|
||||
|
||||
priority = helpers.defaultNullOpts.mkUnsignedInt 10 ''
|
||||
Use a different priority for the signs.
|
||||
'';
|
||||
};
|
||||
|
||||
stderr = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Redirect Lean's stderr messages somewhere (to a buffer by default).
|
||||
'';
|
||||
|
||||
height = helpers.defaultNullOpts.mkPositiveInt 5 "Height of the window.";
|
||||
|
||||
onLines = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
A callback which will be called with (multi-line) stderr output.
|
||||
|
||||
e.g., use:
|
||||
```nix
|
||||
onLines = "function(lines) vim.notify(lines) end";
|
||||
```
|
||||
if you want to redirect stderr to `vim.notify`.
|
||||
The default implementation will redirect to a dedicated stderr
|
||||
window.
|
||||
'';
|
||||
};
|
||||
|
||||
lsp3 = helpers.defaultNullOpts.mkNullable (
|
||||
with types;
|
||||
submodule {
|
||||
freeformType = types.attrs;
|
||||
options = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable the legacy Lean 3 language server ?
|
||||
|
||||
Set to `false` to disable, otherwise should be a table of options to pass to
|
||||
`lean3ls`.
|
||||
See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lean3ls
|
||||
for details.
|
||||
'';
|
||||
|
||||
on_attach = helpers.mkNullOrOption types.str "The LSP handler.";
|
||||
};
|
||||
}
|
||||
) { } "Legacy Lean3 LSP settings.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
!(
|
||||
# leanls lsp server is disabled in nvim-lspconfig
|
||||
config.plugins.lsp.servers.leanls.enable
|
||||
# lsp is not (!) disabled in the lean.nvim plugin
|
||||
&& !(
|
||||
# lsp is explicitly set to `false`.
|
||||
(isBool cfg.lsp.enable) && !cfg.lsp.enable
|
||||
)
|
||||
);
|
||||
message = ''
|
||||
You have not explicitly set `plugins.lean.lsp` to `false` while having `plugins.lsp.servers.leanls.enable` set to `true`.
|
||||
You need to either
|
||||
|
||||
- Remove the configuration in `plugins.lsp.servers.leanls` and move it to `plugins.lean.lsp`.
|
||||
- Explicitly disable the autoconfiguration of the lsp in the lean.nvim plugin by setting `plugins.lean.lsp` to `false`.
|
||||
|
||||
https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraPackages = [ cfg.leanPackage ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit lsp;
|
||||
ft = with ft; {
|
||||
inherit default nomodifiable;
|
||||
};
|
||||
abbreviations = with abbreviations; {
|
||||
inherit enable extra leader;
|
||||
};
|
||||
inherit mappings;
|
||||
infoview = with infoview; {
|
||||
inherit
|
||||
autoopen
|
||||
autopause
|
||||
width
|
||||
height
|
||||
;
|
||||
horizontal_position = horizontalPosition;
|
||||
separate_tab = separateTab;
|
||||
inherit indicators;
|
||||
lean3 = with lean3; {
|
||||
show_filter = showFilter;
|
||||
mouse_events = mouseEvents;
|
||||
};
|
||||
show_processing = showProcessing;
|
||||
show_no_info_message = showNoInfoMessage;
|
||||
use_widgets = useWidgets;
|
||||
inherit mappings;
|
||||
};
|
||||
progress_bars = with progressBars; {
|
||||
inherit enable priority;
|
||||
};
|
||||
stderr = with stderr; {
|
||||
inherit enable height;
|
||||
on_lines = onLines;
|
||||
};
|
||||
inherit lsp3;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require("lean").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
218
plugins/by-name/ledger/default.nix
Normal file
218
plugins/by-name/ledger/default.nix
Normal file
|
@ -0,0 +1,218 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "ledger";
|
||||
originalName = "vim-ledger";
|
||||
package = "vim-ledger";
|
||||
globalPrefix = "ledger_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"detailedFirst"
|
||||
"foldBlanks"
|
||||
];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"ledger"
|
||||
];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "maxWidth" ]) (
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
"maxwidth"
|
||||
]
|
||||
))
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "fillString" ]) (
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
"fillstring"
|
||||
]
|
||||
))
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
ledgerPackage = lib.mkPackageOption pkgs "ledger" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: { extraPackages = [ cfg.ledgerPackage ]; };
|
||||
|
||||
settingsOptions = {
|
||||
bin = helpers.mkNullOrStr ''
|
||||
Path to the `ledger` executable.
|
||||
'';
|
||||
|
||||
is_hledger = helpers.mkNullOrOption types.bool ''
|
||||
Whether to use ledger or hledger specific features.
|
||||
Setting this value is optional and in most coses will be guessed correctly based on `bin`,
|
||||
but in the event it isn't guessed correctly or you want to use different syntax features
|
||||
even with your default tooling setup for the other engine this flag can be set to override
|
||||
the value.
|
||||
'';
|
||||
|
||||
extra_options = helpers.defaultNullOpts.mkStr "" ''
|
||||
Additional default options for the `ledger` executable.
|
||||
'';
|
||||
|
||||
accounts_cmd = helpers.mkNullOrStr ''
|
||||
To use a custom external system command to generate a list of account names for completion,
|
||||
set the following.
|
||||
If `bin` is set, this will default to running that command with arguments to parse the
|
||||
current file using the accounts subcommand (works with ledger or hledger), otherwise it will
|
||||
parse the postings in the current file itself.
|
||||
'';
|
||||
|
||||
descriptions_cmd = helpers.mkNullOrStr ''
|
||||
To use a custom external system command to generate a list of descriptions for completion,
|
||||
set the following.
|
||||
If `bin` is set, this will default to running that command with arguments to parse the
|
||||
current file using the descriptions subcommand (works with ledger or hledger), otherwise it
|
||||
will parse the transactions in the current file itself.
|
||||
'';
|
||||
|
||||
maxwidth = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
||||
Number of columns that will be used to display the foldtext.
|
||||
Set this when you think that the amount is too far off to the right.
|
||||
When `maxwidth` is zero, the amount will be displayed at the far right side of the screen.
|
||||
'';
|
||||
|
||||
fillstring = helpers.defaultNullOpts.mkStr " " ''
|
||||
String that will be used to fill the space between account name and amount in the foldtext.
|
||||
Set this to get some kind of lines or visual aid.
|
||||
'';
|
||||
|
||||
detailed_first = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
If you want the account completion to be sorted by level of detail/depth instead of
|
||||
alphabetical, set this option to `1`.
|
||||
'';
|
||||
|
||||
fold_blanks = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
By default vim will fold ledger transactions, leaving surrounding blank lines unfolded.
|
||||
You can use this option to hide blank lines following a transaction.
|
||||
|
||||
A value of `0` will disable folding of blank lines, `1` will allow folding of a
|
||||
single blank line between transactions; any larger value will enable folding
|
||||
unconditionally.
|
||||
|
||||
Note that only lines containing no trailing spaces are considered for folding.
|
||||
You can take advantage of this to disable this feature on a case-by-case basis.
|
||||
'';
|
||||
|
||||
decimal_sep = helpers.defaultNullOpts.mkStr "." ''
|
||||
Decimal separator.
|
||||
'';
|
||||
|
||||
align_last = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Specify alignment on first or last matching separator.
|
||||
'';
|
||||
|
||||
align_at = helpers.defaultNullOpts.mkUnsignedInt 60 ''
|
||||
Specify at which column decimal separators should be aligned.
|
||||
'';
|
||||
|
||||
default_commodity = helpers.defaultNullOpts.mkStr "" ''
|
||||
Default commodity used by `ledger#align_amount_at_cursor()`.
|
||||
'';
|
||||
|
||||
align_commodity = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Align on the commodity location instead of the amount
|
||||
'';
|
||||
|
||||
commodity_before = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Flag that tells whether the commodity should be prepended or appended to the amount.
|
||||
'';
|
||||
|
||||
commodity_sep = helpers.defaultNullOpts.mkStr "" ''
|
||||
String to be put between the commodity and the amount:
|
||||
'';
|
||||
|
||||
commodity_spell = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Flag that enable the spelling of the amount.
|
||||
'';
|
||||
|
||||
date_format = helpers.defaultNullOpts.mkStr "%Y/%m/%d" ''
|
||||
Format of transaction date.
|
||||
'';
|
||||
|
||||
main = helpers.defaultNullOpts.mkStr "%" ''
|
||||
The file to be used to generate reports.
|
||||
The default is to use the current file.
|
||||
'';
|
||||
|
||||
winpos = helpers.defaultNullOpts.mkStr "B" ''
|
||||
Position of a report buffer.
|
||||
|
||||
Use `b` for bottom, `t` for top, `l` for left, `r` for right.
|
||||
Use uppercase letters if you want the window to always occupy the full width or height.
|
||||
'';
|
||||
|
||||
qf_register_format = helpers.mkNullOrStr ''
|
||||
Format of quickfix register reports (see `|:Register|`).
|
||||
The format is specified using the standard Ledger syntax for `--format`.
|
||||
'';
|
||||
|
||||
qf_reconcile_format = helpers.mkNullOrStr ''
|
||||
Format of the reconcile quickfix window (see `|:Reconcile|`).
|
||||
The format is specified using the standard Ledger syntax for `--format`.
|
||||
'';
|
||||
|
||||
use_location_list = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Flag that tells whether a location list or a quickfix list should be used:
|
||||
The default is to use the quickfix window.
|
||||
Set to `1` to use a location list.
|
||||
'';
|
||||
|
||||
qf_vertical = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Position of the quickfix/location list.
|
||||
Set to `1` to open the quickfix window in a vertical split.
|
||||
'';
|
||||
|
||||
qf_size = helpers.defaultNullOpts.mkUnsignedInt 10 ''
|
||||
Size of the quickfix window.
|
||||
|
||||
This is the number of lines of a horizontal quickfix window, or the number of columns of a
|
||||
vertical quickfix window.
|
||||
'';
|
||||
|
||||
qf_hide_file = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Flag to show or hide filenames in the quickfix window:
|
||||
|
||||
Filenames in the quickfix window are hidden by default. Set this to 1 is
|
||||
you want filenames to be visible.
|
||||
'';
|
||||
|
||||
cleared_string = helpers.defaultNullOpts.mkStr "Cleared: " ''
|
||||
Text of the output of the `|:Balance|` command.
|
||||
'';
|
||||
|
||||
pending_string = helpers.defaultNullOpts.mkStr "Cleared or pending: " ''
|
||||
Text of the output of the `|:Balance|` command.
|
||||
'';
|
||||
|
||||
target_string = helpers.defaultNullOpts.mkStr "Difference from target: " ''
|
||||
Text of the output of the `|:Balance|` command.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
detailed_first = 1;
|
||||
fold_blanks = 0;
|
||||
maxwidth = 80;
|
||||
fillstring = " ";
|
||||
};
|
||||
}
|
268
plugins/by-name/lint/default.nix
Normal file
268
plugins/by-name/lint/default.nix
Normal file
|
@ -0,0 +1,268 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lint;
|
||||
|
||||
linterOptions = with types; {
|
||||
cmd = {
|
||||
type = str;
|
||||
description = "The command to call the linter";
|
||||
example = "linter_cmd";
|
||||
mandatory = true;
|
||||
};
|
||||
|
||||
stdin = {
|
||||
type = bool;
|
||||
description = ''
|
||||
Whether this parser supports content input via stdin.
|
||||
In that case the filename is automatically added to the arguments.
|
||||
|
||||
Default: `true`
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
|
||||
append_fname = {
|
||||
type = bool;
|
||||
description = ''
|
||||
Automatically append the file name to `args` if `stdin = false`
|
||||
Whether this parser supports content input via stdin.
|
||||
In that case the filename is automatically added to the arguments.
|
||||
|
||||
Default: `true`
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
|
||||
args = {
|
||||
type = listOf (either str helpers.nixvimTypes.rawLua);
|
||||
description = ''
|
||||
List of arguments.
|
||||
Can contain functions with zero arguments that will be evaluated once the linter is used.
|
||||
|
||||
Default: `[]`
|
||||
'';
|
||||
};
|
||||
|
||||
stream = {
|
||||
type = enum [
|
||||
"stdout"
|
||||
"stderr"
|
||||
"both"
|
||||
];
|
||||
description = ''
|
||||
configure the stream to which the linter outputs the linting result.
|
||||
|
||||
Default: `"stdout"`
|
||||
'';
|
||||
example = "stderr";
|
||||
};
|
||||
|
||||
ignore_exitcode = {
|
||||
type = bool;
|
||||
description = ''
|
||||
Whether the linter exiting with a code !=0 should be considered normal.
|
||||
|
||||
Default: `false`
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
env = {
|
||||
type = attrsOf str;
|
||||
description = ''
|
||||
Custom environment table to use with the external process.
|
||||
Note that this replaces the **entire** environment, it is not additive.
|
||||
'';
|
||||
example = {
|
||||
FOO = "bar";
|
||||
};
|
||||
};
|
||||
|
||||
parser = {
|
||||
type = helpers.nixvimTypes.strLuaFn;
|
||||
description = "The code for your parser function.";
|
||||
example = ''
|
||||
require('lint.parser').from_pattern(pattern, groups, severity_map, defaults, opts)
|
||||
'';
|
||||
apply = helpers.mkRaw;
|
||||
mandatory = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkLinterOpts =
|
||||
noDefaults:
|
||||
types.submodule {
|
||||
freeformType = types.attrs;
|
||||
|
||||
options = mapAttrs (
|
||||
optionName:
|
||||
(
|
||||
{
|
||||
mandatory ? false,
|
||||
apply ? x: x,
|
||||
example ? null,
|
||||
type,
|
||||
description,
|
||||
}:
|
||||
mkOption (
|
||||
{
|
||||
inherit apply description example;
|
||||
}
|
||||
// (
|
||||
if
|
||||
noDefaults && mandatory
|
||||
# Make this option mandatory
|
||||
then
|
||||
{ inherit type; }
|
||||
# make it optional
|
||||
else
|
||||
{
|
||||
type = types.nullOr type;
|
||||
default = null;
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
) linterOptions;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plugins.lint = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-lint";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-lint" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-lint"
|
||||
];
|
||||
};
|
||||
|
||||
lintersByFt = mkOption {
|
||||
type = with types; attrsOf (listOf str);
|
||||
default = { };
|
||||
description = ''
|
||||
Configure the linters you want to run per file type.
|
||||
'';
|
||||
example = {
|
||||
text = [ "vale" ];
|
||||
json = [ "jsonlint" ];
|
||||
markdown = [ "vale" ];
|
||||
rst = [ "vale" ];
|
||||
ruby = [ "ruby" ];
|
||||
janet = [ "janet" ];
|
||||
inko = [ "inko" ];
|
||||
clojure = [ "clj-kondo" ];
|
||||
dockerfile = [ "hadolint" ];
|
||||
terraform = [ "tflint" ];
|
||||
};
|
||||
};
|
||||
|
||||
linters = mkOption {
|
||||
type = with types; attrsOf (mkLinterOpts false);
|
||||
default = { };
|
||||
description = ''
|
||||
Customize the existing linters by overriding some of their properties.
|
||||
'';
|
||||
example = {
|
||||
phpcs.args = [
|
||||
"-q"
|
||||
"--report=json"
|
||||
"-"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
customLinters = mkOption {
|
||||
type = with types; attrsOf (either str (mkLinterOpts true));
|
||||
default = { };
|
||||
description = ''
|
||||
Configure the linters you want to run per file type.
|
||||
It can be both an attrs or a string containing the lua code that returns the appropriate
|
||||
table.
|
||||
'';
|
||||
example = { };
|
||||
};
|
||||
|
||||
autoCmd =
|
||||
let
|
||||
defaultEvent = "BufWritePost";
|
||||
defaultCallback = helpers.mkRaw ''
|
||||
function()
|
||||
require('lint').try_lint()
|
||||
end
|
||||
'';
|
||||
in
|
||||
mkOption {
|
||||
type =
|
||||
with types;
|
||||
nullOr (submodule {
|
||||
options = helpers.autocmd.autoCmdOptions // {
|
||||
event = mkOption {
|
||||
type = with types; nullOr (either str (listOf str));
|
||||
default = defaultEvent;
|
||||
description = "The event or events that should trigger linting.";
|
||||
};
|
||||
|
||||
callback = mkOption {
|
||||
type = with types; nullOr (either str helpers.nixvimTypes.rawLua);
|
||||
default = defaultCallback;
|
||||
description = "What action to perform for linting";
|
||||
};
|
||||
};
|
||||
});
|
||||
description = ''
|
||||
The configuration for the linting autocommand.
|
||||
You can disable it by setting this option to `null`.
|
||||
'';
|
||||
default = {
|
||||
event = defaultEvent;
|
||||
callback = defaultCallback;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
''
|
||||
__lint = require('lint')
|
||||
__lint.linters_by_ft = ${helpers.toLuaObject cfg.lintersByFt}
|
||||
''
|
||||
+ (optionalString (cfg.linters != { }) (
|
||||
concatLines (
|
||||
flatten (
|
||||
mapAttrsToList (
|
||||
linter: linterConfig:
|
||||
mapAttrsToList (
|
||||
propName: propValue:
|
||||
optionalString (
|
||||
propValue != null
|
||||
) ''__lint.linters["${linter}"]["${propName}"] = ${helpers.toLuaObject propValue}''
|
||||
) linterConfig
|
||||
) cfg.linters
|
||||
)
|
||||
)
|
||||
))
|
||||
+ (optionalString (cfg.customLinters != { }) (
|
||||
concatLines (
|
||||
mapAttrsToList (
|
||||
customLinter: linterConfig:
|
||||
let
|
||||
linterConfig' = if isString linterConfig then helpers.mkRaw linterConfig else linterConfig;
|
||||
in
|
||||
''__lint.linters["${customLinter}"] = ${helpers.toLuaObject linterConfig'}''
|
||||
) cfg.customLinters
|
||||
)
|
||||
));
|
||||
|
||||
autoCmd = optional (cfg.autoCmd != null) cfg.autoCmd;
|
||||
};
|
||||
}
|
73
plugins/by-name/ltex-extra/default.nix
Normal file
73
plugins/by-name/ltex-extra/default.nix
Normal file
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "ltex-extra";
|
||||
originalName = "ltex_extra.nvim";
|
||||
package = "ltex_extra-nvim";
|
||||
|
||||
maintainers = [ maintainers.loicreynier ];
|
||||
|
||||
callSetup = false;
|
||||
|
||||
settingsOptions = {
|
||||
path = helpers.defaultNullOpts.mkStr "" ''
|
||||
Path (relative to project root) to load external files from.
|
||||
|
||||
Commonly used values are:
|
||||
- `.ltex`
|
||||
- `.vscode` for compatibility with projects using the associated VS Code extension.
|
||||
'';
|
||||
|
||||
init_check = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to load dictionaries on startup.
|
||||
'';
|
||||
|
||||
load_langs = helpers.defaultNullOpts.mkListOf types.str [ "en-US" ] ''
|
||||
Languages for witch dicionnaries will be loaded.
|
||||
See `plugins.lsp.servers.ltex.languages` for possible values.
|
||||
'';
|
||||
|
||||
log_level = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"none"
|
||||
"trace"
|
||||
"debug"
|
||||
"info"
|
||||
"warn"
|
||||
"error"
|
||||
"fatal"
|
||||
] "Log level.";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = optional (!config.plugins.lsp.enable) ''
|
||||
You have enabled `ltex-extra` but not the lsp (`plugins.lsp`).
|
||||
You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
|
||||
'';
|
||||
|
||||
plugins.lsp = {
|
||||
servers.ltex = {
|
||||
# Enable the ltex language server
|
||||
enable = true;
|
||||
|
||||
onAttach.function = ''
|
||||
require("ltex_extra").setup(${helpers.toLuaObject cfg.settings})
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
path = ".ltex";
|
||||
initCheck = true;
|
||||
loadLangs = [
|
||||
"en-US"
|
||||
"fr-FR"
|
||||
];
|
||||
logLevel = "non";
|
||||
};
|
||||
}
|
226
plugins/by-name/markdown-preview/default.nix
Normal file
226
plugins/by-name/markdown-preview/default.nix
Normal file
|
@ -0,0 +1,226 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "markdown-preview";
|
||||
originalName = "markdown-preview.nvim";
|
||||
package = "markdown-preview-nvim";
|
||||
globalPrefix = "mkdp_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"autoStart"
|
||||
"autoClose"
|
||||
"refreshSlow"
|
||||
"commandForGlobal"
|
||||
"openToTheWorld"
|
||||
"openIp"
|
||||
"browser"
|
||||
"echoPreviewUrl"
|
||||
"browserFunc"
|
||||
"previewOptions"
|
||||
"markdownCss"
|
||||
"highlightCss"
|
||||
"port"
|
||||
"pageTitle"
|
||||
"theme"
|
||||
];
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"markdown-preview"
|
||||
"fileTypes"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"markdown-preview"
|
||||
"settings"
|
||||
"filetypes"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
auto_start = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Open the preview window after entering the markdown buffer.
|
||||
'';
|
||||
|
||||
auto_close = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Auto close current preview window when change from markdown buffer to another buffer.
|
||||
'';
|
||||
|
||||
refresh_slow = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Refresh markdown when save the buffer or leave from insert mode, default `0` is auto
|
||||
refresh markdown as you edit or move the cursor.
|
||||
'';
|
||||
|
||||
command_for_global = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Enable markdown preview for all files (by default, the plugin is only enabled for markdown
|
||||
files).
|
||||
'';
|
||||
|
||||
open_to_the_world = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Make the preview server available to others in your network.
|
||||
By default, the server listens on localhost (127.0.0.1).
|
||||
'';
|
||||
|
||||
open_ip = helpers.defaultNullOpts.mkStr "" ''
|
||||
Custom IP used to open the preview page.
|
||||
This can be useful when you work in remote vim and preview on local browser.
|
||||
For more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9.
|
||||
'';
|
||||
|
||||
browser = helpers.defaultNullOpts.mkStr "" ''
|
||||
The browser to open the preview page.
|
||||
'';
|
||||
|
||||
echo_preview_url = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Echo preview page url in command line when opening the preview page.
|
||||
'';
|
||||
|
||||
browser_func = helpers.defaultNullOpts.mkStr "" ''
|
||||
A custom vim function name to open preview page.
|
||||
This function will receive url as param.
|
||||
'';
|
||||
|
||||
preview_options = helpers.mkNullOrOption (types.submodule {
|
||||
freeformType = types.attrs;
|
||||
|
||||
options = {
|
||||
mkit = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
`markdown-it` options for render.
|
||||
'';
|
||||
|
||||
katex = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
`katex` options for math.
|
||||
'';
|
||||
|
||||
uml = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
`markdown-it-plantuml` options.
|
||||
'';
|
||||
|
||||
maid = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
`mermaid` options.
|
||||
'';
|
||||
|
||||
disable_sync_scroll = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Disable sync scroll.
|
||||
'';
|
||||
|
||||
sync_scroll_type =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"middle"
|
||||
"top"
|
||||
"relative"
|
||||
]
|
||||
''
|
||||
Scroll type:
|
||||
- "middle": The cursor position is always shown at the middle of the preview page.
|
||||
- "top": The vim top viewport is always shown at the top of the preview page.
|
||||
- "relative": The cursor position is always shown at the relative position of the preview page.
|
||||
'';
|
||||
|
||||
hide_yaml_meta = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Hide yaml metadata.
|
||||
'';
|
||||
|
||||
sequence_diagrams = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
`js-sequence-diagrams` options.
|
||||
'';
|
||||
|
||||
flowchart_diagrams = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
`flowcharts` diagrams options.
|
||||
'';
|
||||
|
||||
content_editable = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Content editable from the preview page.
|
||||
'';
|
||||
|
||||
disable_filename = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Disable filename header for the preview page.
|
||||
'';
|
||||
|
||||
toc = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Toc options.
|
||||
'';
|
||||
};
|
||||
}) "Preview options";
|
||||
|
||||
markdown_css = helpers.defaultNullOpts.mkStr "" ''
|
||||
Custom markdown style.
|
||||
Must be an absolute path like `"/Users/username/markdown.css"` or
|
||||
`{__raw = "vim.fn.expand('~/markdown.css')";}`.
|
||||
'';
|
||||
|
||||
highlight_css = helpers.defaultNullOpts.mkStr "" ''
|
||||
Custom highlight style.
|
||||
Must be an absolute path like "/Users/username/highlight.css" or
|
||||
`{__raw = "vim.fn.expand('~/highlight.css')";}`.
|
||||
'';
|
||||
|
||||
port = helpers.defaultNullOpts.mkStr "" ''
|
||||
Custom port to start server or empty for random.
|
||||
'';
|
||||
|
||||
page_title = helpers.defaultNullOpts.mkStr "「\$\{name}」" ''
|
||||
Preview page title.
|
||||
`$${name}` will be replaced with the file name.
|
||||
'';
|
||||
|
||||
images_path = helpers.defaultNullOpts.mkStr "" ''
|
||||
Use a custom location for images.
|
||||
'';
|
||||
|
||||
filetypes = helpers.defaultNullOpts.mkListOf types.str [ "markdown" ] ''
|
||||
Recognized filetypes. These filetypes will have `MarkdownPreview...` commands.
|
||||
'';
|
||||
|
||||
theme = helpers.defaultNullOpts.mkEnum' {
|
||||
values = [
|
||||
"dark"
|
||||
"light"
|
||||
];
|
||||
description = ''
|
||||
Default theme (dark or light).
|
||||
'';
|
||||
pluginDefault = literalMD "chosen based on system preferences";
|
||||
};
|
||||
|
||||
combine_preview = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Combine preview window.
|
||||
If enable it will reuse previous opened preview window when you preview markdown file.
|
||||
Ensure to set `auto_close = 0` if you have enable this option.
|
||||
'';
|
||||
|
||||
combine_preview_auto_refresh = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Auto refetch combine preview contents when change markdown buffer only when
|
||||
`combine_preview` is `1`.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
auto_start = 1;
|
||||
auto_close = 1;
|
||||
browser = "firefox";
|
||||
echo_preview_url = 1;
|
||||
preview_options = {
|
||||
disable_sync_scroll = 1;
|
||||
sync_scroll_type = "middle";
|
||||
disable_filename = 1;
|
||||
};
|
||||
markdown_css = "/Users/username/markdown.css";
|
||||
highlight_css.__raw = "vim.fn.expand('~/highlight.css')";
|
||||
port = "8080";
|
||||
page_title = "「\$\{name}」";
|
||||
theme = "dark";
|
||||
};
|
||||
}
|
98
plugins/by-name/markview/default.nix
Normal file
98
plugins/by-name/markview/default.nix
Normal file
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
inherit (lib) types;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "markview";
|
||||
originalName = "markview.nvim";
|
||||
package = "markview-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
description = ''
|
||||
An experimental markdown previewer for Neovim.
|
||||
|
||||
Supports a vast amount of rendering customization.
|
||||
Please refer to the plugin's [documentation](https://github.com/OXY2DEV/markview.nvim/wiki/Configuration-options) for more details.
|
||||
'';
|
||||
|
||||
settingsOptions = {
|
||||
buf_ignore = defaultNullOpts.mkListOf types.str [ "nofile" ] ''
|
||||
Buftypes to disable markview-nvim.
|
||||
'';
|
||||
|
||||
mode =
|
||||
defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"n"
|
||||
"no"
|
||||
]
|
||||
''
|
||||
Modes where preview is enabled.
|
||||
'';
|
||||
|
||||
hybrid_modes = defaultNullOpts.mkListOf types.str null ''
|
||||
Modes where hybrid mode is enabled.
|
||||
'';
|
||||
|
||||
callback = {
|
||||
on_enable = defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault = # Lua
|
||||
''
|
||||
function(buf, win)
|
||||
vim.wo[window].conceallevel = 2;
|
||||
vim.wo[window].concealcursor = "nc";
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
Action to perform when markview is enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
on_disable = defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault = # Lua
|
||||
''
|
||||
function(buf, win)
|
||||
vim.wo[window].conceallevel = 0;
|
||||
vim.wo[window].concealcursor = "";
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
Action to perform when markview is disabled.
|
||||
'';
|
||||
};
|
||||
|
||||
on_mode_change = defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault = # Lua
|
||||
''
|
||||
function(buf, win, mode)
|
||||
if vim.list_contains(markview.configuration.modes, mode) then
|
||||
vim.wo[window].conceallevel = 2;
|
||||
else
|
||||
vim.wo[window].conceallevel = 0;
|
||||
end
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
Action to perform when mode is changed, while the plugin is enabled.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
buf_ignore = [ ];
|
||||
mode = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
hybrid_modes = [
|
||||
"i"
|
||||
"r"
|
||||
];
|
||||
};
|
||||
}
|
12
plugins/by-name/nix/default.nix
Normal file
12
plugins/by-name/nix/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "nix";
|
||||
originalName = "vim-nix";
|
||||
package = "vim-nix";
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
}
|
144
plugins/by-name/nvim-jdtls/default.nix
Normal file
144
plugins/by-name/nvim-jdtls/default.nix
Normal file
|
@ -0,0 +1,144 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.nvim-jdtls;
|
||||
in
|
||||
{
|
||||
options.plugins.nvim-jdtls = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-jdtls";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-jdtls" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-jdtls"
|
||||
];
|
||||
};
|
||||
|
||||
cmd = helpers.mkNullOrOption (types.listOf types.str) ''
|
||||
The command that starts the language server.
|
||||
|
||||
You should either set a value for this option, or, you can instead set the `data` (and
|
||||
`configuration`) options.
|
||||
|
||||
```nix
|
||||
plugins.nvim-jdtls = {
|
||||
enable = true;
|
||||
cmd = [
|
||||
(lib.getExe pkgs.jdt-language-server)
|
||||
"-data" "/path/to/your/workspace"
|
||||
"-configuration" "/path/to/your/configuration"
|
||||
"-foo" "bar"
|
||||
];
|
||||
};
|
||||
```
|
||||
|
||||
Or,
|
||||
```nix
|
||||
plugins.nvim-jdtls = {
|
||||
enable = true;
|
||||
data = "/path/to/your/workspace";
|
||||
configuration = "/path/to/your/configuration";
|
||||
};
|
||||
```
|
||||
'';
|
||||
|
||||
data = mkOption {
|
||||
type = helpers.nixvimTypes.maybeRaw (with types; nullOr str);
|
||||
default = null;
|
||||
example = "/home/YOUR_USERNAME/.cache/jdtls/workspace";
|
||||
description = ''
|
||||
eclipse.jdt.ls stores project specific data within the folder set via the -data flag.
|
||||
If you're using eclipse.jdt.ls with multiple different projects you must use a dedicated
|
||||
data directory per project.
|
||||
'';
|
||||
};
|
||||
|
||||
configuration = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "/home/YOUR_USERNAME/.cache/jdtls/config";
|
||||
description = "Path to the configuration file.";
|
||||
};
|
||||
|
||||
rootDir =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
{ __raw = "require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'})"; }
|
||||
''
|
||||
This is the default if not provided, you can remove it. Or adjust as needed.
|
||||
One dedicated LSP server & client will be started per unique root_dir
|
||||
'';
|
||||
|
||||
settings = helpers.mkNullOrOption types.attrs ''
|
||||
Here you can configure eclipse.jdt.ls specific settings
|
||||
See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
|
||||
for a list of options.
|
||||
'';
|
||||
|
||||
initOptions = helpers.mkNullOrOption types.attrs ''
|
||||
Language server `initializationOptions`
|
||||
You need to extend the `bundles` with paths to jar files if you want to use additional
|
||||
eclipse.jdt.ls plugins.
|
||||
|
||||
See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
|
||||
|
||||
If you don't plan on using the debugger or other eclipse.jdt.ls plugins, ignore this option
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cmd =
|
||||
if (cfg.cmd == null) then
|
||||
let
|
||||
data =
|
||||
if (cfg.data == null) then
|
||||
throw ''
|
||||
You have to either set the 'plugins.nvim-jdtls.data' or the 'plugins.nvim-jdtls.cmd'
|
||||
option.
|
||||
''
|
||||
else
|
||||
cfg.data;
|
||||
in
|
||||
[ (lib.getExe pkgs.jdt-language-server) ]
|
||||
++ [
|
||||
"-data"
|
||||
data
|
||||
]
|
||||
++ (optionals (cfg.configuration != null) [
|
||||
"-configuration"
|
||||
cfg.configuration
|
||||
])
|
||||
else
|
||||
cfg.cmd;
|
||||
|
||||
options = {
|
||||
inherit cmd;
|
||||
root_dir = cfg.rootDir;
|
||||
inherit (cfg) settings;
|
||||
init_options = cfg.initOptions;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraPackages = [ pkgs.jdt-language-server ];
|
||||
|
||||
autoCmd = [
|
||||
{
|
||||
event = "FileType";
|
||||
pattern = "java";
|
||||
callback.__raw = ''
|
||||
function ()
|
||||
require('jdtls').start_or_attach(${helpers.toLuaObject options})
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
81
plugins/by-name/openscad/default.nix
Normal file
81
plugins/by-name/openscad/default.nix
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
defaultFuzzyFinder = "skim";
|
||||
in
|
||||
{
|
||||
options.plugins.openscad = {
|
||||
enable = mkEnableOption "openscad.nvim, a plugin to manage OpenSCAD files";
|
||||
|
||||
package = lib.mkPackageOption pkgs "openscad.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"openscad-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
fuzzyFinder = helpers.defaultNullOpts.mkEnum [
|
||||
"skim"
|
||||
"fzf"
|
||||
] defaultFuzzyFinder "fuzzy finder to find documentation";
|
||||
|
||||
cheatsheetWindowBlend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100) 15 "";
|
||||
|
||||
loadSnippets = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
autoOpen = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
keymaps = {
|
||||
enable = mkEnableOption "keymaps for openscad";
|
||||
|
||||
cheatsheetToggle = helpers.defaultNullOpts.mkStr "<Enter>" "Toggle cheatsheet window";
|
||||
|
||||
helpTrigger = helpers.defaultNullOpts.mkStr "<A-h>" "Fuzzy find help resource";
|
||||
|
||||
helpManualTrigger = helpers.defaultNullOpts.mkStr "<A-m>" "Open offline openscad manual in pdf via zathura";
|
||||
|
||||
execOpenSCADTrigger = helpers.defaultNullOpts.mkStr "<A-o>" "Open file in OpenSCAD";
|
||||
|
||||
topToggle = helpers.defaultNullOpts.mkStr "<A-c>" "toggle htop filtered for openscad processes";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.openscad;
|
||||
fuzzyFinder = if (cfg.fuzzyFinder == null) then defaultFuzzyFinder else cfg.fuzzyFinder;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins =
|
||||
with pkgs.vimPlugins;
|
||||
[ cfg.package ]
|
||||
++ (optional (fuzzyFinder == "skim") skim-vim)
|
||||
++ (optional (fuzzyFinder == "fzf") fzf-vim);
|
||||
|
||||
extraConfigLua = ''
|
||||
require('openscad')
|
||||
'';
|
||||
|
||||
globals = mkMerge [
|
||||
{
|
||||
openscad_fuzzy_finder = cfg.fuzzyFinder;
|
||||
openscad_cheatsheet_window_blend = cfg.cheatsheetWindowBlend;
|
||||
openscad_load_snippets = cfg.loadSnippets;
|
||||
}
|
||||
(mkIf cfg.keymaps.enable {
|
||||
openscad_default_mappings = true;
|
||||
openscad_cheatsheet_toggle_key = cfg.keymaps.cheatsheetToggle;
|
||||
openscad_help_trig_key = cfg.keymaps.helpTrigger;
|
||||
openscad_help_manual_trig_key = cfg.keymaps.helpManualTrigger;
|
||||
openscad_exec_openscad_trig_key = cfg.keymaps.execOpenSCADTrigger;
|
||||
openscad_top_toggle = cfg.keymaps.topToggle;
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
27
plugins/by-name/orgmode/default.nix
Normal file
27
plugins/by-name/orgmode/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "orgmode";
|
||||
originalName = "nvim-orgmode";
|
||||
|
||||
maintainers = [ lib.nixvim.maintainers.refaelsh ];
|
||||
|
||||
settingsOptions = {
|
||||
org_agenda_files = defaultNullOpts.mkNullable (with lib.types; either str (listOf str)) "" ''
|
||||
A path for Org agenda files.
|
||||
'';
|
||||
org_default_notes_file = defaultNullOpts.mkStr "" ''
|
||||
A path to the default notes file.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
org_agenda_files = "~/orgfiles/**/*";
|
||||
org_default_notes_file = "~/orgfiles/refile.org";
|
||||
};
|
||||
}
|
95
plugins/by-name/otter/default.nix
Normal file
95
plugins/by-name/otter/default.nix
Normal file
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "otter";
|
||||
originalName = "otter.nvim";
|
||||
package = "otter-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.perchun ];
|
||||
|
||||
imports = [
|
||||
# TODO: introduced 2024-06-29; remove after 24.11
|
||||
(lib.mkRemovedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"otter"
|
||||
"addCmpSources"
|
||||
]
|
||||
"Otter is now supported by `plugins.cmp.autoEnableSources`, adding `otter` to `cmp` sources will enable this plugin."
|
||||
)
|
||||
# Register nvim-cmp association
|
||||
{ cmpSourcePlugins.otter = "otter"; }
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
lsp = {
|
||||
hover = {
|
||||
border = helpers.defaultNullOpts.mkListOf lib.types.str [
|
||||
"╭"
|
||||
"─"
|
||||
"╮"
|
||||
"│"
|
||||
"╯"
|
||||
"─"
|
||||
"╰"
|
||||
"│"
|
||||
] "";
|
||||
};
|
||||
|
||||
diagnostic_update_events = helpers.defaultNullOpts.mkListOf' {
|
||||
type = lib.types.str;
|
||||
pluginDefault = [ "BufWritePost" ];
|
||||
description = ''
|
||||
`:h events` that cause the diagnostics to update.
|
||||
|
||||
See example for less performant but more instant diagnostic updates.
|
||||
'';
|
||||
example = [
|
||||
"BufWritePost"
|
||||
"InsertLeave"
|
||||
"TextChanged"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
buffers = {
|
||||
set_filetype = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to true, the filetype of the otterbuffers will be set.
|
||||
Otherwise only the autocommand of lspconfig that attaches
|
||||
the language server will be executed without setting the filetype.
|
||||
'';
|
||||
|
||||
write_to_disk = helpers.defaultNullOpts.mkBool false ''
|
||||
Write `<path>.otter.<embedded language extension>` files
|
||||
to disk on save of main buffer.
|
||||
Useful for some linters that require actual files,
|
||||
otter files are deleted on quit or main buffer close.
|
||||
'';
|
||||
};
|
||||
|
||||
strip_wrapping_quote_characters = helpers.defaultNullOpts.mkListOf lib.types.str [
|
||||
"'"
|
||||
"\""
|
||||
"\`"
|
||||
] "";
|
||||
|
||||
handle_leading_whitespace = helpers.defaultNullOpts.mkBool false ''
|
||||
Otter may not work the way you expect when entire code blocks are indented (eg. in Org files).
|
||||
When true, otter handles these cases fully. This is a (minor) performance hit.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
lib.optional (cfg.enable && config.plugins.treesitter.settings.highlight.enable == null)
|
||||
''
|
||||
NixVim(plugins.otter): you have enabled otter, but `plugins.treesitter.settings.highlight.enable` is not enabled.
|
||||
Otter functionality might not work as expected without it and `plugins.treesitter.enable` enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
31
plugins/by-name/parinfer-rust/default.nix
Normal file
31
plugins/by-name/parinfer-rust/default.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "parinfer-rust";
|
||||
globalPrefix = "parinfer_";
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
mode =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"smart"
|
||||
"indent"
|
||||
"paren"
|
||||
]
|
||||
''
|
||||
The mode used to process buffer changes.
|
||||
'';
|
||||
|
||||
force_balance = helpers.defaultNullOpts.mkBool false ''
|
||||
In smart mode and indent mode, parinfer will sometimes leave unbalanced brackets around the
|
||||
cursor and fix them when the cursor moves away.
|
||||
When this option is set to `true`, the brackets will be fixed immediately (and fixed again
|
||||
when text is inserted).
|
||||
'';
|
||||
};
|
||||
}
|
44
plugins/by-name/plantuml-syntax/default.nix
Normal file
44
plugins/by-name/plantuml-syntax/default.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.plugins.plantuml-syntax = {
|
||||
enable = mkEnableOption "plantuml syntax support";
|
||||
|
||||
package = lib.mkPackageOption pkgs "plantuml-syntax" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"plantuml-syntax"
|
||||
];
|
||||
};
|
||||
|
||||
setMakeprg = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Set the makeprg to 'plantuml'";
|
||||
};
|
||||
executableScript = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Set the script to be called with makeprg, default to 'plantuml' in PATH";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.plantuml-syntax;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
globals = {
|
||||
plantuml_set_makeprg = cfg.setMakeprg;
|
||||
plantuml_executable_script = cfg.executableScript;
|
||||
};
|
||||
};
|
||||
}
|
15
plugins/by-name/preview/default.nix
Normal file
15
plugins/by-name/preview/default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "preview";
|
||||
originalName = "Preview.nvim";
|
||||
package = "Preview-nvim";
|
||||
|
||||
hasSettings = false;
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
}
|
130
plugins/by-name/qmk/default.nix
Normal file
130
plugins/by-name/qmk/default.nix
Normal file
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "qmk";
|
||||
originalName = "qmk.nvim";
|
||||
package = "qmk-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
example = "LAYOUT_preonic_grid";
|
||||
description = ''
|
||||
The name of your layout, for example `LAYOUT_preonic_grid` for the preonic keyboard, for
|
||||
zmk this can just be anything, it won't be used.
|
||||
'';
|
||||
};
|
||||
|
||||
layout = mkOption {
|
||||
type = with types; listOf str;
|
||||
example = [
|
||||
"x x"
|
||||
"x^x"
|
||||
];
|
||||
description = ''
|
||||
The keyboard key layout.
|
||||
|
||||
The layout config describes your layout as expected by qmk_firmware.
|
||||
As qmk_firmware is simply expecting an array of key codes, the layout is pretty much up to
|
||||
you.
|
||||
|
||||
A layout is a list of strings, where each string in the list represents a single row.
|
||||
Rows must all be the same width, and you'll see they visually align to what your keymap
|
||||
looks like.
|
||||
'';
|
||||
};
|
||||
|
||||
variant =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"qmk"
|
||||
"zmk"
|
||||
]
|
||||
''
|
||||
Chooses the expected hardware target.
|
||||
'';
|
||||
|
||||
timeout = helpers.defaultNullOpts.mkUnsignedInt 5000 ''
|
||||
Duration of `vim.notify` timeout if using `nvim-notify`.
|
||||
'';
|
||||
|
||||
auto_format_pattern = helpers.defaultNullOpts.mkStr "*keymap.c" ''
|
||||
The autocommand file pattern to use when applying `QMKFormat` on save.
|
||||
'';
|
||||
|
||||
comment_preview = {
|
||||
position =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"top"
|
||||
"bottom"
|
||||
"inside"
|
||||
"none"
|
||||
]
|
||||
''
|
||||
Control the position of the preview, set to `none` to disable (`inside` is only valid for
|
||||
`variant=qmk`).
|
||||
'';
|
||||
|
||||
keymap_overrides = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
||||
A dictionary of key codes to text replacements, any provided value will be merged with the
|
||||
existing dictionary, see [key_map.lua](https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/key_map.lua) for details.
|
||||
'';
|
||||
|
||||
symbols =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
||||
{
|
||||
space = " ";
|
||||
horz = "─";
|
||||
vert = "│";
|
||||
tl = "┌";
|
||||
tm = "┬";
|
||||
tr = "┐";
|
||||
ml = "├";
|
||||
mm = "┼";
|
||||
mr = "┤";
|
||||
bl = "└";
|
||||
bm = "┴";
|
||||
br = "┘";
|
||||
}
|
||||
''
|
||||
A dictionary of symbols used for the preview comment border chars see [default.lua](https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/default.lua) for details.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
name = "LAYOUT_preonic_grid";
|
||||
layout = [
|
||||
"x x"
|
||||
"x^x"
|
||||
];
|
||||
variant = "qmk";
|
||||
timeout = 5000;
|
||||
auto_format_pattern = "*keymap.c";
|
||||
comment_preview = {
|
||||
position = "top";
|
||||
keymap_overrides = { };
|
||||
symbols = {
|
||||
space = " ";
|
||||
horz = "─";
|
||||
vert = "│";
|
||||
tl = "┌";
|
||||
tm = "┬";
|
||||
tr = "┐";
|
||||
ml = "├";
|
||||
mm = "┼";
|
||||
mr = "┤";
|
||||
bl = "└";
|
||||
bm = "┴";
|
||||
br = "┘";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
186
plugins/by-name/rust-tools/default.nix
Normal file
186
plugins/by-name/rust-tools/default.nix
Normal file
|
@ -0,0 +1,186 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.rust-tools;
|
||||
in
|
||||
{
|
||||
options.plugins.rust-tools = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "rust tools plugins";
|
||||
package = lib.mkPackageOption pkgs "rust-tools" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"rust-tools-nvim"
|
||||
];
|
||||
};
|
||||
serverPackage = lib.mkPackageOption pkgs "rust-analyzer" {
|
||||
nullable = true;
|
||||
};
|
||||
|
||||
executor = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"termopen"
|
||||
"quickfix"
|
||||
] "how to execute terminal commands";
|
||||
|
||||
onInitialized = helpers.defaultNullOpts.mkLuaFn null ''
|
||||
Callback to execute once rust-analyzer is done initializing the workspace
|
||||
The callback receives one parameter indicating the `health` of the server:
|
||||
"ok" | "warning" | "error"
|
||||
'';
|
||||
|
||||
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||
'';
|
||||
|
||||
inlayHints = {
|
||||
auto = helpers.defaultNullOpts.mkBool true "automatically set inlay hints (type hints)";
|
||||
|
||||
onlyCurrentLine = helpers.defaultNullOpts.mkBool false "Only show for current line";
|
||||
|
||||
showParameterHints = helpers.defaultNullOpts.mkBool true "whether to show parameter hints with the inlay hints or not";
|
||||
|
||||
parameterHintsPrefix = helpers.defaultNullOpts.mkStr "<- " "prefix for parameter hints";
|
||||
|
||||
otherHintsPrefix = helpers.defaultNullOpts.mkStr "=> " "prefix for all the other hints (type, chaining)";
|
||||
|
||||
maxLenAlign = helpers.defaultNullOpts.mkBool false "whether to align to the length of the longest line in the file";
|
||||
|
||||
maxLenAlignPadding =
|
||||
helpers.defaultNullOpts.mkUnsignedInt 1
|
||||
"padding from the left if max_len_align is true";
|
||||
|
||||
rightAlign = helpers.defaultNullOpts.mkBool false "whether to align to the extreme right or not";
|
||||
|
||||
rightAlignPadding = helpers.defaultNullOpts.mkInt 7 "padding from the right if right_align is true";
|
||||
|
||||
highlight = helpers.defaultNullOpts.mkStr "Comment" "The color of the hints";
|
||||
};
|
||||
|
||||
hoverActions = {
|
||||
border = helpers.defaultNullOpts.mkBorder [
|
||||
[
|
||||
"╭"
|
||||
"FloatBorder"
|
||||
]
|
||||
[
|
||||
"─"
|
||||
"FloatBorder"
|
||||
]
|
||||
[
|
||||
"╮"
|
||||
"FloatBorder"
|
||||
]
|
||||
[
|
||||
"│"
|
||||
"FloatBorder"
|
||||
]
|
||||
[
|
||||
"╯"
|
||||
"FloatBorder"
|
||||
]
|
||||
[
|
||||
"─"
|
||||
"FloatBorder"
|
||||
]
|
||||
[
|
||||
"╰"
|
||||
"FloatBorder"
|
||||
]
|
||||
[
|
||||
"│"
|
||||
"FloatBorder"
|
||||
]
|
||||
] "rust-tools hover window" "";
|
||||
|
||||
maxWidth = helpers.defaultNullOpts.mkUnsignedInt null "Maximal width of the hover window. null means no max.";
|
||||
|
||||
maxHeight = helpers.defaultNullOpts.mkUnsignedInt null "Maximal height of the hover window. null means no max.";
|
||||
|
||||
autoFocus = helpers.defaultNullOpts.mkBool false "whether the hover action window gets automatically focused";
|
||||
};
|
||||
|
||||
crateGraph = {
|
||||
backend = helpers.defaultNullOpts.mkStr "x11" ''
|
||||
Backend used for displaying the graph
|
||||
see: https://graphviz.org/docs/outputs/
|
||||
'';
|
||||
|
||||
output = helpers.defaultNullOpts.mkStr null "where to store the output, nil for no output stored";
|
||||
|
||||
full = helpers.defaultNullOpts.mkBool true ''
|
||||
true for all crates.io and external crates, false only the local crates
|
||||
'';
|
||||
|
||||
enabledGraphvizBackends = helpers.defaultNullOpts.mkNullable (types.listOf types.str) null ''
|
||||
List of backends found on: https://graphviz.org/docs/outputs/
|
||||
Is used for input validation and autocompletion
|
||||
'';
|
||||
};
|
||||
|
||||
server = {
|
||||
standalone = helpers.defaultNullOpts.mkBool true ''
|
||||
standalone file support
|
||||
setting it to false may improve startup time
|
||||
'';
|
||||
} // (import ../../lsp/language-servers/rust-analyzer-config.nix lib helpers);
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
nvim-lspconfig
|
||||
cfg.package
|
||||
];
|
||||
extraPackages = [ cfg.serverPackage ];
|
||||
|
||||
plugins.lsp.postConfig =
|
||||
let
|
||||
options = {
|
||||
tools = {
|
||||
executor = helpers.ifNonNull' cfg.executor (
|
||||
helpers.mkRaw "require(${rust-tools.executors}).${cfg.executor}"
|
||||
);
|
||||
|
||||
on_initialized = cfg.onInitialized;
|
||||
|
||||
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
|
||||
inlay_hints = with cfg.inlayHints; {
|
||||
inherit auto;
|
||||
only_current_line = onlyCurrentLine;
|
||||
show_parameter_hints = showParameterHints;
|
||||
parameter_hints_prefix = parameterHintsPrefix;
|
||||
other_hints_prefix = otherHintsPrefix;
|
||||
max_len_align = maxLenAlign;
|
||||
max_len_align_padding = maxLenAlignPadding;
|
||||
right_align = rightAlign;
|
||||
right_align_padding = rightAlignPadding;
|
||||
inherit highlight;
|
||||
};
|
||||
|
||||
hover_actions = with cfg.hoverActions; {
|
||||
inherit border;
|
||||
max_width = maxWidth;
|
||||
max_height = maxHeight;
|
||||
auto_focus = autoFocus;
|
||||
};
|
||||
|
||||
crate_graph = with cfg.crateGraph; {
|
||||
inherit backend output full;
|
||||
enabled_graphviz_backends = enabledGraphvizBackends;
|
||||
};
|
||||
};
|
||||
server = {
|
||||
inherit (cfg.server) standalone;
|
||||
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
|
||||
on_attach = helpers.mkRaw "__lspOnAttach";
|
||||
};
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('rust-tools').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
94
plugins/by-name/rustaceanvim/default.nix
Normal file
94
plugins/by-name/rustaceanvim/default.nix
Normal file
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "rustaceanvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO: introduced 2024-05-17, remove on 2024-02-17
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = import ./renamed-options.nix;
|
||||
|
||||
extraOptions = {
|
||||
rustAnalyzerPackage = lib.mkPackageOption pkgs "rust-analyzer" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
settingsOptions = import ./settings-options.nix { inherit lib helpers pkgs; };
|
||||
|
||||
settingsExample = {
|
||||
server = {
|
||||
standalone = false;
|
||||
cmd = [
|
||||
"rustup"
|
||||
"run"
|
||||
"nightly"
|
||||
"rust-analyzer"
|
||||
];
|
||||
default_settings = {
|
||||
rust-analyzer = {
|
||||
inlayHints = {
|
||||
lifetimeElisionHints = {
|
||||
enable = "always";
|
||||
};
|
||||
};
|
||||
check = {
|
||||
command = "clippy";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
callSetup = false;
|
||||
extraConfig =
|
||||
cfg:
|
||||
mkMerge [
|
||||
{
|
||||
extraPackages = [ cfg.rustAnalyzerPackage ];
|
||||
|
||||
globals.rustaceanvim = cfg.settings;
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.enable -> !config.plugins.lsp.servers.rust-analyzer.enable;
|
||||
message = ''
|
||||
Nixvim (plugins.rustaceanvim): Both `plugins.rustaceanvim.enable` and `plugins.lsp.servers.rust-analyzer.enable` are true.
|
||||
Disable one of them otherwise you will have multiple clients attached to each buffer.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
# TODO: remove after 24.11
|
||||
warnings =
|
||||
optional
|
||||
(hasAttrByPath [
|
||||
"settings"
|
||||
"server"
|
||||
"settings"
|
||||
] cfg)
|
||||
''
|
||||
The `plugins.rustaceanvim.settings.server.settings' option has been renamed to `plugins.rustaceanvim.settings.server.default_settings'.
|
||||
|
||||
Note that if you supplied an attrset and not a function you need to set this attr set in:
|
||||
`plugins.rustaceanvim.settings.server.default_settings.rust-analyzer'.
|
||||
'';
|
||||
}
|
||||
# If nvim-lspconfig is enabled:
|
||||
(mkIf config.plugins.lsp.enable {
|
||||
# Use the same `on_attach` callback as for the other LSP servers
|
||||
plugins.rustaceanvim.settings.server.on_attach = mkDefault ''
|
||||
function(client, bufnr)
|
||||
return _M.lspOnAttach(client, bufnr)
|
||||
end
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
92
plugins/by-name/rustaceanvim/renamed-options.nix
Normal file
92
plugins/by-name/rustaceanvim/renamed-options.nix
Normal file
|
@ -0,0 +1,92 @@
|
|||
[
|
||||
[
|
||||
"tools"
|
||||
"executor"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"testExecutors"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"crateTestExecutor"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"onInitialized"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"reloadWorkspaceFromCargoToml"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"hoverActions"
|
||||
"replaceBuiltinHover"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"floatWinConfig"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"crateGraph"
|
||||
"backend"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"crateGraph"
|
||||
"output"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"crateGraph"
|
||||
"full"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"crateGraph"
|
||||
"enabledGraphvizBackends"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"crateGraph"
|
||||
"pipe"
|
||||
]
|
||||
[
|
||||
"tools"
|
||||
"openUrl"
|
||||
]
|
||||
[
|
||||
"server"
|
||||
"autoAttach"
|
||||
]
|
||||
[
|
||||
"server"
|
||||
"onAttach"
|
||||
]
|
||||
[
|
||||
"server"
|
||||
"cmd"
|
||||
]
|
||||
[
|
||||
"server"
|
||||
"settings"
|
||||
]
|
||||
[
|
||||
"server"
|
||||
"standalone"
|
||||
]
|
||||
[
|
||||
"server"
|
||||
"logfile"
|
||||
]
|
||||
[
|
||||
"dap"
|
||||
"autoloadConfigurations"
|
||||
]
|
||||
[
|
||||
"dap"
|
||||
"adapter"
|
||||
]
|
||||
]
|
343
plugins/by-name/rustaceanvim/settings-options.nix
Normal file
343
plugins/by-name/rustaceanvim/settings-options.nix
Normal file
|
@ -0,0 +1,343 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
tools =
|
||||
let
|
||||
executors = [
|
||||
"termopen"
|
||||
"quickfix"
|
||||
"toggleterm"
|
||||
"vimux"
|
||||
"neotest"
|
||||
];
|
||||
testExecutors = executors ++ [ "background" ];
|
||||
executorSubmodule = types.submodule {
|
||||
options = {
|
||||
execute_command = helpers.mkNullOrLuaFn ''
|
||||
```lua
|
||||
fun(cmd:string,args:string[],cwd:string|nil,opts?:RustaceanExecutorOpts)
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(command, args, cwd, _)
|
||||
require('toggleterm.terminal').Terminal
|
||||
:new({
|
||||
dir = cwd,
|
||||
cmd = require('rustaceanvim.shell').make_command_from_args(command, args),
|
||||
close_on_exit = false,
|
||||
direction = 'vertical',
|
||||
})
|
||||
:toggle()
|
||||
end
|
||||
```
|
||||
```
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
executor =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either (enum executors) executorSubmodule)
|
||||
"termopen"
|
||||
''
|
||||
The executor to use for runnables/debuggables.
|
||||
Either an executor alias or an attrs with the `execute_command` key.
|
||||
'';
|
||||
|
||||
test_executor =
|
||||
helpers.mkNullOrOption (with types; either (enum testExecutors) executorSubmodule)
|
||||
''
|
||||
The executor to use for runnables that are tests/testables
|
||||
Either a test executor alias or an attrs with the `execute_command` key.
|
||||
'';
|
||||
|
||||
crate_test_executor =
|
||||
helpers.mkNullOrOption (with types; either (enum testExecutors) executorSubmodule)
|
||||
''
|
||||
The executor to use for runnables that are crate test suites (`--all-targets`).
|
||||
Either a test executor alias or an attrs with the `execute_command` key.
|
||||
'';
|
||||
|
||||
cargo_override = helpers.mkNullOrStr ''
|
||||
Set this to override the 'cargo' command for runnables, debuggables (etc., e.g. to `"cross"`).
|
||||
If set, this takes precedence over `enable_nextest`.
|
||||
'';
|
||||
|
||||
enable_nextest = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable nextest.
|
||||
If enabled, `cargo test` commands will be transformed to `cargo nextest run` commands.
|
||||
Defaults to `true` if cargo-nextest is detected.
|
||||
Ignored if `cargo_override` is set.
|
||||
'';
|
||||
|
||||
enable_clippy = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable clippy checks on save if a clippy installation is detected.
|
||||
'';
|
||||
|
||||
on_initialized = helpers.mkNullOrLuaFn ''
|
||||
`fun(health:RustAnalyzerInitializedStatus)`
|
||||
Function that is invoked when the LSP server has finished initializing.
|
||||
'';
|
||||
|
||||
reload_workspace_from_cargo_toml = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically call `RustReloadWorkspace` when writing to a `Cargo.toml` file.
|
||||
'';
|
||||
|
||||
hover_actions = {
|
||||
replace_builtin_hover = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to replace Neovim's built-in `vim.lsp.buf.hover` with hover actions.
|
||||
'';
|
||||
};
|
||||
|
||||
code_actions = {
|
||||
group_icon = helpers.defaultNullOpts.mkStr " ▶" ''
|
||||
Text appended to a group action.
|
||||
'';
|
||||
|
||||
ui_select_fallback = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to fall back to `vim.ui.select` if there are no grouped code actions.
|
||||
'';
|
||||
};
|
||||
|
||||
float_win_config = {
|
||||
auto_focus = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether the window gets automatically focused.
|
||||
'';
|
||||
|
||||
open_split =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"horizontal"
|
||||
"vertical"
|
||||
]
|
||||
''
|
||||
Whether splits opened from floating preview are vertical.
|
||||
'';
|
||||
};
|
||||
|
||||
crate_graph = {
|
||||
backend = helpers.defaultNullOpts.mkStr "x11" ''
|
||||
Backend used for displaying the graph.
|
||||
See: https://graphviz.org/docs/outputs
|
||||
'';
|
||||
|
||||
output = helpers.mkNullOrStr ''
|
||||
Where to store the output.
|
||||
No output if unset.
|
||||
Relative path from `cwd`.
|
||||
'';
|
||||
|
||||
full = helpers.defaultNullOpts.mkBool true ''
|
||||
`true` for all crates.io and external crates, false only the local crates.
|
||||
'';
|
||||
|
||||
enabled_graphviz_backends =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"bmp"
|
||||
"cgimage"
|
||||
"canon"
|
||||
"dot"
|
||||
"gv"
|
||||
"xdot"
|
||||
"xdot1.2"
|
||||
"xdot1.4"
|
||||
"eps"
|
||||
"exr"
|
||||
"fig"
|
||||
"gd"
|
||||
"gd2"
|
||||
"gif"
|
||||
"gtk"
|
||||
"ico"
|
||||
"cmap"
|
||||
"ismap"
|
||||
"imap"
|
||||
"cmapx"
|
||||
"imap_np"
|
||||
"cmapx_np"
|
||||
"jpg"
|
||||
"jpeg"
|
||||
"jpe"
|
||||
"jp2"
|
||||
"json"
|
||||
"json0"
|
||||
"dot_json"
|
||||
"xdot_json"
|
||||
"pdf"
|
||||
"pic"
|
||||
"pct"
|
||||
"pict"
|
||||
"plain"
|
||||
"plain-ext"
|
||||
"png"
|
||||
"pov"
|
||||
"ps"
|
||||
"ps2"
|
||||
"psd"
|
||||
"sgi"
|
||||
"svg"
|
||||
"svgz"
|
||||
"tga"
|
||||
"tiff"
|
||||
"tif"
|
||||
"tk"
|
||||
"vml"
|
||||
"vmlz"
|
||||
"wbmp"
|
||||
"webp"
|
||||
"xlib"
|
||||
"x11"
|
||||
]
|
||||
''
|
||||
Override the enabled graphviz backends list, used for input validation and autocompletion.
|
||||
'';
|
||||
|
||||
pipe = helpers.mkNullOrStr ''
|
||||
Override the pipe symbol in the shell command.
|
||||
Useful if using a shell that is not supported by this plugin.
|
||||
'';
|
||||
};
|
||||
|
||||
open_url = helpers.defaultNullOpts.mkLuaFn "require('rustaceanvim.os').open_url" ''
|
||||
If set, overrides how to open URLs.
|
||||
`fun(url:string):nil`
|
||||
'';
|
||||
};
|
||||
|
||||
server = {
|
||||
auto_attach = helpers.mkNullOrStrLuaFnOr types.bool ''
|
||||
Whether to automatically attach the LSP client.
|
||||
Defaults to `true` if the `rust-analyzer` executable is found.
|
||||
|
||||
This can also be the definition of a function (`fun():boolean`).
|
||||
|
||||
Plugin default:
|
||||
```lua
|
||||
function(bufnr)
|
||||
if #vim.bo[bufnr].buftype > 0 then
|
||||
return false
|
||||
end
|
||||
local path = vim.api.nvim_buf_get_name(bufnr)
|
||||
if not os.is_valid_file_path(path) then
|
||||
return false
|
||||
end
|
||||
local cmd = types.evaluate(RustaceanConfig.server.cmd)
|
||||
---@cast cmd string[]
|
||||
local rs_bin = cmd[1]
|
||||
return vim.fn.executable(rs_bin) == 1
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
on_attach = helpers.mkNullOrLuaFn ''
|
||||
Function to call on attach.
|
||||
If `plugins.lsp` is enabled, it defaults to the Nixvim global `__lspOnAttach` function.
|
||||
Otherwise it defaults to `null`.
|
||||
'';
|
||||
|
||||
cmd = helpers.mkNullOrStrLuaFnOr (with types; listOf str) ''
|
||||
Command and arguments for starting rust-analyzer.
|
||||
|
||||
This can also be the definition of a function:
|
||||
`fun(project_root:string|nil,default_settings:table):table`
|
||||
|
||||
Plugin default:
|
||||
```lua
|
||||
function()
|
||||
return { 'rust-analyzer', '--log-file', RustaceanConfig.server.logfile }
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
default_settings =
|
||||
helpers.mkNullOrStrLuaFnOr
|
||||
(types.submodule {
|
||||
options.rust-analyzer = import ../../lsp/language-servers/rust-analyzer-config.nix lib helpers;
|
||||
freeformType = with types; attrsOf anything;
|
||||
})
|
||||
''
|
||||
Setting passed to rust-analyzer.
|
||||
Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table.
|
||||
See https://rust-analyzer.github.io/manual.html#configuration.
|
||||
|
||||
This can also be the definition of a function:
|
||||
`fun(project_root:string|nil, default_settings: table|nil):table`
|
||||
|
||||
Plugin default:
|
||||
```lua
|
||||
function(project_root, default_settings)
|
||||
return require('rustaceanvim.config.server').load_rust_analyzer_settings(project_root, { default_settings = default_settings })
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
standalone = helpers.defaultNullOpts.mkBool true ''
|
||||
Standalone file support (enabled by default).
|
||||
Disabling it may improve rust-analyzer's startup time.
|
||||
'';
|
||||
|
||||
logfile = helpers.defaultNullOpts.mkStr { __raw = "vim.fn.tempname() .. '-rust-analyzer.log'"; } ''
|
||||
The path to the rust-analyzer log file.
|
||||
'';
|
||||
|
||||
load_vscode_settings = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to search (upward from the buffer) for rust-analyzer settings in `.vscode/settings` json.
|
||||
If found, loaded settings will override configured options.
|
||||
'';
|
||||
};
|
||||
|
||||
dap = {
|
||||
autoload_configurations = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to autoload nvim-dap configurations when rust-analyzer has attached.
|
||||
'';
|
||||
|
||||
adapter =
|
||||
let
|
||||
dapConfig = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
# Common options
|
||||
type = mkOption {
|
||||
type = types.enum [
|
||||
"executable"
|
||||
"server"
|
||||
];
|
||||
description = "The type for the debug adapter.";
|
||||
};
|
||||
|
||||
name = helpers.mkNullOrStr "The name of this adapter.";
|
||||
|
||||
# Executable
|
||||
command = helpers.defaultNullOpts.mkStr "lldb-vscode" ''
|
||||
The command to run for this adapter.
|
||||
'';
|
||||
|
||||
args = helpers.mkNullOrStr "Its arguments.";
|
||||
|
||||
# Server
|
||||
host = helpers.mkNullOrStr "The host to connect to.";
|
||||
|
||||
port = helpers.mkNullOrStr "The port to connect to.";
|
||||
|
||||
executable = {
|
||||
command = helpers.mkNullOrStr "The command for the executable.";
|
||||
|
||||
args = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf str)) ''
|
||||
Its arguments.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
helpers.mkNullOrStrLuaFnOr (with types; either (enum [ false ]) dapConfig) ''
|
||||
Defaults to creating the `rt_lldb` adapter, which is a `DapServerConfig` if `codelldb`
|
||||
is detected, and a `DapExecutableConfig` if `lldb` is detected.
|
||||
Set to `false` to disable.
|
||||
'';
|
||||
};
|
||||
}
|
231
plugins/by-name/sniprun/default.nix
Normal file
231
plugins/by-name/sniprun/default.nix
Normal file
|
@ -0,0 +1,231 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "sniprun";
|
||||
url = "https://github.com/michaelb/sniprun";
|
||||
|
||||
maintainers = with maintainers; [
|
||||
traxys
|
||||
MattSturgeon
|
||||
];
|
||||
|
||||
# TODO: Added 2024-06-17; remove 2024-09-17
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"selectedInterpreters"
|
||||
"replEnable"
|
||||
"replDisable"
|
||||
"interpreterOptions"
|
||||
"display"
|
||||
"liveDisplay"
|
||||
[
|
||||
"displayOptions"
|
||||
"terminalWidth"
|
||||
]
|
||||
[
|
||||
"displayOptions"
|
||||
"notificationTimeout"
|
||||
]
|
||||
"showNoOutput"
|
||||
"snipruncolors"
|
||||
"liveModeToggle"
|
||||
"borders"
|
||||
];
|
||||
|
||||
# https://michaelb.github.io/sniprun/sources/README.html#configuration
|
||||
settingsOptions = {
|
||||
selected_interpreters = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Use those instead of the default for the current filetype.
|
||||
'';
|
||||
|
||||
repl_enable = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Enable REPL-like behavior for the given interpreters.
|
||||
'';
|
||||
|
||||
repl_disable = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Disable REPL-like behavior for the given interpreters.
|
||||
'';
|
||||
|
||||
interpreter_options = helpers.defaultNullOpts.mkAttrsOf' {
|
||||
type = types.anything;
|
||||
pluginDefault = { };
|
||||
description = ''
|
||||
Interpreter-specific options, see doc / `:SnipInfo <name>`.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
# use the interpreter name as key
|
||||
GFM_original = {
|
||||
# the 'use_on_filetypes' configuration key is
|
||||
# available for every interpreter
|
||||
use_on_filetypes = [ "markdown.pandoc" ];
|
||||
};
|
||||
Python3_original = {
|
||||
# Truncate runtime errors 'long', 'short' or 'auto'
|
||||
# the hint is available for every interpreter
|
||||
# but may not be always respected
|
||||
error_truncate = "auto";
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
display = helpers.defaultNullOpts.mkListOf' {
|
||||
type = types.str;
|
||||
pluginDefault = [
|
||||
"Classic"
|
||||
"VirtualTextOk"
|
||||
];
|
||||
description = ''
|
||||
You can combo different display modes as desired and with the 'Ok' or 'Err' suffix to filter
|
||||
only successful runs (or errored-out runs respectively)
|
||||
'';
|
||||
example = literalExpression ''
|
||||
[
|
||||
"Classic" # display results in the command-line area
|
||||
"VirtualTextOk" # display ok results as virtual text (multiline is shortened)
|
||||
|
||||
# "VirtualText" # display results as virtual text
|
||||
# "TempFloatingWindow" # display results in a floating window
|
||||
# "LongTempFloatingWindow" # same as above, but only long results. To use with VirtualText[Ok/Err]
|
||||
# "Terminal" # display results in a vertical split
|
||||
# "TerminalWithCode" # display results and code history in a vertical split
|
||||
# "NvimNotify" # display with the nvim-notify plugin
|
||||
# "Api" # return output to a programming interface
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
live_display = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"VirtualTextOk"
|
||||
] "Display modes used in `live_mode`.";
|
||||
|
||||
display_options = {
|
||||
terminal_scrollback = helpers.defaultNullOpts.mkUnsignedInt { __raw = "vim.o.scrollback"; } ''
|
||||
Change terminal display scrollback lines.
|
||||
'';
|
||||
|
||||
terminal_line_number = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether show line number in terminal window.
|
||||
'';
|
||||
|
||||
terminal_signcolumn = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether show signcolumn in terminal window.
|
||||
'';
|
||||
|
||||
terminal_position = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"vertical"
|
||||
"horizontal"
|
||||
] "Terminal split position.";
|
||||
|
||||
terminal_width = helpers.defaultNullOpts.mkUnsignedInt 45 ''
|
||||
Change the terminal display option width (if vertical).
|
||||
'';
|
||||
|
||||
terminal_height = helpers.defaultNullOpts.mkUnsignedInt 20 ''
|
||||
Change the terminal display option height (if horizontal).
|
||||
'';
|
||||
|
||||
notification_timeout = helpers.defaultNullOpts.mkUnsignedInt 5 ''
|
||||
Timeout for nvim_notify output.
|
||||
'';
|
||||
};
|
||||
|
||||
show_no_output =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"Classic"
|
||||
"TempFloatingWindow"
|
||||
]
|
||||
''
|
||||
You can use the same keys to customize whether a sniprun producing
|
||||
no output should display nothing or '(no output)'.
|
||||
|
||||
`"TempFloatingWindow"` implies `"LongTempFloatingWindow"`, which has no effect on its own.
|
||||
'';
|
||||
|
||||
snipruncolors =
|
||||
let
|
||||
colorOption =
|
||||
{
|
||||
fg ? "",
|
||||
bg ? "",
|
||||
ctermbg ? "",
|
||||
ctermfg ? "",
|
||||
}:
|
||||
{
|
||||
bg = helpers.defaultNullOpts.mkStr fg "Background color";
|
||||
fg = helpers.defaultNullOpts.mkStr bg "Foreground color";
|
||||
ctermbg = helpers.defaultNullOpts.mkStr ctermbg "Foreground color";
|
||||
ctermfg = helpers.defaultNullOpts.mkStr ctermfg "Foreground color";
|
||||
};
|
||||
in
|
||||
helpers.defaultNullOpts.mkNullable' {
|
||||
description = ''
|
||||
Customize highlight groups (setting this overrides colorscheme)
|
||||
any parameters of `nvim_set_hl()` can be passed as-is.
|
||||
'';
|
||||
type = types.submodule {
|
||||
freeformType = types.attrsOf types.anything;
|
||||
options = mapAttrs (optionName: colorOption) {
|
||||
SniprunVirtualTextOk = {
|
||||
bg = "#66eeff";
|
||||
fg = "#000000";
|
||||
ctermbg = "Cyan";
|
||||
ctermfg = "Black";
|
||||
};
|
||||
SniprunFloatingWinOk = {
|
||||
fg = "#66eeff";
|
||||
ctermfg = "Cyan";
|
||||
};
|
||||
SniprunVirtualTextErr = {
|
||||
bg = "#881515";
|
||||
fg = "#000000";
|
||||
ctermbg = "DarkRed";
|
||||
ctermfg = "Black";
|
||||
};
|
||||
SniprunFloatingWinErr = {
|
||||
fg = "#881515";
|
||||
ctermfg = "DarkRed";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
live_mode_toggle = helpers.defaultNullOpts.mkStr "off" ''
|
||||
Live mode toggle, see [Usage - Running] for more info.
|
||||
|
||||
[Usage - Running]: https://michaelb.github.io/sniprun/sources/README.html#running
|
||||
'';
|
||||
|
||||
inline_messages = helpers.defaultNullOpts.mkBool false ''
|
||||
Boolean toggle for a one-line way to display messages
|
||||
to workaround sniprun not being able to display anything.
|
||||
'';
|
||||
|
||||
borders = helpers.defaultNullOpts.mkEnum [
|
||||
"none"
|
||||
"single"
|
||||
"double"
|
||||
"shadow"
|
||||
] "single" "Display borders around floating windows.";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
display = [ "NvimNotify" ];
|
||||
inline_messages = true;
|
||||
interpreter_options = {
|
||||
"<Interpreter_name>" = {
|
||||
some_specific_option = "value";
|
||||
some_other_option = "other_value";
|
||||
};
|
||||
C_original.compiler = "clang";
|
||||
GFM_original.use_on_filetypes = [ "markdown.pandoc" ];
|
||||
Python3_original.error_truncate = "auto";
|
||||
};
|
||||
};
|
||||
}
|
33
plugins/by-name/tagbar/default.nix
Normal file
33
plugins/by-name/tagbar/default.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
helpers,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "tagbar";
|
||||
globalPrefix = "tagbar_";
|
||||
extraPackages = [ pkgs.ctags ];
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-02-12: remove 2024-04-12
|
||||
deprecateExtraConfig = true;
|
||||
|
||||
settingsExample = {
|
||||
position = "right";
|
||||
autoclose = false;
|
||||
autofocus = false;
|
||||
foldlevel = 2;
|
||||
autoshowtag = true;
|
||||
iconchars = [
|
||||
""
|
||||
""
|
||||
];
|
||||
visibility_symbols = {
|
||||
public = " ";
|
||||
protected = " ";
|
||||
private = " ";
|
||||
};
|
||||
};
|
||||
}
|
24
plugins/by-name/texpresso/default.nix
Normal file
24
plugins/by-name/texpresso/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
# This plugin has no configuration, so we use `mkVimPlugin` without the `globalPrefix` argument to
|
||||
# avoid the creation of the `settings` option.
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "texpresso";
|
||||
originalName = "texpresso.vim";
|
||||
package = "texpresso-vim";
|
||||
|
||||
maintainers = [ maintainers.nickhu ];
|
||||
|
||||
extraOptions = {
|
||||
texpressoPackage = lib.mkPackageOption pkgs "texpresso" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: { extraPackages = [ cfg.texpressoPackage ]; };
|
||||
}
|
199
plugins/by-name/typescript-tools/default.nix
Normal file
199
plugins/by-name/typescript-tools/default.nix
Normal file
|
@ -0,0 +1,199 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.typescript-tools;
|
||||
in
|
||||
{
|
||||
options.plugins.typescript-tools = {
|
||||
enable = mkEnableOption "typescript-tools";
|
||||
package = lib.mkPackageOption pkgs "typescript-tools" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"typescript-tools-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
onAttach = helpers.defaultNullOpts.mkLuaFn "__lspOnAttach" "Lua code to run when tsserver attaches to a buffer.";
|
||||
handlers = mkOption {
|
||||
type = with helpers.nixvimTypes; nullOr (attrsOf strLuaFn);
|
||||
apply = v: helpers.ifNonNull' v (mapAttrs (_: helpers.mkRaw) v);
|
||||
default = null;
|
||||
description = "How tsserver should respond to LSP requests";
|
||||
example = {
|
||||
"textDocument/publishDiagnostics" = ''
|
||||
require("typescript-tools.api").filter_diagnostics(
|
||||
-- Ignore 'This may be converted to an async function' diagnostics.
|
||||
{ 80006 }
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settings = {
|
||||
separateDiagnosticServer = helpers.defaultNullOpts.mkBool true "Spawns an additional tsserver instance to calculate diagnostics";
|
||||
|
||||
publishDiagnosticOn =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"change"
|
||||
"insert_leave"
|
||||
]
|
||||
"insert_leave"
|
||||
''
|
||||
Either "change" or "insert_leave". Determines when the client asks the server about diagnostics
|
||||
'';
|
||||
|
||||
exposeAsCodeAction = mkOption {
|
||||
type =
|
||||
with types;
|
||||
either (enum [ "all" ]) (
|
||||
listOf (enum [
|
||||
"fix_all"
|
||||
"add_missing_imports"
|
||||
"remove_unused"
|
||||
"remove_unused_imports"
|
||||
"organize_imports"
|
||||
"insert_leave"
|
||||
])
|
||||
);
|
||||
default = [ ];
|
||||
description = "Specify what to expose as code actions.";
|
||||
};
|
||||
|
||||
tsserverPath = helpers.mkNullOrStr ''
|
||||
Specify a custom path to `tsserver.js` file, if this is nil or file under path
|
||||
doesn't exist then standard path resolution strategy is applied
|
||||
'';
|
||||
|
||||
tsserverPlugins =
|
||||
with helpers.nixvimTypes;
|
||||
helpers.mkNullOrOption (listOf (maybeRaw str)) ''
|
||||
List of plugins for tsserver to load. See this plugins's README
|
||||
at https://github.com/pmizio/typescript-tools.nvim/#-styled-components-support
|
||||
'';
|
||||
|
||||
tsserverMaxMemory =
|
||||
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (either ints.unsigned (enum [ "auto" ])))
|
||||
''
|
||||
This value is passed to: https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
|
||||
Memory limit in megabytes or "auto"(basically no limit)
|
||||
'';
|
||||
|
||||
tsserverFormatOptions = mkOption {
|
||||
type = with types; nullOr (attrsOf anything);
|
||||
default = null;
|
||||
description = "Configuration options that well be passed to the tsserver instance. Find available options [here](https://github.com/microsoft/TypeScript/blob/v5.0.4/src/server/protocol.ts#L3418)";
|
||||
example = {
|
||||
"tsserver_file_preferences" = ''
|
||||
{
|
||||
includeInlayParameterNameHints = "all",
|
||||
includeCompletionsForModuleExports = true,
|
||||
quotePreference = "auto",
|
||||
...
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
tsserverFilePreferences = mkOption {
|
||||
type = with types; nullOr (attrsOf anything);
|
||||
default = null;
|
||||
description = "Configuration options that well be passed to the tsserver instance. Find available options [here](https://github.com/microsoft/TypeScript/blob/v5.0.4/src/server/protocol.ts#L3439)";
|
||||
example = {
|
||||
"tsserver_format_options" = ''
|
||||
{
|
||||
allowIncompleteCompletions = false,
|
||||
allowRenameOfImportPath = false,
|
||||
...
|
||||
}'';
|
||||
};
|
||||
};
|
||||
|
||||
tsserverLocale = helpers.defaultNullOpts.mkStr "en" ''
|
||||
Locale of all tsserver messages. Supported locales here: https://github.com/microsoft/TypeScript/blob/3c221fc086be52b19801f6e8d82596d04607ede6/src/compiler/utilitiesPublic.ts#L620
|
||||
'';
|
||||
|
||||
completeFunctionCalls = helpers.defaultNullOpts.mkBool false ''
|
||||
Mirror of VSCode's `typescript.suggest.completeFunctionCalls`
|
||||
'';
|
||||
|
||||
includeCompletionsWithInsertText = helpers.defaultNullOpts.mkBool true ''
|
||||
Mirror of VSCode's `typescript.suggest.completeFunctionCalls`
|
||||
'';
|
||||
|
||||
codeLens =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"off"
|
||||
"all"
|
||||
"implementations_only"
|
||||
"references_only"
|
||||
]
|
||||
"off"
|
||||
"WARNING: Experimental feature also in VSCode, disabled by default because it might impact server performance.";
|
||||
|
||||
disableMemberCodeLens = helpers.defaultNullOpts.mkBool true ''
|
||||
By default code lenses are displayed on all referenceable values. Display less by removing member references from lenses.
|
||||
'';
|
||||
|
||||
jsxCloseTag = {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
Functions similarly to `nvim-ts-autotag`. This is disabled by default to avoid conflicts.
|
||||
'';
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"javascriptreact"
|
||||
"typescriptreact"
|
||||
]
|
||||
''
|
||||
Filetypes this should apply to.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
plenary-nvim
|
||||
nvim-lspconfig
|
||||
];
|
||||
|
||||
plugins.lsp.postConfig =
|
||||
with cfg;
|
||||
let
|
||||
options = {
|
||||
inherit handlers;
|
||||
on_attach = onAttach;
|
||||
|
||||
settings = with settings; {
|
||||
separate_diagnostic_server = separateDiagnosticServer;
|
||||
publish_diagnostic_on = publishDiagnosticOn;
|
||||
expose_as_code_action = exposeAsCodeAction;
|
||||
tsserver_path = tsserverPath;
|
||||
tsserver_plugins = tsserverPlugins;
|
||||
tsserver_max_memory = tsserverMaxMemory;
|
||||
tsserver_format_options = tsserverFormatOptions;
|
||||
tsserver_file_preferences = tsserverFilePreferences;
|
||||
tsserver_locale = tsserverLocale;
|
||||
complete_function_calls = completeFunctionCalls;
|
||||
include_completions_with_insert_text = includeCompletionsWithInsertText;
|
||||
code_lens = codeLens;
|
||||
disable_member_code_lens = disableMemberCodeLens;
|
||||
jsx_close_tag = with jsxCloseTag; {
|
||||
inherit enable filetypes;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
''
|
||||
require('typescript-tools').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
81
plugins/by-name/typst-vim/default.nix
Normal file
81
plugins/by-name/typst-vim/default.nix
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "typst-vim";
|
||||
originalName = "typst.vim";
|
||||
globalPrefix = "typst_";
|
||||
|
||||
# Add the typst compiler to nixvim packages
|
||||
extraPackages = [ pkgs.typst ];
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-02-20: remove 2024-04-20
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"cmd"
|
||||
"pdfViewer"
|
||||
"concealMath"
|
||||
"autoCloseToc"
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
keymaps = {
|
||||
silent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether typst-vim keymaps should be silent.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
watch = helpers.mkNullOrOption types.str "Keymap to preview the document and recompile on change.";
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
keymaps =
|
||||
with cfg.keymaps;
|
||||
helpers.keymaps.mkKeymaps
|
||||
{
|
||||
mode = "n";
|
||||
options.silent = silent;
|
||||
}
|
||||
(
|
||||
optional (watch != null) {
|
||||
# mode = "n";
|
||||
key = watch;
|
||||
action = ":TypstWatch<CR>";
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
settingsOptions = {
|
||||
cmd = helpers.defaultNullOpts.mkStr "typst" ''
|
||||
Specifies the location of the Typst executable.
|
||||
'';
|
||||
|
||||
pdf_viewer = helpers.mkNullOrOption types.str ''
|
||||
Specifies pdf viewer that `typst watch --open` will use.
|
||||
'';
|
||||
|
||||
conceal_math = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Enable concealment for math symbols in math mode (i.e. replaces symbols with their actual
|
||||
unicode character).
|
||||
Warning: this can affect performance
|
||||
'';
|
||||
|
||||
auto_close_toc = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Specifies whether TOC will be automatically closed after using it.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
cmd = "typst";
|
||||
conceal_math = 1;
|
||||
auto_close_toc = 1;
|
||||
};
|
||||
}
|
105
plugins/by-name/vim-slime/default.nix
Normal file
105
plugins/by-name/vim-slime/default.nix
Normal file
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "vim-slime";
|
||||
globalPrefix = "slime_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"target"
|
||||
"vimterminalCmd"
|
||||
"noMappings"
|
||||
"pasteFile"
|
||||
"preserveCurpos"
|
||||
"defaultConfig"
|
||||
"dontAskDefault"
|
||||
"bracketedPaste"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
target = helpers.defaultNullOpts.mkEnum [
|
||||
"dtach"
|
||||
"kitty"
|
||||
"neovim"
|
||||
"screen"
|
||||
"tmux"
|
||||
"vimterminal"
|
||||
"wezterm"
|
||||
"whimrepl"
|
||||
"x11"
|
||||
"zellij"
|
||||
] "screen" "Which backend vim-slime should use.";
|
||||
|
||||
vimterminal_cmd = helpers.mkNullOrStr ''
|
||||
The vim terminal command to execute.
|
||||
'';
|
||||
|
||||
no_mappings = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Whether to disable the default mappings.
|
||||
'';
|
||||
|
||||
paste_file = helpers.defaultNullOpts.mkStr "$HOME/.slime_paste" ''
|
||||
Required to transfer data from vim to GNU screen or tmux.
|
||||
Setting this explicitly can work around some occasional portability issues.
|
||||
whimrepl does not require or support this setting.
|
||||
'';
|
||||
|
||||
preserve_curpos = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Whether to preserve cursor position when sending a line or paragraph.
|
||||
'';
|
||||
|
||||
default_config = helpers.mkNullOrOption (with helpers.nixvimTypes; attrsOf (either str rawLua)) ''
|
||||
Pre-filled prompt answer.
|
||||
|
||||
Examples:
|
||||
- `tmux`:
|
||||
```nix
|
||||
{
|
||||
socket_name = "default";
|
||||
target_pane = "{last}";
|
||||
}
|
||||
```
|
||||
- `zellij`:
|
||||
```nix
|
||||
{
|
||||
session_id = "current";
|
||||
relative_pane = "right";
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
dont_ask_default = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Whether to bypass the prompt and use the specified default configuration options.
|
||||
'';
|
||||
|
||||
bracketed_paste = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Sometimes REPL are too smart for their own good, e.g. autocompleting a bracket that should
|
||||
not be autocompleted when pasting code from a file.
|
||||
In this case it can be useful to rely on bracketed-paste
|
||||
(https://cirw.in/blog/bracketed-paste).
|
||||
Luckily, tmux knows how to handle that. See tmux's manual.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
target = "screen";
|
||||
vimterminal_cmd = null;
|
||||
no_mappings = 0;
|
||||
paste_file = "$HOME/.slime_paste";
|
||||
preserve_curpos = 1;
|
||||
default_config = {
|
||||
socket_name = "default";
|
||||
target_pane = "{last}";
|
||||
};
|
||||
dont_ask_default = 0;
|
||||
bracketed_paste = 0;
|
||||
};
|
||||
}
|
88
plugins/by-name/vimtex/default.nix
Normal file
88
plugins/by-name/vimtex/default.nix
Normal file
|
@ -0,0 +1,88 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "vimtex";
|
||||
globalPrefix = "vimtex_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
extraPackages = [ pkgs.pstree ];
|
||||
|
||||
# TODO introduced 2024-02-20: remove 2024-04-20
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [ "viewMethod" ];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"vimtex"
|
||||
];
|
||||
in
|
||||
[
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPath ++ [ "installTexLive" ]
|
||||
) "If you don't want `texlive` to be installed, set `plugins.vimtex.texlivePackage` to `null`.")
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "texLivePackage" ]) (
|
||||
basePluginPath ++ [ "texlivePackage" ]
|
||||
))
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
view_method = mkOption {
|
||||
type = types.str;
|
||||
default = "general";
|
||||
example = "zathura";
|
||||
description = ''
|
||||
Set the viewer method.
|
||||
By default, a generic viewer is used through the general view method (e.g. `xdg-open` on Linux).
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
view_method = "zathura";
|
||||
compiler_method = "latexrun";
|
||||
toc_config = {
|
||||
split_pos = "vert topleft";
|
||||
split_width = 40;
|
||||
};
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
texlivePackage = lib.mkPackageOption pkgs "texlive" {
|
||||
nullable = true;
|
||||
default = [
|
||||
"texlive"
|
||||
"combined"
|
||||
"scheme-medium"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
plugins.vimtex.settings = {
|
||||
enabled = true;
|
||||
callback_progpath = "nvim";
|
||||
};
|
||||
|
||||
extraPackages =
|
||||
let
|
||||
# xdotool does not exist on darwin
|
||||
xdotool = optional pkgs.stdenv.isLinux pkgs.xdotool;
|
||||
viewerPackages =
|
||||
{
|
||||
general = xdotool;
|
||||
zathura = xdotool ++ [ pkgs.zathura ];
|
||||
zathura_simple = [ pkgs.zathura ];
|
||||
mupdf = xdotool ++ [ pkgs.mupdf ];
|
||||
}
|
||||
.${cfg.settings.view_method} or [ ];
|
||||
in
|
||||
[ cfg.texlivePackage ] ++ viewerPackages;
|
||||
};
|
||||
}
|
44
plugins/by-name/zig/default.nix
Normal file
44
plugins/by-name/zig/default.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "zig";
|
||||
originalName = "zig.vim";
|
||||
package = "zig-vim";
|
||||
globalPrefix = "zig_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"zig"
|
||||
"formatOnSave"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"zig"
|
||||
"settings"
|
||||
"fmt_autosave"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
fmt_autosave = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
This plugin enables automatic code formatting on save by default using zig fmt.
|
||||
To disable it, you can set this option to `0`.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
fmt_autosave = 0;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue