mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-23 05:40:44 +00:00
Merge pull request #238 from horriblename/setupopts
treewide: custom plugin setup options
This commit is contained in:
commit
e1835f6c46
50 changed files with 2222 additions and 2446 deletions
|
@ -210,7 +210,7 @@ inputs: let
|
||||||
};
|
};
|
||||||
smartcolumn = {
|
smartcolumn = {
|
||||||
enable = true;
|
enable = true;
|
||||||
columnAt.languages = {
|
setupOpts.custom_colorcolumn = {
|
||||||
# this is a freeform module, it's `buftype = int;` for configuring column position
|
# this is a freeform module, it's `buftype = int;` for configuring column position
|
||||||
nix = 110;
|
nix = 110;
|
||||||
ruby = 120;
|
ruby = 120;
|
||||||
|
|
|
@ -31,3 +31,95 @@ You can now reference this plugin using its string name:
|
||||||
```nix
|
```nix
|
||||||
config.vim.startPlugins = ["neodev-nvim"];
|
config.vim.startPlugins = ["neodev-nvim"];
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Modular setup options {#sec-modular-setup-options}
|
||||||
|
|
||||||
|
Most plugins is initialized with a call to `require('plugin').setup({...})`.
|
||||||
|
|
||||||
|
We use a special function that lets you easily add support for such setup options in a modular way:
|
||||||
|
`mkPluginSetupOption`.
|
||||||
|
|
||||||
|
Once you have added the source of the plugin as shown above, you can define the setup options like
|
||||||
|
this:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# in modules/.../your-plugin/your-plugin.nix
|
||||||
|
|
||||||
|
{lib, ...}:
|
||||||
|
let
|
||||||
|
inherit (lib.types) bool int;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.your-plugin = {
|
||||||
|
setupOpts = mkPluginSetupOption "plugin name" {
|
||||||
|
enable_feature_a = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
# ...
|
||||||
|
};
|
||||||
|
|
||||||
|
number_option = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 3;
|
||||||
|
# ...
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# in modules/.../your-plugin/config.nix
|
||||||
|
{lib, config, ...}:
|
||||||
|
let
|
||||||
|
cfg = config.vim.your-plugin;
|
||||||
|
in {
|
||||||
|
vim.luaConfigRC = lib.nvim.dag.entryAnywhere ''
|
||||||
|
require('plugin-name').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts})
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This above config will result in this lua script:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
require('plugin-name').setup({
|
||||||
|
enable_feature_a = false,
|
||||||
|
number_option = 3,
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Now users can set any of the pre-defined option field, and can also add their own fields!
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# in user's config
|
||||||
|
{
|
||||||
|
vim.your-plugin.setupOpts = {
|
||||||
|
enable_feature_a = true;
|
||||||
|
number_option = 4;
|
||||||
|
another_field = "hello";
|
||||||
|
size = { # nested fields work as well
|
||||||
|
top = 10;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Details of toLuaObject {#sec-details-of-toluaobject}
|
||||||
|
|
||||||
|
As you've seen above, `toLuaObject` is used to convert our nix attrSet `cfg.setupOpts`, into a lua
|
||||||
|
table. Here are some rules of the conversion:
|
||||||
|
|
||||||
|
1. nix `null` converts to lua `nil`
|
||||||
|
2. number and strings convert to their lua counterparts
|
||||||
|
3. nix attrSet/list converts into lua tables
|
||||||
|
4. you can write raw lua code using `lib.generators.mkLuaInline`. This function is part of nixpkgs.
|
||||||
|
```nix
|
||||||
|
vim.your-plugin.setupOpts = {
|
||||||
|
on_init = lib.generators.mkLuaInline ''
|
||||||
|
function()
|
||||||
|
print('we can write lua!')
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
@ -12,6 +12,10 @@ Release notes for release 0.6
|
||||||
|
|
||||||
- Fixed empty winbar when breadcrumbs are disabled
|
- Fixed empty winbar when breadcrumbs are disabled
|
||||||
|
|
||||||
|
- Added custom setupOpts for various plugins
|
||||||
|
|
||||||
|
- Removed support for deprecated plugin "nvim-compe"
|
||||||
|
|
||||||
[donnerinoern](https://github.com/donnerinoern):
|
[donnerinoern](https://github.com/donnerinoern):
|
||||||
|
|
||||||
- Added Gruvbox theme
|
- Added Gruvbox theme
|
||||||
|
|
17
flake.lock
17
flake.lock
|
@ -1092,22 +1092,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nvim-compe": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1633188506,
|
|
||||||
"narHash": "sha256-Y2oqvsuAKM3qjmmtJVD9z34682eCRF25kPL+rxhhg7I=",
|
|
||||||
"owner": "hrsh7th",
|
|
||||||
"repo": "nvim-compe",
|
|
||||||
"rev": "d186d739c54823e0b010feb205c6f97792322c08",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hrsh7th",
|
|
||||||
"repo": "nvim-compe",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nvim-cursorline": {
|
"nvim-cursorline": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1574,7 +1558,6 @@
|
||||||
"nvim-cmp": "nvim-cmp",
|
"nvim-cmp": "nvim-cmp",
|
||||||
"nvim-code-action-menu": "nvim-code-action-menu",
|
"nvim-code-action-menu": "nvim-code-action-menu",
|
||||||
"nvim-colorizer-lua": "nvim-colorizer-lua",
|
"nvim-colorizer-lua": "nvim-colorizer-lua",
|
||||||
"nvim-compe": "nvim-compe",
|
|
||||||
"nvim-cursorline": "nvim-cursorline",
|
"nvim-cursorline": "nvim-cursorline",
|
||||||
"nvim-dap": "nvim-dap",
|
"nvim-dap": "nvim-dap",
|
||||||
"nvim-dap-ui": "nvim-dap-ui",
|
"nvim-dap-ui": "nvim-dap-ui",
|
||||||
|
|
|
@ -228,12 +228,6 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Autocompletes
|
|
||||||
nvim-compe = {
|
|
||||||
url = "github:hrsh7th/nvim-compe";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
nvim-cmp = {
|
nvim-cmp = {
|
||||||
url = "github:hrsh7th/nvim-cmp";
|
url = "github:hrsh7th/nvim-cmp";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
|
|
@ -48,11 +48,13 @@ in rec {
|
||||||
# Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first
|
# Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first
|
||||||
luaTable = items: ''{${concatStringsSep "," items}}'';
|
luaTable = items: ''{${concatStringsSep "," items}}'';
|
||||||
|
|
||||||
|
isLuaInline = {_type ? null, ...}: _type == "lua-inline";
|
||||||
|
|
||||||
toLuaObject = args:
|
toLuaObject = args:
|
||||||
if isAttrs args
|
if isAttrs args
|
||||||
then
|
then
|
||||||
if hasAttr "__raw" args
|
if isLuaInline args
|
||||||
then args.__raw
|
then args.expr
|
||||||
else if hasAttr "__empty" args
|
else if hasAttr "__empty" args
|
||||||
then "{ }"
|
then "{ }"
|
||||||
else
|
else
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
typesLanguage = import ./languages.nix {inherit lib;};
|
typesLanguage = import ./languages.nix {inherit lib;};
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ with lib; let
|
||||||
"nvim-tree-lua"
|
"nvim-tree-lua"
|
||||||
"nvim-bufferline-lua"
|
"nvim-bufferline-lua"
|
||||||
"lualine"
|
"lualine"
|
||||||
"nvim-compe"
|
|
||||||
"nvim-autopairs"
|
"nvim-autopairs"
|
||||||
"nvim-ts-autotag"
|
"nvim-ts-autotag"
|
||||||
"nvim-web-devicons"
|
"nvim-web-devicons"
|
||||||
|
@ -145,6 +144,18 @@ in {
|
||||||
type = pluginsType;
|
type = pluginsType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
luaInline = lib.mkOptionType {
|
||||||
|
name = "luaInline";
|
||||||
|
check = x: lib.nvim.lua.isLuaInline x || builtins.isString x;
|
||||||
|
merge = loc: defs: let
|
||||||
|
val =
|
||||||
|
if isString loc
|
||||||
|
then lib.generators.mkLuaInline loc
|
||||||
|
else loc;
|
||||||
|
in
|
||||||
|
lib.mergeOneOption val defs;
|
||||||
|
};
|
||||||
|
|
||||||
# opts is a attrset of options, example:
|
# opts is a attrset of options, example:
|
||||||
# ```
|
# ```
|
||||||
# mkPluginSetupOption "telescope" {
|
# mkPluginSetupOption "telescope" {
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toJSON;
|
inherit (builtins) toJSON;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.lists) optionals;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.nvim.binds) mkLuaBinding;
|
inherit (lib.nvim.binds) mkLuaBinding;
|
||||||
|
|
||||||
cfg = config.vim.assistant.copilot;
|
cfg = config.vim.assistant.copilot;
|
||||||
|
@ -28,55 +28,47 @@ in {
|
||||||
vim.startPlugins =
|
vim.startPlugins =
|
||||||
[
|
[
|
||||||
"copilot-lua"
|
"copilot-lua"
|
||||||
cfg.copilotNodePackage
|
# cfg.copilotNodePackage
|
||||||
]
|
]
|
||||||
++ optionals (cfg.cmp.enable) [
|
++ optionals (cfg.cmp.enable) [
|
||||||
"copilot-cmp"
|
"copilot-cmp"
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.copilot = entryAnywhere ''
|
vim.luaConfigRC.copilot = entryAnywhere ''
|
||||||
require("copilot").setup({
|
require("copilot").setup(${toLuaObject cfg.setupOpts})
|
||||||
-- available options: https://github.com/zbirenbaum/copilot.lua
|
|
||||||
copilot_node_command = "${cfg.copilotNodeCommand}",
|
|
||||||
panel = {
|
|
||||||
enabled = ${boolToString (!cfg.cmp.enable)},
|
|
||||||
keymap = {
|
|
||||||
jump_prev = false,
|
|
||||||
jump_next = false,
|
|
||||||
accept = false,
|
|
||||||
refresh = false,
|
|
||||||
open = false,
|
|
||||||
},
|
|
||||||
layout = {
|
|
||||||
position = "${cfg.panel.position}",
|
|
||||||
ratio = ${toString cfg.panel.ratio},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
suggestion = {
|
|
||||||
enabled = ${boolToString (!cfg.cmp.enable)},
|
|
||||||
keymap = {
|
|
||||||
accept = false,
|
|
||||||
accept_word = false,
|
|
||||||
accept_line = false,
|
|
||||||
next = false,
|
|
||||||
prev = false,
|
|
||||||
dismiss = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
${lib.optionalString (cfg.cmp.enable) ''
|
${lib.optionalString (cfg.cmp.enable) ''
|
||||||
require("copilot_cmp").setup()
|
require("copilot_cmp").setup()
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Disable plugin handled keymaps.
|
||||||
|
# Setting it here so that it doesn't show up in user docs
|
||||||
|
vim.assistant.copilot.setupOpts = {
|
||||||
|
panel.keymap = {
|
||||||
|
jump_prev = lib.mkDefault false;
|
||||||
|
jump_next = lib.mkDefault false;
|
||||||
|
accept = lib.mkDefault false;
|
||||||
|
refresh = lib.mkDefault false;
|
||||||
|
open = lib.mkDefault false;
|
||||||
|
};
|
||||||
|
suggestion.keymap = {
|
||||||
|
accept = lib.mkDefault false;
|
||||||
|
accept_word = lib.mkDefault false;
|
||||||
|
accept_line = lib.mkDefault false;
|
||||||
|
next = lib.mkDefault false;
|
||||||
|
prev = lib.mkDefault false;
|
||||||
|
dismiss = lib.mkDefault false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
vim.maps.normal = mkMerge [
|
||||||
(mkLuaBinding cfg.mappings.panel.jumpPrev (wrapPanelBinding "require(\"copilot.panel\").jump_prev" cfg.mappings.panel.jumpPrev) "[copilot] Accept suggestion")
|
(mkLuaBinding cfg.mappings.panel.jumpPrev (wrapPanelBinding "require(\"copilot.panel\").jump_prev" cfg.mappings.panel.jumpPrev) "[copilot] Accept suggestion")
|
||||||
(mkLuaBinding cfg.mappings.panel.jumpNext (wrapPanelBinding "require(\"copilot.panel\").jump_next" cfg.mappings.panel.jumpNext) "[copilot] Accept suggestion")
|
(mkLuaBinding cfg.mappings.panel.jumpNext (wrapPanelBinding "require(\"copilot.panel\").jump_next" cfg.mappings.panel.jumpNext) "[copilot] Accept suggestion")
|
||||||
(mkLuaBinding cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion")
|
(mkLuaBinding cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion")
|
||||||
(mkLuaBinding cfg.mappings.panel.refresh (wrapPanelBinding "require(\"copilot.panel\").refresh" cfg.mappings.panel.refresh) "[copilot] Accept suggestion")
|
(mkLuaBinding cfg.mappings.panel.refresh (wrapPanelBinding "require(\"copilot.panel\").refresh" cfg.mappings.panel.refresh) "[copilot] Accept suggestion")
|
||||||
(mkLuaBinding cfg.mappings.panel.open (wrapPanelBinding ''
|
(mkLuaBinding cfg.mappings.panel.open (wrapPanelBinding ''
|
||||||
function() require("copilot.panel").open({ position = "${cfg.panel.position}", ratio = ${toString cfg.panel.ratio}, }) end
|
function() require("copilot.panel").open({ position = "${cfg.setupOpts.panel.layout.position}", ratio = ${toString cfg.setupOpts.panel.layout.ratio}, }) end
|
||||||
''
|
''
|
||||||
cfg.mappings.panel.open) "[copilot] Accept suggestion")
|
cfg.mappings.panel.open) "[copilot] Accept suggestion")
|
||||||
];
|
];
|
||||||
|
|
|
@ -4,17 +4,35 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib) mkRenamedOptionModule;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) enum float nullOr str package;
|
inherit (lib.types) nullOr str enum float;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
|
||||||
cfg = config.vim.assistant.copilot;
|
cfg = config.vim.assistant.copilot;
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRenamedOptionModule ["vim" "assistant" "copilot" "panel"] ["vim" "assistant" "copilot" "setupOpts" "panel"])
|
||||||
|
(mkRenamedOptionModule ["vim" "assistant" "copilot" "copilotNodeCommand"] ["vim" "assistant" "copilot" "setupOpts" "copilot_node_command"])
|
||||||
|
(mkRenamedOptionModule ["vim" "assistant" "copilot" "copilotNodePackage"] ["vim" "assistant" "copilot" "setupOpts" "copilot_node_command"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.assistant.copilot = {
|
options.vim.assistant.copilot = {
|
||||||
enable = mkEnableOption "GitHub Copilot AI assistant";
|
enable = mkEnableOption "GitHub Copilot AI assistant";
|
||||||
cmp.enable = mkEnableOption "nvim-cmp integration for GitHub Copilot";
|
cmp.enable = mkEnableOption "nvim-cmp integration for GitHub Copilot";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "Copilot" {
|
||||||
|
copilot_node_command = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "${lib.getExe pkgs.nodejs-slim}";
|
||||||
|
description = ''
|
||||||
|
The command that will be executed to initiate nodejs for GitHub Copilot.
|
||||||
|
Recommended to leave as default.
|
||||||
|
'';
|
||||||
|
};
|
||||||
panel = {
|
panel = {
|
||||||
|
enabled = mkEnableOption "Completion Panel" // {default = !cfg.cmp.enable;};
|
||||||
|
layout = {
|
||||||
position = mkOption {
|
position = mkOption {
|
||||||
type = enum [
|
type = enum [
|
||||||
"bottom"
|
"bottom"
|
||||||
|
@ -31,6 +49,13 @@ in {
|
||||||
description = "Panel size";
|
description = "Panel size";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
suggestion = {
|
||||||
|
enabled = mkEnableOption "Suggestions" // {default = !cfg.cmp.enable;};
|
||||||
|
# keymap = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
panel = {
|
panel = {
|
||||||
|
@ -102,23 +127,5 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
copilotNodeCommand = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${getExe cfg.copilotNodePackage}";
|
|
||||||
description = ''
|
|
||||||
The command that will be executed to initiate nodejs for GitHub Copilot.
|
|
||||||
Recommended to leave as default.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
copilotNodePackage = mkOption {
|
|
||||||
type = nullOr package;
|
|
||||||
default = pkgs.nodejs-slim;
|
|
||||||
description = ''
|
|
||||||
The nodeJS package that will be used for GitHub Copilot. If you are using a custom node command
|
|
||||||
you may want to set this option to null so that the package is not pulled from nixpkgs.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.autopairs;
|
cfg = config.vim.autopairs;
|
||||||
in {
|
in {
|
||||||
|
@ -15,14 +15,6 @@ in {
|
||||||
|
|
||||||
vim.luaConfigRC.autopairs = entryAnywhere ''
|
vim.luaConfigRC.autopairs = entryAnywhere ''
|
||||||
require("nvim-autopairs").setup{}
|
require("nvim-autopairs").setup{}
|
||||||
${optionalString (config.vim.autocomplete.type == "nvim-compe") ''
|
|
||||||
-- nvim-compe integration
|
|
||||||
require('nvim-autopairs.completion.compe').setup({
|
|
||||||
map_cr = ${boolToString cfg.nvim-compe.map_cr},
|
|
||||||
map_complete = ${boolToString cfg.nvim-compe.map_complete},
|
|
||||||
auto_select = ${boolToString cfg.nvim-compe.auto_select},
|
|
||||||
})
|
|
||||||
''}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
|
inherit (lib) mkRemovedOptionModule;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) enum bool;
|
inherit (lib.types) enum;
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRemovedOptionModule ["vim" "autopairs" "nvim-compe"] "nvim-compe is deprecated and no longer suported.")
|
||||||
|
];
|
||||||
|
|
||||||
options.vim = {
|
options.vim = {
|
||||||
autopairs = {
|
autopairs = {
|
||||||
enable = mkEnableOption "autopairs" // {default = false;};
|
enable = mkEnableOption "autopairs" // {default = false;};
|
||||||
|
@ -11,26 +16,6 @@ in {
|
||||||
default = "nvim-autopairs";
|
default = "nvim-autopairs";
|
||||||
description = "Set the autopairs type. Options: nvim-autopairs [nvim-autopairs]";
|
description = "Set the autopairs type. Options: nvim-autopairs [nvim-autopairs]";
|
||||||
};
|
};
|
||||||
|
|
||||||
nvim-compe = {
|
|
||||||
map_cr = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
description = ''map <CR> on insert mode'';
|
|
||||||
};
|
|
||||||
|
|
||||||
map_complete = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
description = "auto insert `(` after select function or method item";
|
|
||||||
};
|
|
||||||
|
|
||||||
auto_select = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = false;
|
|
||||||
description = "auto select first item";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
inherit (lib.types) bool str listOf oneOf attrsOf nullOr attrs submodule unspecified lines;
|
inherit (lib.types) bool str listOf oneOf attrsOf nullOr attrs submodule unspecified lines;
|
||||||
inherit (lib.nvim.types) dagOf pluginsOpt extraPluginType;
|
inherit (lib.nvim.types) dagOf pluginsOpt extraPluginType;
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter topoSort;
|
inherit (lib.nvim.dag) entryAnywhere entryAfter topoSort;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.vim) valToVim;
|
inherit (lib.nvim.vim) valToVim;
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@
|
||||||
else config;
|
else config;
|
||||||
action =
|
action =
|
||||||
if action.lua
|
if action.lua
|
||||||
then {"__raw" = action.action;}
|
then mkLuaInline action.action
|
||||||
else action.action;
|
else action.action;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
|
@ -6,10 +6,9 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
inherit (lib.nvim.binds) mkBinding;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) listToLuaTable expToLua;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
# TODO: move this to its own module
|
# TODO: move this to its own module
|
||||||
inherit (lib) pushDownDefault;
|
inherit (lib) pushDownDefault;
|
||||||
|
|
||||||
|
@ -40,237 +39,7 @@ in {
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
require'nvim-tree'.setup({
|
require'nvim-tree'.setup(${toLuaObject cfg.setupOpts})
|
||||||
disable_netrw = ${boolToString cfg.disableNetrw},
|
|
||||||
hijack_netrw = ${boolToString cfg.hijackNetrw},
|
|
||||||
auto_reload_on_write = ${boolToString cfg.autoreloadOnWrite},
|
|
||||||
|
|
||||||
sort = {
|
|
||||||
sorter = "${cfg.sort.sorter}",
|
|
||||||
folders_first = ${boolToString cfg.sort.foldersFirst},
|
|
||||||
},
|
|
||||||
|
|
||||||
hijack_unnamed_buffer_when_opening = ${boolToString cfg.hijackUnnamedBufferWhenOpening},
|
|
||||||
hijack_cursor = ${boolToString cfg.hijackCursor},
|
|
||||||
root_dirs = ${listToLuaTable cfg.rootDirs},
|
|
||||||
prefer_startup_root = ${boolToString cfg.preferStartupRoot},
|
|
||||||
sync_root_with_cwd = ${boolToString cfg.syncRootWithCwd},
|
|
||||||
reload_on_bufenter = ${boolToString cfg.reloadOnBufEnter},
|
|
||||||
respect_buf_cwd = ${boolToString cfg.respectBufCwd},
|
|
||||||
|
|
||||||
hijack_directories = {
|
|
||||||
enable = ${boolToString cfg.hijackDirectories.enable},
|
|
||||||
auto_open = ${boolToString cfg.hijackDirectories.autoOpen},
|
|
||||||
},
|
|
||||||
|
|
||||||
update_focused_file = {
|
|
||||||
enable = ${boolToString cfg.updateFocusedFile.enable},
|
|
||||||
update_root = ${boolToString cfg.updateFocusedFile.updateRoot},
|
|
||||||
ignore_list = ${listToLuaTable cfg.updateFocusedFile.ignoreList},
|
|
||||||
},
|
|
||||||
|
|
||||||
system_open = {
|
|
||||||
cmd = "${cfg.systemOpen.cmd}",
|
|
||||||
args = ${listToLuaTable cfg.systemOpen.args},
|
|
||||||
},
|
|
||||||
|
|
||||||
diagnostics = {
|
|
||||||
enable = ${boolToString cfg.diagnostics.enable},
|
|
||||||
icons = {
|
|
||||||
hint = "${cfg.diagnostics.icons.hint}",
|
|
||||||
info = "${cfg.diagnostics.icons.info}",
|
|
||||||
warning = "${cfg.diagnostics.icons.warning}",
|
|
||||||
error = "${cfg.diagnostics.icons.error}",
|
|
||||||
},
|
|
||||||
|
|
||||||
severity = {
|
|
||||||
min = vim.diagnostic.severity.${cfg.diagnostics.severity.min},
|
|
||||||
max = vim.diagnostic.severity.${cfg.diagnostics.severity.max},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
git = {
|
|
||||||
enable = ${boolToString cfg.git.enable},
|
|
||||||
show_on_dirs = ${boolToString cfg.git.showOnDirs},
|
|
||||||
show_on_open_dirs = ${boolToString cfg.git.showOnOpenDirs},
|
|
||||||
disable_for_dirs = ${listToLuaTable cfg.git.disableForDirs},
|
|
||||||
timeout = ${toString cfg.git.timeout},
|
|
||||||
},
|
|
||||||
|
|
||||||
modified = {
|
|
||||||
enable = ${boolToString cfg.modified.enable},
|
|
||||||
show_on_dirs = ${boolToString cfg.modified.showOnDirs},
|
|
||||||
show_on_open_dirs = ${boolToString cfg.modified.showOnOpenDirs},
|
|
||||||
},
|
|
||||||
|
|
||||||
filesystem_watchers = {
|
|
||||||
enable = ${boolToString cfg.filesystemWatchers.enable},
|
|
||||||
debounce_delay = ${toString cfg.filesystemWatchers.debounceDelay},
|
|
||||||
ignore_dirs = ${listToLuaTable cfg.filesystemWatchers.ignoreDirs},
|
|
||||||
},
|
|
||||||
|
|
||||||
select_prompts = ${boolToString cfg.selectPrompts},
|
|
||||||
|
|
||||||
view = {
|
|
||||||
centralize_selection = ${boolToString cfg.view.centralizeSelection},
|
|
||||||
cursorline = ${boolToString cfg.view.cursorline},
|
|
||||||
debounce_delay = ${toString cfg.view.debounceDelay},
|
|
||||||
width = ${expToLua cfg.view.width},
|
|
||||||
side = "${cfg.view.side}",
|
|
||||||
preserve_window_proportions = ${boolToString cfg.view.preserveWindowProportions},
|
|
||||||
number = ${boolToString cfg.view.number},
|
|
||||||
relativenumber = ${boolToString cfg.view.relativenumber},
|
|
||||||
signcolumn = "${cfg.view.signcolumn}",
|
|
||||||
float = {
|
|
||||||
enable = ${boolToString cfg.view.float.enable},
|
|
||||||
quit_on_focus_loss = ${boolToString cfg.view.float.quitOnFocusLoss},
|
|
||||||
open_win_config = {
|
|
||||||
relative = "${cfg.view.float.openWinConfig.relative}",
|
|
||||||
border = "${cfg.view.float.openWinConfig.border}",
|
|
||||||
width = ${toString cfg.view.float.openWinConfig.width},
|
|
||||||
height = ${toString cfg.view.float.openWinConfig.height},
|
|
||||||
row = ${toString cfg.view.float.openWinConfig.row},
|
|
||||||
col = ${toString cfg.view.float.openWinConfig.col},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
renderer = {
|
|
||||||
add_trailing = ${boolToString cfg.renderer.addTrailing},
|
|
||||||
group_empty = ${boolToString cfg.renderer.groupEmpty},
|
|
||||||
full_name = ${boolToString cfg.renderer.fullName},
|
|
||||||
highlight_git = ${boolToString cfg.renderer.highlightGit},
|
|
||||||
highlight_opened_files = ${cfg.renderer.highlightOpenedFiles},
|
|
||||||
highlight_modified = ${cfg.renderer.highlightModified},
|
|
||||||
root_folder_label = ${expToLua cfg.renderer.rootFolderLabel},
|
|
||||||
indent_width = ${toString cfg.renderer.indentWidth},
|
|
||||||
indent_markers = {
|
|
||||||
enable = ${boolToString cfg.renderer.indentMarkers.enable},
|
|
||||||
inline_arrows = ${boolToString cfg.renderer.indentMarkers.inlineArrows},
|
|
||||||
icons = ${expToLua cfg.renderer.indentMarkers.icons},
|
|
||||||
},
|
|
||||||
|
|
||||||
special_files = ${listToLuaTable cfg.renderer.specialFiles},
|
|
||||||
symlink_destination = ${boolToString cfg.renderer.symlinkDestination},
|
|
||||||
|
|
||||||
icons = {
|
|
||||||
webdev_colors = ${boolToString cfg.renderer.icons.webdevColors},
|
|
||||||
git_placement = "${cfg.renderer.icons.gitPlacement}",
|
|
||||||
modified_placement = "${cfg.renderer.icons.modifiedPlacement}",
|
|
||||||
padding = "${cfg.renderer.icons.padding}",
|
|
||||||
symlink_arrow = "${cfg.renderer.icons.symlinkArrow}",
|
|
||||||
|
|
||||||
show = {
|
|
||||||
git = ${boolToString cfg.renderer.icons.show.git},
|
|
||||||
folder = ${boolToString cfg.renderer.icons.show.folder},
|
|
||||||
folder_arrow = ${boolToString cfg.renderer.icons.show.folderArrow},
|
|
||||||
file = ${boolToString cfg.renderer.icons.show.file},
|
|
||||||
modified = ${boolToString cfg.renderer.icons.show.modified},
|
|
||||||
},
|
|
||||||
|
|
||||||
glyphs = {
|
|
||||||
default = "${cfg.renderer.icons.glyphs.default}",
|
|
||||||
symlink = "${cfg.renderer.icons.glyphs.symlink}",
|
|
||||||
modified = "${cfg.renderer.icons.glyphs.modified}",
|
|
||||||
|
|
||||||
folder = {
|
|
||||||
default = "${cfg.renderer.icons.glyphs.folder.default}",
|
|
||||||
open = "${cfg.renderer.icons.glyphs.folder.open}",
|
|
||||||
arrow_open = "${cfg.renderer.icons.glyphs.folder.arrowOpen}",
|
|
||||||
arrow_closed = "${cfg.renderer.icons.glyphs.folder.arrowClosed}",
|
|
||||||
empty = "${cfg.renderer.icons.glyphs.folder.empty}",
|
|
||||||
empty_open = "${cfg.renderer.icons.glyphs.folder.emptyOpen}",
|
|
||||||
symlink = "${cfg.renderer.icons.glyphs.folder.symlink}",
|
|
||||||
symlink_open = "${cfg.renderer.icons.glyphs.folder.symlinkOpen}",
|
|
||||||
},
|
|
||||||
|
|
||||||
git = {
|
|
||||||
unstaged = "${cfg.renderer.icons.glyphs.git.unstaged}",
|
|
||||||
staged = "${cfg.renderer.icons.glyphs.git.staged}",
|
|
||||||
unmerged = "${cfg.renderer.icons.glyphs.git.unmerged}",
|
|
||||||
renamed = "${cfg.renderer.icons.glyphs.git.renamed}",
|
|
||||||
untracked = "${cfg.renderer.icons.glyphs.git.untracked}",
|
|
||||||
deleted = "${cfg.renderer.icons.glyphs.git.deleted}",
|
|
||||||
ignored = "${cfg.renderer.icons.glyphs.git.ignored}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
filters = {
|
|
||||||
git_ignored = ${boolToString cfg.filters.gitIgnored},
|
|
||||||
dotfiles = ${boolToString cfg.filters.dotfiles},
|
|
||||||
git_clean = ${boolToString cfg.filters.gitClean},
|
|
||||||
no_buffer = ${boolToString cfg.filters.noBuffer},
|
|
||||||
exclude = ${listToLuaTable cfg.filters.exclude},
|
|
||||||
},
|
|
||||||
|
|
||||||
trash = {
|
|
||||||
cmd = "${cfg.trash.cmd}",
|
|
||||||
},
|
|
||||||
|
|
||||||
actions = {
|
|
||||||
use_system_clipboard = ${boolToString cfg.actions.useSystemClipboard},
|
|
||||||
change_dir = {
|
|
||||||
enable = ${boolToString cfg.actions.changeDir.enable},
|
|
||||||
global = ${boolToString cfg.actions.changeDir.global},
|
|
||||||
restrict_above_cwd = ${boolToString cfg.actions.changeDir.restrictAboveCwd},
|
|
||||||
},
|
|
||||||
|
|
||||||
expand_all = {
|
|
||||||
max_folder_discovery = ${toString cfg.actions.expandAll.maxFolderDiscovery},
|
|
||||||
exclude = ${listToLuaTable cfg.actions.expandAll.exclude},
|
|
||||||
},
|
|
||||||
|
|
||||||
file_popup = {
|
|
||||||
open_win_config = ${expToLua cfg.actions.filePopup.openWinConfig},
|
|
||||||
},
|
|
||||||
|
|
||||||
open_file = {
|
|
||||||
quit_on_open = ${boolToString cfg.actions.openFile.quitOnOpen},
|
|
||||||
eject = ${boolToString cfg.actions.openFile.eject},
|
|
||||||
resize_window = ${boolToString cfg.actions.openFile.resizeWindow},
|
|
||||||
window_picker = {
|
|
||||||
enable = ${boolToString cfg.actions.openFile.windowPicker.enable},
|
|
||||||
picker = "${cfg.actions.openFile.windowPicker.picker}",
|
|
||||||
chars = "${cfg.actions.openFile.windowPicker.chars}",
|
|
||||||
exclude = {
|
|
||||||
filetype = ${listToLuaTable cfg.actions.openFile.windowPicker.exclude.filetype},
|
|
||||||
buftype = ${listToLuaTable cfg.actions.openFile.windowPicker.exclude.buftype},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
remove_file = {
|
|
||||||
close_window = ${boolToString cfg.actions.removeFile.closeWindow},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
live_filter = {
|
|
||||||
prefix = "${cfg.liveFilter.prefix}",
|
|
||||||
always_show_folders = ${boolToString cfg.liveFilter.alwaysShowFolders},
|
|
||||||
},
|
|
||||||
|
|
||||||
tab = {
|
|
||||||
sync = {
|
|
||||||
open = ${boolToString cfg.tab.sync.open},
|
|
||||||
close = ${boolToString cfg.tab.sync.close},
|
|
||||||
ignore = ${listToLuaTable cfg.tab.sync.ignore},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
notify = {
|
|
||||||
threshold = vim.log.levels.${cfg.notify.threshold},
|
|
||||||
absolute_path = ${boolToString cfg.notify.absolutePath},
|
|
||||||
},
|
|
||||||
|
|
||||||
ui = {
|
|
||||||
confirm = {
|
|
||||||
remove = ${boolToString cfg.ui.confirm.remove},
|
|
||||||
trash = ${boolToString cfg.ui.confirm.trash},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
${
|
${
|
||||||
optionalString cfg.openOnSetup ''
|
optionalString cfg.openOnSetup ''
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.types) nullOr str bool int listOf enum attrs oneOf addCheck submodule;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.types) nullOr str bool int submodule listOf enum oneOf attrs addCheck;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.filetree.nvimTree = {
|
options.vim.filetree.nvimTree = {
|
||||||
enable = mkEnableOption "filetree via nvim-tree.lua";
|
enable = mkEnableOption "filetree via nvim-tree.lua";
|
||||||
|
@ -38,19 +40,20 @@ in {
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
hijackNetrw = mkOption {
|
setupOpts = mkPluginSetupOption "Nvim Tree" {
|
||||||
|
hijack_netrw = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
description = "Prevents netrw from automatically opening when opening directories";
|
description = "Prevents netrw from automatically opening when opening directories";
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
autoreloadOnWrite = mkOption {
|
auto_reload_on_write = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
description = "Auto reload tree on write";
|
description = "Auto reload tree on write";
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
updateFocusedFile = mkOption {
|
update_focused_file = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Update the focused file on `BufEnter`, un-collapses the folders recursively
|
Update the focused file on `BufEnter`, un-collapses the folders recursively
|
||||||
until it finds the file.
|
until it finds the file.
|
||||||
|
@ -64,7 +67,7 @@ in {
|
||||||
description = "update focused file";
|
description = "update focused file";
|
||||||
};
|
};
|
||||||
|
|
||||||
updateRoot = mkOption {
|
update_root = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -75,7 +78,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoreList = mkOption {
|
ignore_list = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -97,26 +100,26 @@ in {
|
||||||
type = enum ["name" "extension" "modification_time" "case_sensitive" "suffix" "filetype"];
|
type = enum ["name" "extension" "modification_time" "case_sensitive" "suffix" "filetype"];
|
||||||
};
|
};
|
||||||
|
|
||||||
foldersFirst = mkOption {
|
folders_first = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
description = "Sort folders before files. Has no effect when `sort.sorter` is a function.";
|
description = "Sort folders before files. Has no effect when `sort.sorter` is a function.";
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
hijackCursor = mkOption {
|
hijack_cursor = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "Hijack the cursor in the tree to put it at the start of the filename";
|
description = "Hijack the cursor in the tree to put it at the start of the filename";
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
hijackUnnamedBufferWhenOpening = mkOption {
|
hijack_unnamed_buffer_when_opening = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "Open nvimtree in place of the unnamed buffer if it's empty.";
|
description = "Open nvimtree in place of the unnamed buffer if it's empty.";
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
rootDirs = mkOption {
|
root_dirs = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
Preferred root directories. Only relevant when `updateFocusedFile.updateRoot` is `true`
|
Preferred root directories. Only relevant when `updateFocusedFile.updateRoot` is `true`
|
||||||
|
@ -124,7 +127,7 @@ in {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
};
|
};
|
||||||
|
|
||||||
preferStartupRoot = mkOption {
|
prefer_startup_root = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Prefer startup root directory when updating root directory of the tree.
|
Prefer startup root directory when updating root directory of the tree.
|
||||||
|
@ -133,7 +136,7 @@ in {
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
syncRootWithCwd = mkOption {
|
sync_root_with_cwd = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -144,47 +147,38 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
reloadOnBufEnter = mkOption {
|
reload_on_bufenter = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Automatically reloads the tree on `BufEnter` nvim-tree.";
|
description = "Automatically reloads the tree on `BufEnter` nvim-tree.";
|
||||||
};
|
};
|
||||||
|
|
||||||
respectBufCwd = mkOption {
|
respect_buf_cwd = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.";
|
description = "Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.";
|
||||||
};
|
};
|
||||||
|
|
||||||
hijackDirectories = mkOption {
|
hijack_directories = {
|
||||||
description = "hijack new directory buffers when they are opened (`:e dir`).";
|
|
||||||
|
|
||||||
default = {
|
|
||||||
enable = true;
|
|
||||||
autoOpen = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
type = submodule {
|
|
||||||
options = {
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = ''
|
description = ''
|
||||||
Enable the `hijack_directories` feature. Disable this option if you use vim-dirvish or dirbuf.nvim.
|
Enable the `hijack_directories` feature. Disable this option if you use vim-dirvish or dirbuf.nvim.
|
||||||
If `hijack_netrw` and `disable_netrw` are `false`, this feature will be disabled.
|
If `hijack_netrw` and `disable_netrw` are `false`, this feature will be disabled.
|
||||||
'';
|
'';
|
||||||
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
autoOpen = mkOption {
|
auto_open = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = ''
|
description = ''
|
||||||
Opens the tree if the tree was previously closed.
|
Opens the tree if the tree was previously closed.
|
||||||
'';
|
'';
|
||||||
};
|
default = false;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemOpen = {
|
system_open = {
|
||||||
args = mkOption {
|
args = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
description = "Optional argument list.";
|
description = "Optional argument list.";
|
||||||
|
@ -215,18 +209,18 @@ in {
|
||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption "diagnostics view in the signcolumn.";
|
enable = mkEnableOption "diagnostics view in the signcolumn.";
|
||||||
|
|
||||||
debounceDelay = mkOption {
|
debounce_delay = mkOption {
|
||||||
description = "Idle milliseconds between diagnostic event and update.";
|
description = "Idle milliseconds between diagnostic event and update.";
|
||||||
type = int;
|
type = int;
|
||||||
default = 50;
|
default = 50;
|
||||||
};
|
};
|
||||||
|
|
||||||
showOnDirs = mkOption {
|
show_on_dirs = mkOption {
|
||||||
description = "Show diagnostic icons on parent directories.";
|
description = "Show diagnostic icons on parent directories.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
showOnOpenDirs = mkOption {
|
show_on_open_dirs = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -273,12 +267,14 @@ in {
|
||||||
description = "Minimum severity.";
|
description = "Minimum severity.";
|
||||||
type = enum ["HINT" "INFO" "WARNING" "ERROR"];
|
type = enum ["HINT" "INFO" "WARNING" "ERROR"];
|
||||||
default = "HINT";
|
default = "HINT";
|
||||||
|
apply = x: mkLuaInline "vim.diagnostic.severity.${x}";
|
||||||
};
|
};
|
||||||
|
|
||||||
max = mkOption {
|
max = mkOption {
|
||||||
description = "Maximum severity.";
|
description = "Maximum severity.";
|
||||||
type = enum ["HINT" "INFO" "WARNING" "ERROR"];
|
type = enum ["HINT" "INFO" "WARNING" "ERROR"];
|
||||||
default = "ERROR";
|
default = "ERROR";
|
||||||
|
apply = x: mkLuaInline "vim.diagnostic.severity.${x}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -290,19 +286,19 @@ in {
|
||||||
git = {
|
git = {
|
||||||
enable = mkEnableOption "Git integration with icons and colors.";
|
enable = mkEnableOption "Git integration with icons and colors.";
|
||||||
|
|
||||||
showOnDirs = mkOption {
|
show_on_dirs = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Show git icons on parent directories.";
|
description = "Show git icons on parent directories.";
|
||||||
};
|
};
|
||||||
|
|
||||||
showOnOpenDirs = mkOption {
|
show_on_open_dirs = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Show git icons on directories that are open.";
|
description = "Show git icons on directories that are open.";
|
||||||
};
|
};
|
||||||
|
|
||||||
disableForDirs = mkOption {
|
disable_for_dirs = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -328,13 +324,13 @@ in {
|
||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption "Modified files with icons and color highlight.";
|
enable = mkEnableOption "Modified files with icons and color highlight.";
|
||||||
|
|
||||||
showOnDirs = mkOption {
|
show_on_dirs = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Show modified icons on parent directories.";
|
description = "Show modified icons on parent directories.";
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
showOnOpenDirs = mkOption {
|
show_on_open_dirs = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Show modified icons on directories that are open.";
|
description = "Show modified icons on directories that are open.";
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -343,7 +339,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
filesystemWatchers = mkOption {
|
filesystem_watchers = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Will use file system watcher (libuv fs_event) to watch the filesystem for changes.
|
Will use file system watcher (libuv fs_event) to watch the filesystem for changes.
|
||||||
Using this will disable BufEnter / BufWritePost events in nvim-tree which
|
Using this will disable BufEnter / BufWritePost events in nvim-tree which
|
||||||
|
@ -360,13 +356,13 @@ in {
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
debounceDelay = mkOption {
|
debounce_delay = mkOption {
|
||||||
description = "Idle milliseconds between filesystem change and action.";
|
description = "Idle milliseconds between filesystem change and action.";
|
||||||
type = int;
|
type = int;
|
||||||
default = 50;
|
default = 50;
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoreDirs = mkOption {
|
ignore_dirs = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -379,7 +375,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
selectPrompts = mkEnableOption ''
|
select_prompts = mkEnableOption ''
|
||||||
Use `vim.ui.select` style prompts. Necessary when using a UI prompt decorator such as dressing.nvim or telescope-ui-select.nvim
|
Use `vim.ui.select` style prompts. Necessary when using a UI prompt decorator such as dressing.nvim or telescope-ui-select.nvim
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -388,7 +384,7 @@ in {
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
centralizeSelection = mkOption {
|
centralize_selection = mkOption {
|
||||||
description = "If true, reposition the view so that the current node is initially centralized when entering nvim-tree.";
|
description = "If true, reposition the view so that the current node is initially centralized when entering nvim-tree.";
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -400,7 +396,7 @@ in {
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
debounceDelay = mkOption {
|
debounce_delay = mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
default = 15;
|
default = 15;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -434,7 +430,7 @@ in {
|
||||||
default = "left";
|
default = "left";
|
||||||
};
|
};
|
||||||
|
|
||||||
preserveWindowProportions = mkOption {
|
preserve_window_proportions = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Preserves window proportions when opening a file.
|
Preserves window proportions when opening a file.
|
||||||
If `false`, the height and width of windows other than nvim-tree will be equalized.
|
If `false`, the height and width of windows other than nvim-tree will be equalized.
|
||||||
|
@ -477,13 +473,13 @@ in {
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
quitOnFocusLoss = mkOption {
|
quit_on_focus_loss = mkOption {
|
||||||
description = "Close the floating tree window when it loses focus.";
|
description = "Close the floating tree window when it loses focus.";
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
openWinConfig = mkOption {
|
open_win_config = mkOption {
|
||||||
description = "Floating window config. See `:h nvim_open_win()` for more details.";
|
description = "Floating window config. See `:h nvim_open_win()` for more details.";
|
||||||
type = attrs;
|
type = attrs;
|
||||||
default = {
|
default = {
|
||||||
|
@ -503,25 +499,25 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
renderer = {
|
renderer = {
|
||||||
addTrailing = mkOption {
|
add_trailing = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "Appends a trailing slash to folder names.";
|
description = "Appends a trailing slash to folder names.";
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
groupEmpty = mkOption {
|
group_empty = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "Compact folders that only contain a single folder into one node in the file tree.";
|
description = "Compact folders that only contain a single folder into one node in the file tree.";
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
fullName = mkOption {
|
full_name = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "Display node whose name length is wider than the width of nvim-tree window in floating window.";
|
description = "Display node whose name length is wider than the width of nvim-tree window in floating window.";
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
highlightGit = mkOption {
|
highlight_git = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -531,7 +527,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
highlightOpenedFiles = mkOption {
|
highlight_opened_files = mkOption {
|
||||||
type = enum ["none" "icon" "name" "all"];
|
type = enum ["none" "icon" "name" "all"];
|
||||||
default = "none";
|
default = "none";
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -540,7 +536,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
highlightModified = mkOption {
|
highlight_modified = mkOption {
|
||||||
type = enum ["none" "icon" "name" "all"];
|
type = enum ["none" "icon" "name" "all"];
|
||||||
default = "none";
|
default = "none";
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -549,7 +545,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
rootFolderLabel = mkOption {
|
root_folder_label = mkOption {
|
||||||
type = oneOf [str bool];
|
type = oneOf [str bool];
|
||||||
default = false;
|
default = false;
|
||||||
example = ''"":~:s?$?/..?"'';
|
example = ''"":~:s?$?/..?"'';
|
||||||
|
@ -566,19 +562,19 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
indentWidth = mkOption {
|
indent_width = mkOption {
|
||||||
type = addCheck int (x: x >= 1);
|
type = addCheck int (x: x >= 1);
|
||||||
default = 2;
|
default = 2;
|
||||||
description = "Number of spaces for an each tree nesting level. Minimum 1.";
|
description = "Number of spaces for an each tree nesting level. Minimum 1.";
|
||||||
};
|
};
|
||||||
|
|
||||||
indentMarkers = mkOption {
|
indent_markers = mkOption {
|
||||||
description = "Configuration options for tree indent markers.";
|
description = "Configuration options for tree indent markers.";
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption "Display indent markers when folders are open.";
|
enable = mkEnableOption "Display indent markers when folders are open.";
|
||||||
inlineArrows = mkOption {
|
inline_arrows = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Display folder arrows in the same column as indent marker when using `renderer.icons.show.folder_arrow`";
|
description = "Display folder arrows in the same column as indent marker when using `renderer.icons.show.folder_arrow`";
|
||||||
|
@ -599,13 +595,13 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
specialFiles = mkOption {
|
special_files = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = ["Cargo.toml" "README.md" "readme.md" "Makefile" "MAKEFILE" "flake.nix"]; # ;)
|
default = ["Cargo.toml" "README.md" "readme.md" "Makefile" "MAKEFILE" "flake.nix"]; # ;)
|
||||||
description = "A list of filenames that gets highlighted with `NvimTreeSpecialFile";
|
description = "A list of filenames that gets highlighted with `NvimTreeSpecialFile";
|
||||||
};
|
};
|
||||||
|
|
||||||
symlinkDestination = mkOption {
|
symlink_destination = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Whether to show the destination of the symlink.";
|
description = "Whether to show the destination of the symlink.";
|
||||||
|
@ -616,19 +612,19 @@ in {
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
webdevColors = mkOption {
|
webdev_colors = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = " Use the webdev icon colors, otherwise `NvimTreeFileIcon`";
|
description = " Use the webdev icon colors, otherwise `NvimTreeFileIcon`";
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
gitPlacement = mkOption {
|
git_placement = mkOption {
|
||||||
type = enum ["before" "after" "signcolumn"];
|
type = enum ["before" "after" "signcolumn"];
|
||||||
description = "Place where the git icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
|
description = "Place where the git icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
|
||||||
default = "before";
|
default = "before";
|
||||||
};
|
};
|
||||||
|
|
||||||
modifiedPlacement = mkOption {
|
modified_placement = mkOption {
|
||||||
type = enum ["before" "after" "signcolumn"];
|
type = enum ["before" "after" "signcolumn"];
|
||||||
description = "Place where the modified icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
|
description = "Place where the modified icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
|
||||||
default = "after";
|
default = "after";
|
||||||
|
@ -640,7 +636,7 @@ in {
|
||||||
default = " ";
|
default = " ";
|
||||||
};
|
};
|
||||||
|
|
||||||
symlinkArrow = mkOption {
|
symlink_arrow = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "Used as a separator between symlinks' source and target.";
|
description = "Used as a separator between symlinks' source and target.";
|
||||||
default = " ➛ ";
|
default = " ➛ ";
|
||||||
|
@ -659,7 +655,7 @@ in {
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
folderArrow = mkOption {
|
folder_arrow = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -720,12 +716,12 @@ in {
|
||||||
default = {
|
default = {
|
||||||
default = "";
|
default = "";
|
||||||
open = "";
|
open = "";
|
||||||
arrowOpen = "";
|
arrow_open = "";
|
||||||
arrowClosed = "";
|
arrow_closed = "";
|
||||||
empty = "";
|
empty = "";
|
||||||
emptyOpen = "";
|
empty_open = "";
|
||||||
symlink = "";
|
symlink = "";
|
||||||
symlinkOpen = "";
|
symlink_open = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -754,15 +750,15 @@ in {
|
||||||
description = "Filtering options.";
|
description = "Filtering options.";
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
gitIgnored = false;
|
git_ignored = false;
|
||||||
dotfiles = false;
|
dotfiles = false;
|
||||||
gitClean = false;
|
git_clean = false;
|
||||||
noBuffer = false;
|
no_buffer = false;
|
||||||
exclude = [];
|
exclude = [];
|
||||||
};
|
};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
gitIgnored = mkOption {
|
git_ignored = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Ignore files based on `.gitignore`. Requires git.enable` to be `true`";
|
description = "Ignore files based on `.gitignore`. Requires git.enable` to be `true`";
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -774,7 +770,7 @@ in {
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
gitClean = mkOption {
|
git_clean = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
||||||
|
@ -784,7 +780,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
noBuffer = mkOption {
|
no_buffer = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Do not show files that have no `buflisted()` buffer.";
|
description = "Do not show files that have no `buflisted()` buffer.";
|
||||||
|
@ -820,7 +816,7 @@ in {
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
useSystemClipboard = mkOption {
|
use_system_clipboard = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -831,7 +827,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
# change_dir actions
|
# change_dir actions
|
||||||
changeDir = mkOption {
|
change_dir = mkOption {
|
||||||
description = "vim `change-directory` behaviour";
|
description = "vim `change-directory` behaviour";
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
|
@ -851,7 +847,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
restrictAboveCwd = mkOption {
|
restrict_above_cwd = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -863,12 +859,12 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
# expand_all actions
|
# expand_all actions
|
||||||
expandAll = mkOption {
|
expand_all = mkOption {
|
||||||
description = "Configuration for expand_all behaviour.";
|
description = "Configuration for expand_all behaviour.";
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
maxFolderDiscovery = mkOption {
|
max_folder_discovery = mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
default = 300;
|
default = 300;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -886,12 +882,12 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
# file_popup actions
|
# file_popup actions
|
||||||
filePopup = mkOption {
|
file_popup = mkOption {
|
||||||
description = "Configuration for file_popup behaviour.";
|
description = "Configuration for file_popup behaviour.";
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
openWinConfig = mkOption {
|
open_win_config = mkOption {
|
||||||
type = attrs;
|
type = attrs;
|
||||||
default = {
|
default = {
|
||||||
col = 1;
|
col = 1;
|
||||||
|
@ -907,12 +903,12 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
# open_file actions
|
# open_file actions
|
||||||
openFile = mkOption {
|
open_file = mkOption {
|
||||||
description = "Configuration options for opening a file from nvim-tree.";
|
description = "Configuration options for opening a file from nvim-tree.";
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
quitOnOpen = mkOption {
|
quit_on_open = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Closes the explorer when opening a file.";
|
description = "Closes the explorer when opening a file.";
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -924,14 +920,14 @@ in {
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
resizeWindow = mkOption {
|
resize_window = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
||||||
description = "Resizes the tree when opening a file. Previously `view.auto_resize`";
|
description = "Resizes the tree when opening a file. Previously `view.auto_resize`";
|
||||||
};
|
};
|
||||||
|
|
||||||
windowPicker = mkOption {
|
window_picker = mkOption {
|
||||||
description = "window_picker";
|
description = "window_picker";
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
|
@ -985,8 +981,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
removeFile = {
|
remove_file = {
|
||||||
closeWindow = mkOption {
|
close_window = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Close any window displaying a file when removing the file from the tree";
|
description = "Close any window displaying a file when removing the file from the tree";
|
||||||
|
@ -996,7 +992,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
liveFilter = mkOption {
|
live_filter = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Configurations for the live_filtering feature.
|
Configurations for the live_filtering feature.
|
||||||
The live filter allows you to filter the tree nodes dynamically, based on
|
The live filter allows you to filter the tree nodes dynamically, based on
|
||||||
|
@ -1013,7 +1009,7 @@ in {
|
||||||
default = "[FILTER]: ";
|
default = "[FILTER]: ";
|
||||||
};
|
};
|
||||||
|
|
||||||
alwaysShowFolders = mkOption {
|
always_show_folders = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Whether to filter folders or not.";
|
description = "Whether to filter folders or not.";
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -1073,9 +1069,10 @@ in {
|
||||||
type = enum ["ERROR" "WARNING" "INFO" "DEBUG"];
|
type = enum ["ERROR" "WARNING" "INFO" "DEBUG"];
|
||||||
description = "Specify minimum notification level, uses the values from `vim.log.levels`";
|
description = "Specify minimum notification level, uses the values from `vim.log.levels`";
|
||||||
default = "INFO";
|
default = "INFO";
|
||||||
|
apply = x: mkLuaInline "vim.log.levels.${x}";
|
||||||
};
|
};
|
||||||
|
|
||||||
absolutePath = mkOption {
|
absolute_path = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Whether to use absolute paths or item names in fs action notifications.";
|
description = "Whether to use absolute paths or item names in fs action notifications.";
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -1105,6 +1102,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# kept for backwards compatibility
|
# kept for backwards compatibility
|
||||||
openOnSetup = mkOption {
|
openOnSetup = mkOption {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
in {
|
in {
|
||||||
|
@ -15,16 +15,14 @@ in {
|
||||||
"lsp-signature"
|
"lsp-signature"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
lsp.lspSignature.setupOpts = {
|
||||||
|
bind = config.vim.ui.borders.plugins.lsp-signature.enable;
|
||||||
|
handler_opts.border = config.vim.ui.borders.plugins.lsp-signature.style;
|
||||||
|
};
|
||||||
|
|
||||||
luaConfigRC.lsp-signature = entryAnywhere ''
|
luaConfigRC.lsp-signature = entryAnywhere ''
|
||||||
-- Enable lsp signature viewer
|
-- Enable lsp signature viewer
|
||||||
require("lsp_signature").setup({
|
require("lsp_signature").setup(${toLuaObject cfg.lspSignature.setupOpts})
|
||||||
${optionalString config.vim.ui.borders.plugins.lsp-signature.enable ''
|
|
||||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
|
||||||
handler_opts = {
|
|
||||||
border = "${config.vim.ui.borders.plugins.lsp-signature.style}"
|
|
||||||
}
|
|
||||||
''}
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
in {
|
in {
|
||||||
options.vim.lsp = {
|
options.vim.lsp = {
|
||||||
lspSignature = {
|
lspSignature = {
|
||||||
enable = mkEnableOption "lsp signature viewer [lsp-signature]";
|
enable = mkEnableOption "lsp signature viewer";
|
||||||
|
setupOpts = lib.nvim.types.mkPluginSetupOption "lsp-signature" {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toString;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp.nvim-docs-view;
|
cfg = config.vim.lsp.nvim-docs-view;
|
||||||
self = import ./nvim-docs-view.nix {inherit lib;};
|
self = import ./nvim-docs-view.nix {inherit lib;};
|
||||||
|
@ -20,12 +20,7 @@ in {
|
||||||
startPlugins = ["nvim-docs-view"];
|
startPlugins = ["nvim-docs-view"];
|
||||||
|
|
||||||
luaConfigRC.nvim-docs-view = entryAnywhere ''
|
luaConfigRC.nvim-docs-view = entryAnywhere ''
|
||||||
require("docs-view").setup {
|
require("docs-view").setup ${toLuaObject cfg.setupOpts}
|
||||||
position = "${cfg.position}",
|
|
||||||
width = ${toString cfg.width},
|
|
||||||
height = ${toString cfg.height},
|
|
||||||
update_mode = "${cfg.updateMode}",
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
|
|
|
@ -1,13 +1,26 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) enum int;
|
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib) types mkRenamedOptionModule;
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renamedSetupOption = oldPath: newPath:
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(["vim" "lsp" "nvim-docs-view"] ++ oldPath)
|
||||||
|
(["vim" "lsp" "nvim-docs-view" "setupOpts"] ++ newPath);
|
||||||
|
in [
|
||||||
|
(renamedSetupOption ["position"] ["position"])
|
||||||
|
(renamedSetupOption ["width"] ["width"])
|
||||||
|
(renamedSetupOption ["height"] ["height"])
|
||||||
|
(renamedSetupOption ["updateMode"] ["update_mode"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.lsp.nvim-docs-view = {
|
options.vim.lsp.nvim-docs-view = {
|
||||||
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
|
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
|
||||||
|
|
||||||
|
setupOpts = lib.nvim.types.mkPluginSetupOption "nvim-docs-view" {
|
||||||
position = mkOption {
|
position = mkOption {
|
||||||
type = enum ["left" "right" "top" "bottom"];
|
type = types.enum ["left" "right" "top" "bottom"];
|
||||||
default = "right";
|
default = "right";
|
||||||
description = ''
|
description = ''
|
||||||
Where to open the docs view panel
|
Where to open the docs view panel
|
||||||
|
@ -15,7 +28,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
height = mkOption {
|
height = mkOption {
|
||||||
type = int;
|
type = types.int;
|
||||||
default = 10;
|
default = 10;
|
||||||
description = ''
|
description = ''
|
||||||
Height of the docs view panel if the position is set to either top or bottom
|
Height of the docs view panel if the position is set to either top or bottom
|
||||||
|
@ -23,24 +36,23 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
width = mkOption {
|
width = mkOption {
|
||||||
type = int;
|
type = types.int;
|
||||||
default = 60;
|
default = 60;
|
||||||
description = ''
|
description = ''
|
||||||
Width of the docs view panel if the position is set to either left or right
|
Width of the docs view panel if the position is set to either left or right
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
updateMode = mkOption {
|
update_mode = mkOption {
|
||||||
type = enum ["auto" "manual"];
|
type = types.enum ["auto" "manual"];
|
||||||
default = "auto";
|
default = "auto";
|
||||||
description = ''
|
description = ''
|
||||||
Determines the mechanism used to update the docs view panel content
|
Determines the mechanism used to update the docs view panel content.
|
||||||
|
- If auto, the content will update upon cursor move.
|
||||||
Possible values:
|
- If manual, the content will only update once :DocsViewUpdate is called
|
||||||
- auto: the content will update upon cursor move.
|
|
||||||
- manual: the content will only update once :DocsViewUpdate is called
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.binds) pushDownDefault;
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.notes.obsidian;
|
cfg = config.vim.notes.obsidian;
|
||||||
auto = config.vim.autocomplete;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
|
@ -23,28 +23,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
luaConfigRC.obsidian = entryAnywhere ''
|
luaConfigRC.obsidian = entryAnywhere ''
|
||||||
require("obsidian").setup({
|
require("obsidian").setup(${toLuaObject cfg.setupOpts})
|
||||||
dir = "${cfg.dir}",
|
|
||||||
completion = {
|
|
||||||
nvim_cmp = ${
|
|
||||||
if (auto.type == "nvim-cmp")
|
|
||||||
then "true"
|
|
||||||
else "false"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
daily_notes = {
|
|
||||||
folder = ${
|
|
||||||
if (cfg.daily-notes.folder == "")
|
|
||||||
then "nil,"
|
|
||||||
else "'${cfg.daily-notes.folder}',"
|
|
||||||
}
|
|
||||||
date_format = ${
|
|
||||||
if (cfg.daily-notes.date-format == "")
|
|
||||||
then "nil,"
|
|
||||||
else "'${cfg.daily-notes.date-format}',"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,33 +1,52 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
config,
|
||||||
inherit (lib.types) str bool;
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renamedSetupOption = oldPath: newPath:
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(["vim" "notes" "obsidian"] ++ oldPath)
|
||||||
|
(["vim" "notes" "obsidian" "setupOpts"] ++ newPath);
|
||||||
|
in [
|
||||||
|
(renamedSetupOption ["dir"] ["dir"])
|
||||||
|
(renamedSetupOption ["daily-notes" "folder"] ["daily_notes" "folder"])
|
||||||
|
(renamedSetupOption ["daily-notes" "date-format"] ["daily_notes" "date_format"])
|
||||||
|
(renamedSetupOption ["completion"] ["completion"])
|
||||||
|
];
|
||||||
options.vim.notes = {
|
options.vim.notes = {
|
||||||
obsidian = {
|
obsidian = {
|
||||||
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
|
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
|
||||||
|
|
||||||
|
setupOpts = lib.nvim.types.mkPluginSetupOption "Obsidian.nvim" {
|
||||||
dir = mkOption {
|
dir = mkOption {
|
||||||
type = str;
|
type = types.str;
|
||||||
default = "~/my-vault";
|
default = "~/my-vault";
|
||||||
description = "Obsidian vault directory";
|
description = "Obsidian vault directory";
|
||||||
};
|
};
|
||||||
|
|
||||||
daily-notes = {
|
daily_notes = {
|
||||||
folder = mkOption {
|
folder = mkOption {
|
||||||
type = str;
|
type = types.nullOr types.str;
|
||||||
default = "";
|
default = null;
|
||||||
description = "Directory in which daily notes should be created";
|
description = "Directory in which daily notes should be created";
|
||||||
};
|
};
|
||||||
date-format = mkOption {
|
date_format = mkOption {
|
||||||
type = str;
|
type = types.nullOr types.str;
|
||||||
default = "";
|
default = null;
|
||||||
description = "Date format used for creating daily notes";
|
description = "Date format used for creating daily notes";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
completion = {
|
completion = {
|
||||||
nvim_cmp = mkOption {
|
nvim_cmp = mkOption {
|
||||||
type = bool;
|
# if using nvim-cmp, otherwise set to false
|
||||||
|
type = types.bool;
|
||||||
description = "If using nvim-cmp, otherwise set to false";
|
description = "If using nvim-cmp, otherwise set to false";
|
||||||
|
default = config.vim.autocomplete.type == "nvim-cmp";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.binds) pushDownDefault;
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.notes.orgmode;
|
cfg = config.vim.notes.orgmode;
|
||||||
in {
|
in {
|
||||||
|
@ -37,10 +38,7 @@ in {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require('orgmode').setup({
|
require('orgmode').setup(${toLuaObject cfg.setupOpts})
|
||||||
org_agenda_files = ${cfg.orgAgendaFiles},
|
|
||||||
org_default_notes_file = '${cfg.orgDefaultNotesFile}',
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,24 +4,32 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
inherit (lib.types) str;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.types) str listOf;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRenamedOptionModule ["vim" "notes" "orgmode" "orgAgendaFiles"] ["vim" "notes" "orgmode" "setupOpts" "org_agenda_files"])
|
||||||
|
(mkRenamedOptionModule ["vim" "notes" "orgmode" "orgDefaultNotesFile"] ["vim" "notes" "orgmode" "setupOpts" "org_default_notes_file"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.notes.orgmode = {
|
options.vim.notes.orgmode = {
|
||||||
enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds";
|
enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds";
|
||||||
|
|
||||||
orgAgendaFiles = mkOption {
|
setupOpts = mkPluginSetupOption "Orgmode" {
|
||||||
type = str;
|
org_agenda_files = mkOption {
|
||||||
default = "{'~/Documents/org/*', '~/my-orgs/**/*'}";
|
type = listOf str;
|
||||||
|
default = ["~/Documents/org/*" "~/my-orgs/**/*"];
|
||||||
description = "List of org files to be used as agenda files.";
|
description = "List of org files to be used as agenda files.";
|
||||||
};
|
};
|
||||||
|
|
||||||
orgDefaultNotesFile = mkOption {
|
org_default_notes_file = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "~/Documents/org/refile.org";
|
default = "~/Documents/org/refile.org";
|
||||||
description = "Default org file to be used for notes.";
|
description = "Default org file to be used for notes.";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
treesitter = {
|
treesitter = {
|
||||||
enable = mkEnableOption "Orgmode treesitter" // {default = config.vim.languages.enableTreesitter;};
|
enable = mkEnableOption "Orgmode treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib) mkMerge mkBinding mkIf;
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.notes.todo-comments;
|
cfg = config.vim.notes.todo-comments;
|
||||||
self = import ./todo-comments.nix {inherit lib;};
|
self = import ./todo-comments.nix {inherit pkgs lib;};
|
||||||
inherit (self.options.vim.notes.todo-comments) mappings;
|
inherit (self.options.vim.notes.todo-comments) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -24,28 +24,7 @@ in {
|
||||||
];
|
];
|
||||||
|
|
||||||
luaConfigRC.todo-comments = ''
|
luaConfigRC.todo-comments = ''
|
||||||
require('todo-comments').setup {
|
require('todo-comments').setup(${toLuaObject cfg.setupOpts})
|
||||||
highlight = {
|
|
||||||
before = "", -- "fg" or "bg" or empty
|
|
||||||
keyword = "bg", -- "fg", "bg", "wide" or empty
|
|
||||||
after = "fg", -- "fg" or "bg" or empty
|
|
||||||
pattern = ${cfg.patterns.highlight},
|
|
||||||
comments_only = true, -- uses treesitter to match keywords in comments only
|
|
||||||
max_line_len = 400, -- ignore lines longer than this
|
|
||||||
exclude = {}, -- list of file types to exclude highlighting
|
|
||||||
},
|
|
||||||
search = {
|
|
||||||
command = "${pkgs.ripgrep}/bin/rg",
|
|
||||||
args = {
|
|
||||||
"--color=never",
|
|
||||||
"--no-heading",
|
|
||||||
"--with-filename",
|
|
||||||
"--line-number",
|
|
||||||
"--column",
|
|
||||||
},
|
|
||||||
pattern = ${cfg.patterns.search},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,23 +1,51 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
pkgs,
|
||||||
inherit (lib.types) str;
|
lib,
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkEnableOption mkOption types mkMappingOption mkRenamedOptionModule;
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renamedSetupOption = oldPath: newPath:
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(["vim" "notes" "todo-comments"] ++ oldPath)
|
||||||
|
(["vim" "notes" "todo-comments" "setupOpts"] ++ newPath);
|
||||||
|
in [
|
||||||
|
(renamedSetupOption ["patterns" "highlight"] ["highlight" "pattern"])
|
||||||
|
(renamedSetupOption ["patterns" "search"] ["search" "pattern"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.notes.todo-comments = {
|
options.vim.notes.todo-comments = {
|
||||||
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";
|
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";
|
||||||
|
|
||||||
patterns = {
|
setupOpts = lib.nvim.types.mkPluginSetupOption "todo-comments.nvim" {
|
||||||
highlight = mkOption {
|
highlight = {
|
||||||
type = str;
|
pattern = mkOption {
|
||||||
default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]'';
|
type = types.str;
|
||||||
|
default = ''.*<(KEYWORDS)(\([^\)]*\))?:'';
|
||||||
description = "vim regex pattern used for highlighting comments";
|
description = "vim regex pattern used for highlighting comments";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
search = mkOption {
|
search = {
|
||||||
type = str;
|
pattern = mkOption {
|
||||||
default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]'';
|
type = types.str;
|
||||||
|
default = ''\b(KEYWORDS)(\([^\)]*\))?:'';
|
||||||
description = "ripgrep regex pattern used for searching comments";
|
description = "ripgrep regex pattern used for searching comments";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
command = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "${pkgs.ripgrep}/bin/rg";
|
||||||
|
description = "search command";
|
||||||
|
};
|
||||||
|
|
||||||
|
args = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = ["--color=never" "--no-heading" "--with-filename" "--line-number" "--column"];
|
||||||
|
description = "arguments to pass to the search command";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib) mkIf nvim;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.strings) concatStringsSep;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
|
|
||||||
cfg = config.vim.projects.project-nvim;
|
cfg = config.vim.projects.project-nvim;
|
||||||
in {
|
in {
|
||||||
|
@ -15,40 +12,8 @@ in {
|
||||||
"project-nvim"
|
"project-nvim"
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.project-nvim = entryAnywhere ''
|
vim.luaConfigRC.project-nvim = nvim.dag.entryAnywhere ''
|
||||||
require('project_nvim').setup({
|
require('project_nvim').setup(${nvim.lua.toLuaObject cfg.setupOpts})
|
||||||
manual_mode = ${boolToString cfg.manualMode},
|
|
||||||
detection_methods = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.detectionMethods)} },
|
|
||||||
|
|
||||||
-- All the patterns used to detect root dir, when **"pattern"** is in
|
|
||||||
-- detection_methods
|
|
||||||
patterns = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.patterns)} },
|
|
||||||
|
|
||||||
-- Table of lsp clients to ignore by name
|
|
||||||
-- eg: { "efm", ... }
|
|
||||||
ignore_lsp = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.lspIgnored)} },
|
|
||||||
|
|
||||||
-- Don't calculate root dir on specific directories
|
|
||||||
-- Ex: { "~/.cargo/*", ... }
|
|
||||||
exclude_dirs = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.excludeDirs)} },
|
|
||||||
|
|
||||||
-- Show hidden files in telescope
|
|
||||||
show_hidden = ${boolToString cfg.showHidden},
|
|
||||||
|
|
||||||
-- When set to false, you will get a message when project.nvim changes your
|
|
||||||
-- directory.
|
|
||||||
silent_chdir = ${boolToString cfg.silentChdir},
|
|
||||||
|
|
||||||
-- What scope to change the directory, valid options are
|
|
||||||
-- * global (default)
|
|
||||||
-- * tab
|
|
||||||
-- * win
|
|
||||||
scope_chdir = '${toString cfg.scopeChdir}',
|
|
||||||
|
|
||||||
-- Path where project.nvim will store the project history for use in
|
|
||||||
-- telescope
|
|
||||||
datapath = vim.fn.stdpath("data"),
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,80 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
config,
|
||||||
inherit (lib.types) enum bool listOf str;
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renamedSetupOption = oldPath: newPath:
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(["vim" "projects" "project-nvim"] ++ oldPath)
|
||||||
|
(["vim" "projects" "project-nvim" "setupOpts"] ++ newPath);
|
||||||
|
in [
|
||||||
|
(renamedSetupOption ["manualMode"] ["manual_mode"])
|
||||||
|
(renamedSetupOption ["detectionMethods"] ["detection_methods"])
|
||||||
|
(renamedSetupOption ["patterns"] ["patterns"])
|
||||||
|
(renamedSetupOption ["lspIgnored"] ["lsp_ignored"])
|
||||||
|
(renamedSetupOption ["excludeDirs"] ["exclude_dirs"])
|
||||||
|
(renamedSetupOption ["showHidden"] ["show_hidden"])
|
||||||
|
(renamedSetupOption ["silentChdir"] ["silent_chdir"])
|
||||||
|
(renamedSetupOption ["scopeChdir"] ["scope_chdir"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.projects.project-nvim = {
|
options.vim.projects.project-nvim = {
|
||||||
enable = mkEnableOption "project-nvim for project management";
|
enable = mkEnableOption "project-nvim for project management";
|
||||||
|
|
||||||
manualMode = mkOption {
|
setupOpts = lib.nvim.types.mkPluginSetupOption "Project.nvim" {
|
||||||
type = bool;
|
manual_mode = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command";
|
description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command";
|
||||||
};
|
};
|
||||||
|
|
||||||
# detection methods should accept one or more strings from a list
|
# detection methods should accept one or more strings from a list
|
||||||
detectionMethods = mkOption {
|
detection_methods = mkOption {
|
||||||
type = listOf str;
|
type = types.listOf types.str;
|
||||||
default = ["lsp" "pattern"];
|
default = ["lsp" "pattern"];
|
||||||
description = "Detection methods to use";
|
description = "Detection methods to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
# patterns
|
# patterns
|
||||||
patterns = mkOption {
|
patterns = mkOption {
|
||||||
type = listOf str;
|
type = types.listOf types.str;
|
||||||
default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"];
|
default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"];
|
||||||
description = "Patterns to use for pattern detection method";
|
description = "Patterns to use for pattern detection method";
|
||||||
};
|
};
|
||||||
|
|
||||||
# table of lsp servers to ignore by name
|
# table of lsp servers to ignore by name
|
||||||
lspIgnored = mkOption {
|
lsp_ignored = mkOption {
|
||||||
type = listOf str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "LSP servers no ignore by name";
|
description = "LSP servers no ignore by name";
|
||||||
};
|
};
|
||||||
|
|
||||||
excludeDirs = mkOption {
|
exclude_dirs = mkOption {
|
||||||
type = listOf str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "Directories to exclude from project root search";
|
description = "Directories to exclude from project root search";
|
||||||
};
|
};
|
||||||
|
|
||||||
showHidden = mkOption {
|
show_hidden = mkOption {
|
||||||
type = bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Show hidden files in telescope picker";
|
description = "Show hidden files in telescope picker";
|
||||||
};
|
};
|
||||||
|
|
||||||
silentChdir = mkOption {
|
silent_chdir = mkOption {
|
||||||
type = bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Silently change directory when changing project";
|
description = "Silently change directory when changing project";
|
||||||
};
|
};
|
||||||
|
|
||||||
scopeChdir = mkOption {
|
scope_chdir = mkOption {
|
||||||
type = enum ["global" "tab" "win"];
|
type = types.enum ["global" "tab" "win"];
|
||||||
default = "global";
|
default = "global";
|
||||||
description = "What scope to change the directory";
|
description = "What scope to change the directory";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,9 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toString;
|
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.strings) escapeNixString;
|
|
||||||
inherit (lib.nvim.lua) listToLuaTable;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.presence.neocord;
|
cfg = config.vim.presence.neocord;
|
||||||
in {
|
in {
|
||||||
|
@ -17,31 +14,7 @@ in {
|
||||||
|
|
||||||
vim.luaConfigRC.neocord = entryAnywhere ''
|
vim.luaConfigRC.neocord = entryAnywhere ''
|
||||||
-- Description of each option can be found in https://github.com/IogaMaster/neocord#lua
|
-- Description of each option can be found in https://github.com/IogaMaster/neocord#lua
|
||||||
require("neocord").setup({
|
require("neocord").setup(${toLuaObject cfg.setupOpts})
|
||||||
-- General options
|
|
||||||
logo = "${cfg.logo}",
|
|
||||||
logo_tooltip = "${cfg.logo_tooltip}",
|
|
||||||
main_image = "${cfg.main_image}",
|
|
||||||
client_id = "${cfg.client_id}",
|
|
||||||
log_level = ${
|
|
||||||
if cfg.log_level == null
|
|
||||||
then "nil"
|
|
||||||
else "${escapeNixString cfg.log_level}"
|
|
||||||
},
|
|
||||||
debounce_timeout = ${toString cfg.debounce_timeout},
|
|
||||||
blacklist = ${listToLuaTable cfg.blacklist},
|
|
||||||
show_time = "${boolToString cfg.show_time}",
|
|
||||||
|
|
||||||
-- Rich Presence text options
|
|
||||||
editing_text = "${cfg.rich_presence.editing_text}",
|
|
||||||
file_explorer_text = "${cfg.rich_presence.file_explorer_text}",
|
|
||||||
git_commit_text = "${cfg.rich_presence.git_commit_text}",
|
|
||||||
plugin_manager_text = "${cfg.rich_presence.plugin_manager_text}",
|
|
||||||
reading_text = "${cfg.rich_presence.reading_text}",
|
|
||||||
workspace_text = "${cfg.rich_presence.workspace_text}",
|
|
||||||
line_number_text = "${cfg.rich_presence.line_number_text}",
|
|
||||||
terminal_text = "${cfg.rich_presence.terminal_text}",
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,29 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.modules) mkRemovedOptionModule;
|
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.types) bool int str enum nullOr listOf;
|
inherit (lib.types) bool int str enum nullOr listOf;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports =
|
||||||
|
[
|
||||||
(mkRemovedOptionModule ["vim" "presence" "presence-nvim"] ''
|
(mkRemovedOptionModule ["vim" "presence" "presence-nvim"] ''
|
||||||
The option vim.presence.presence-nvim has been deprecated in favor of the new neocord module.
|
The option vim.presence.presence-nvim has been deprecated in favor of the new neocord module.
|
||||||
Options provided by the plugin remain mostly the same, but manual migration is required.
|
Options provided by the plugin remain mostly the same, but manual migration is required.
|
||||||
|
|
||||||
Please see neocord documentation and the neovim-flake options for more info
|
Please see neocord documentation and the neovim-flake options for more info
|
||||||
'')
|
'')
|
||||||
];
|
]
|
||||||
|
++ (map
|
||||||
|
(optName: mkRenamedOptionModule ["vim" "presence" "neocord" "rich_presence" optName] ["vim" "presence" "neocord" "setupOpts" optName])
|
||||||
|
["debounce_timeout" "blacklist" "show_time" "editing_text" "file_explorer_text" "git_commit_text" "plugin_manager_text" "reading_text" "workspace_text" "line_number_text" "terminal_text"])
|
||||||
|
++ (map
|
||||||
|
(optName: mkRenamedOptionModule ["vim" "presence" "neocord" optName] ["vim" "presence" "neocord" "setupOpts" optName])
|
||||||
|
["logo" "logo_tooltip" "main_image" "client_id" "log_level" "debounce_timeout" "blacklist" "show_time"]);
|
||||||
|
|
||||||
options.vim.presence.neocord = {
|
options.vim.presence.neocord = {
|
||||||
enable = mkEnableOption "neocord plugin for discord rich presence";
|
enable = mkEnableOption "neocord plugin for discord rich presence";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "neocord" {
|
||||||
logo = mkOption {
|
logo = mkOption {
|
||||||
type = str; # TODO: can the default be documented better, maybe with an enum?
|
type = str; # TODO: can the default be documented better, maybe with an enum?
|
||||||
default = "auto";
|
default = "auto";
|
||||||
|
@ -80,7 +89,6 @@ in {
|
||||||
description = "List of filetypes to ignore";
|
description = "List of filetypes to ignore";
|
||||||
};
|
};
|
||||||
|
|
||||||
rich_presence = {
|
|
||||||
editing_text = mkOption {
|
editing_text = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "Editing %s";
|
default = "Editing %s";
|
||||||
|
|
|
@ -3,12 +3,8 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib) mkIf optionals mkMerge mkBinding nvim;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.strings) concatStringsSep;
|
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
|
|
||||||
cfg = config.vim.session.nvim-session-manager;
|
cfg = config.vim.session.nvim-session-manager;
|
||||||
in {
|
in {
|
||||||
|
@ -19,7 +15,7 @@ in {
|
||||||
"nvim-session-manager"
|
"nvim-session-manager"
|
||||||
"plenary-nvim"
|
"plenary-nvim"
|
||||||
]
|
]
|
||||||
++ optionals (cfg.usePicker) ["dressing-nvim"];
|
++ optionals cfg.usePicker ["dressing-nvim"];
|
||||||
|
|
||||||
maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
(mkBinding cfg.mappings.loadSession ":SessionManager load_session<CR>" "Load session")
|
(mkBinding cfg.mappings.loadSession ":SessionManager load_session<CR>" "Load session")
|
||||||
|
@ -29,31 +25,10 @@ in {
|
||||||
# TODO: load_current_dir_session
|
# TODO: load_current_dir_session
|
||||||
];
|
];
|
||||||
|
|
||||||
luaConfigRC.nvim-session-manager = entryAnywhere ''
|
luaConfigRC.nvim-session-manager = nvim.dag.entryAnywhere ''
|
||||||
local Path = require('plenary.path')
|
local Path = require('plenary.path')
|
||||||
local sm = require('session_manager.config')
|
local sm = require('session_manager.config')
|
||||||
require('session_manager').setup({
|
require('session_manager').setup(${toLuaObject cfg.setupOpts})
|
||||||
sessions_dir = Path:new(vim.fn.stdpath('data'), 'sessions'),
|
|
||||||
|
|
||||||
path_replacer = '${toString cfg.pathReplacer}',
|
|
||||||
|
|
||||||
colon_replacer = '${toString cfg.colonReplacer}',
|
|
||||||
|
|
||||||
autoload_mode = sm.AutoloadMode.${toString cfg.autoloadMode},
|
|
||||||
|
|
||||||
autosave_last_session = ${boolToString cfg.autoSave.lastSession},
|
|
||||||
|
|
||||||
autosave_ignore_not_normal = ${boolToString cfg.autoSave.ignoreNotNormal},
|
|
||||||
|
|
||||||
autosave_ignore_dirs = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreDirs)}},
|
|
||||||
|
|
||||||
autosave_ignore_filetypes = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreFiletypes)}},
|
|
||||||
|
|
||||||
autosave_ignore_buftypes = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreBufTypes)}},
|
|
||||||
|
|
||||||
autosave_only_in_session = ${boolToString cfg.autoSave.onlyInSession},
|
|
||||||
max_path_length = ${toString cfg.maxPathLength},
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,23 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.types) nullOr str bool;
|
||||||
inherit (lib.types) nullOr str bool int listOf enum;
|
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renameSetupOpt = oldPath: newPath:
|
||||||
|
mkRenamedOptionModule (["vim" "session" "nvim-session-manager"] ++ oldPath) (["vim" "session" "nvim-session-manager" "setupOpts"] ++ newPath);
|
||||||
|
in [
|
||||||
|
(renameSetupOpt ["pathReplacer"] ["path_replacer"])
|
||||||
|
(renameSetupOpt ["colonReplacer"] ["colon_replacer"])
|
||||||
|
(renameSetupOpt ["autoloadMode"] ["autoload_mode"])
|
||||||
|
(renameSetupOpt ["maxPathLength"] ["max_path_length"])
|
||||||
|
(renameSetupOpt ["autoSave" "lastSession"] ["autosave_last_session"])
|
||||||
|
(renameSetupOpt ["autoSave" "ignoreNotNormal"] ["autosave_ignore_not_normal"])
|
||||||
|
(renameSetupOpt ["autoSave" "ignoreDirs"] ["autosave_ignore_dirs"])
|
||||||
|
(renameSetupOpt ["autoSave" "ignoreFiletypes"] ["autosave_ignore_filetypes"])
|
||||||
|
(renameSetupOpt ["autoSave" "ignoreBufTypes"] ["autosave_ignore_buftypes"])
|
||||||
|
(renameSetupOpt ["autoSave" "onlyInSession"] ["autosave_only_in_session"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.session.nvim-session-manager = {
|
options.vim.session.nvim-session-manager = {
|
||||||
enable = mkEnableOption "nvim-session-manager: manage sessions like folders in VSCode";
|
enable = mkEnableOption "nvim-session-manager: manage sessions like folders in VSCode";
|
||||||
|
|
||||||
|
@ -37,63 +53,63 @@ in {
|
||||||
description = "Whether or not we should use dressing.nvim to build a session picker UI";
|
description = "Whether or not we should use dressing.nvim to build a session picker UI";
|
||||||
};
|
};
|
||||||
|
|
||||||
pathReplacer = mkOption {
|
setupOpts = {
|
||||||
type = str;
|
path_replacer = mkOption {
|
||||||
|
type = types.str;
|
||||||
default = "__";
|
default = "__";
|
||||||
description = "The character to which the path separator will be replaced for session files";
|
description = "The character to which the path separator will be replaced for session files";
|
||||||
};
|
};
|
||||||
|
|
||||||
colonReplacer = mkOption {
|
colon_replacer = mkOption {
|
||||||
type = str;
|
type = types.str;
|
||||||
default = "++";
|
default = "++";
|
||||||
description = "The character to which the colon symbol will be replaced for session files";
|
description = "The character to which the colon symbol will be replaced for session files";
|
||||||
};
|
};
|
||||||
|
|
||||||
autoloadMode = mkOption {
|
autoload_mode = mkOption {
|
||||||
type = enum ["Disabled" "CurrentDir" "LastSession"];
|
type = types.enum ["Disabled" "CurrentDir" "LastSession"];
|
||||||
default = "LastSession";
|
default = "LastSession";
|
||||||
description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession";
|
description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession";
|
||||||
};
|
};
|
||||||
|
|
||||||
maxPathLength = mkOption {
|
max_path_length = mkOption {
|
||||||
type = nullOr int;
|
type = types.nullOr types.int;
|
||||||
default = 80;
|
default = 80;
|
||||||
description = "Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all";
|
description = "Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all";
|
||||||
};
|
};
|
||||||
|
|
||||||
autoSave = {
|
autosave_last_session = mkOption {
|
||||||
lastSession = mkOption {
|
type = types.bool;
|
||||||
type = bool;
|
|
||||||
default = true;
|
default = true;
|
||||||
description = "Automatically save last session on exit and on session switch";
|
description = "Automatically save last session on exit and on session switch";
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoreNotNormal = mkOption {
|
autosave_ignore_not_normal = mkOption {
|
||||||
type = bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed";
|
description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed";
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoreDirs = mkOption {
|
autosave_ignore_dirs = mkOption {
|
||||||
type = listOf str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "A list of directories where the session will not be autosaved";
|
description = "A list of directories where the session will not be autosaved";
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoreFiletypes = mkOption {
|
autosave_ignore_filetypes = mkOption {
|
||||||
type = listOf str;
|
type = types.listOf types.str;
|
||||||
default = ["gitcommit"];
|
default = ["gitcommit"];
|
||||||
description = "All buffers of these file types will be closed before the session is saved";
|
description = "All buffers of these file types will be closed before the session is saved";
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoreBufTypes = mkOption {
|
autosave_ignore_buftypes = mkOption {
|
||||||
type = listOf str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "All buffers of these bufer types will be closed before the session is saved";
|
description = "All buffers of these bufer types will be closed before the session is saved";
|
||||||
};
|
};
|
||||||
|
|
||||||
onlyInSession = mkOption {
|
autosave_only_in_session = mkOption {
|
||||||
type = bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Always autosaves session. If true, only autosaves after a session is active";
|
description = "Always autosaves session. If true, only autosaves after a session is active";
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,75 +3,73 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.trivial) boolToString;
|
||||||
inherit (lib.strings) optionalString;
|
|
||||||
inherit (lib.nvim.lua) luaTable listToLuaTable;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
|
||||||
cfg = config.vim.statusline.lualine;
|
cfg = config.vim.statusline.lualine;
|
||||||
breadcrumbsCfg = config.vim.ui.breadcrumbs;
|
breadcrumbsCfg = config.vim.ui.breadcrumbs;
|
||||||
in {
|
in {
|
||||||
config = (mkIf cfg.enable) {
|
config = mkMerge [
|
||||||
|
# TODO: move into nvim-tree file
|
||||||
|
(mkIf (config.vim.filetree.nvimTree.enable) {
|
||||||
|
vim.statusline.lualine.setupOpts = {
|
||||||
|
extensions = ["nvim-tree"];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") {
|
||||||
|
vim.statusline.lualine.setupOpts = {
|
||||||
|
# TODO: rewrite in new syntax
|
||||||
|
winbar.lualine_c = [
|
||||||
|
[
|
||||||
|
"navic"
|
||||||
|
(mkLuaInline "draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}")
|
||||||
|
]
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
"lualine"
|
"lualine"
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.lualine = entryAnywhere ''
|
vim.luaConfigRC.lualine = entryAnywhere ''
|
||||||
local lualine = require('lualine')
|
local lualine = require('lualine')
|
||||||
lualine.setup {
|
lualine.setup ${toLuaObject cfg.setupOpts}
|
||||||
options = {
|
|
||||||
icons_enabled = ${boolToString cfg.icons.enable},
|
|
||||||
theme = "${cfg.theme}",
|
|
||||||
component_separators = {"${cfg.componentSeparator.left}","${cfg.componentSeparator.right}"},
|
|
||||||
section_separators = {"${cfg.sectionSeparator.left}","${cfg.sectionSeparator.right}"},
|
|
||||||
disabled_filetypes = ${listToLuaTable cfg.disabledFiletypes},
|
|
||||||
always_divide_middle = ${boolToString cfg.alwaysDivideMiddle},
|
|
||||||
globalstatus = ${boolToString cfg.globalStatus},
|
|
||||||
ignore_focus = ${listToLuaTable cfg.ignoreFocus},
|
|
||||||
extensions = {${optionalString config.vim.filetree.nvimTree.enable "'nvim-tree'"}},
|
|
||||||
refresh = {
|
|
||||||
statusline = ${toString cfg.refresh.statusline},
|
|
||||||
tabline = ${toString cfg.refresh.tabline},
|
|
||||||
winbar = ${toString cfg.refresh.winbar},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- active sections
|
|
||||||
sections = {
|
|
||||||
lualine_a = ${luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)},
|
|
||||||
lualine_b = ${luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)},
|
|
||||||
lualine_c = ${luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)},
|
|
||||||
lualine_x = ${luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)},
|
|
||||||
lualine_y = ${luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)},
|
|
||||||
lualine_z = ${luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- inactive sections
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_a = ${luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)},
|
|
||||||
lualine_b = ${luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)},
|
|
||||||
lualine_c = ${luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)},
|
|
||||||
lualine_x = ${luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)},
|
|
||||||
lualine_y = ${luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)},
|
|
||||||
lualine_z = ${luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- tabline (currently unsupported)
|
|
||||||
tabline = {},
|
|
||||||
|
|
||||||
${optionalString (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") ''
|
|
||||||
-- enable winbar if nvim-navic is enabled
|
|
||||||
winbar = {
|
|
||||||
lualine_c = {
|
|
||||||
{
|
|
||||||
"navic",
|
|
||||||
draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
''}
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# this is for backwards-compatibility
|
||||||
|
vim.statusline.lualine.setupOpts = {
|
||||||
|
options = {
|
||||||
|
icons_enabled = cfg.icons.enable;
|
||||||
|
theme = cfg.theme;
|
||||||
|
component_separators = [cfg.componentSeparator.left cfg.componentSeparator.right];
|
||||||
|
section_separators = [cfg.sectionSeparator.left cfg.sectionSeparator.right];
|
||||||
|
globalstatus = cfg.globalStatus;
|
||||||
|
refresh = cfg.refresh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sections = {
|
||||||
|
lualine_a = builtins.map mkLuaInline (cfg.activeSection.a ++ cfg.extraActiveSection.a);
|
||||||
|
lualine_b = builtins.map mkLuaInline (cfg.activeSection.b ++ cfg.extraActiveSection.b);
|
||||||
|
lualine_c = builtins.map mkLuaInline (cfg.activeSection.c ++ cfg.extraActiveSection.c);
|
||||||
|
lualine_x = builtins.map mkLuaInline (cfg.activeSection.x ++ cfg.extraActiveSection.x);
|
||||||
|
lualine_y = builtins.map mkLuaInline (cfg.activeSection.y ++ cfg.extraActiveSection.y);
|
||||||
|
lualine_z = builtins.map mkLuaInline (cfg.activeSection.z ++ cfg.extraActiveSection.z);
|
||||||
|
};
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = builtins.map mkLuaInline (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a);
|
||||||
|
lualine_b = builtins.map mkLuaInline (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b);
|
||||||
|
lualine_c = builtins.map mkLuaInline (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c);
|
||||||
|
lualine_x = builtins.map mkLuaInline (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x);
|
||||||
|
lualine_y = builtins.map mkLuaInline (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y);
|
||||||
|
lualine_z = builtins.map mkLuaInline (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z);
|
||||||
|
};
|
||||||
|
# probably don't need this?
|
||||||
|
tabline = [];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) int bool str listOf enum;
|
inherit (lib.types) int bool str listOf enum;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
|
||||||
supported_themes = import ./supported_themes.nix;
|
supported_themes = import ./supported_themes.nix;
|
||||||
colorPuccin =
|
colorPuccin =
|
||||||
|
@ -15,6 +16,8 @@
|
||||||
else "none";
|
else "none";
|
||||||
in {
|
in {
|
||||||
options.vim.statusline.lualine = {
|
options.vim.statusline.lualine = {
|
||||||
|
setupOpts = mkPluginSetupOption "Lualine" {};
|
||||||
|
|
||||||
enable = mkEnableOption "lualine statusline plugin";
|
enable = mkEnableOption "lualine statusline plugin";
|
||||||
|
|
||||||
icons = {
|
icons = {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
inherit (lib.nvim.binds) mkBinding;
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter;
|
inherit (lib.nvim.dag) entryAnywhere entryAfter;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.terminal.toggleterm;
|
cfg = config.vim.terminal.toggleterm;
|
||||||
in {
|
in {
|
||||||
|
@ -23,24 +24,7 @@ in {
|
||||||
maps.normal = mkBinding cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal";
|
maps.normal = mkBinding cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal";
|
||||||
|
|
||||||
luaConfigRC.toggleterm = entryAnywhere ''
|
luaConfigRC.toggleterm = entryAnywhere ''
|
||||||
require("toggleterm").setup({
|
require("toggleterm").setup(${toLuaObject cfg.setupOpts})
|
||||||
open_mapping = null,
|
|
||||||
direction = '${toString cfg.direction}',
|
|
||||||
-- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it
|
|
||||||
size = function(term)
|
|
||||||
if term.direction == "horizontal" then
|
|
||||||
return 15
|
|
||||||
elseif term.direction == "vertical" then
|
|
||||||
return vim.o.columns * 0.4
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
winbar = {
|
|
||||||
enabled = '${toString cfg.enable_winbar}',
|
|
||||||
name_formatter = function(term) -- term: Terminal
|
|
||||||
return term.name
|
|
||||||
end
|
|
||||||
},
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,16 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
inherit (lib.types) nullOr str enum bool package;
|
inherit (lib.types) nullOr str enum bool package either int;
|
||||||
|
inherit (lib) mkRenamedOptionModule;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRenamedOptionModule ["vim" "terminal" "toggleterm" "direction"] ["vim" "terminal" "toggleterm" "setupOpts" "direction"])
|
||||||
|
(mkRenamedOptionModule ["vim" "terminal" "toggleterm" "enable_winbar"] ["vim" "terminal" "toggleterm" "setupOpts" "enable_winbar"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.terminal.toggleterm = {
|
options.vim.terminal.toggleterm = {
|
||||||
enable = mkEnableOption "toggleterm as a replacement to built-in terminal command";
|
enable = mkEnableOption "toggleterm as a replacement to built-in terminal command";
|
||||||
mappings = {
|
mappings = {
|
||||||
|
@ -17,6 +25,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "ToggleTerm" {
|
||||||
direction = mkOption {
|
direction = mkOption {
|
||||||
type = enum ["horizontal" "vertical" "tab" "float"];
|
type = enum ["horizontal" "vertical" "tab" "float"];
|
||||||
default = "horizontal";
|
default = "horizontal";
|
||||||
|
@ -29,6 +38,33 @@ in {
|
||||||
description = "Enable winbar";
|
description = "Enable winbar";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
size = mkOption {
|
||||||
|
type = either luaInline int;
|
||||||
|
description = "Number or lua function which is passed to the current terminal";
|
||||||
|
default = mkLuaInline ''
|
||||||
|
function(term)
|
||||||
|
if term.direction == "horizontal" then
|
||||||
|
return 15
|
||||||
|
elseif term.direction == "vertical" then
|
||||||
|
return vim.o.columns * 0.4
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
winbar = {
|
||||||
|
enabled = mkEnableOption "winbar in terminal" // {default = true;};
|
||||||
|
name_formatter = mkOption {
|
||||||
|
type = luaInline;
|
||||||
|
description = "Winbar formatter function.";
|
||||||
|
default = mkLuaInline ''
|
||||||
|
function(term)
|
||||||
|
return term.name
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
lazygit = {
|
lazygit = {
|
||||||
enable = mkEnableOption "LazyGit integration";
|
enable = mkEnableOption "LazyGit integration";
|
||||||
direction = mkOption {
|
direction = mkOption {
|
||||||
|
|
|
@ -18,7 +18,7 @@ in {
|
||||||
type = enum defaultStyles;
|
type = enum defaultStyles;
|
||||||
default = "rounded";
|
default = "rounded";
|
||||||
description = ''
|
description = ''
|
||||||
The global border style to use
|
The global border style to use.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,34 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) nullOr listOf enum bool str int;
|
inherit (lib.types) nullOr listOf enum bool str int;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
mkSimpleIconOption = default:
|
||||||
|
mkOption {
|
||||||
|
inherit default;
|
||||||
|
type = str;
|
||||||
|
description = "";
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renameSetupOpt = oldPath: newPath:
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(["vim" "ui" "breadcrumbs" "navbuddy"] ++ oldPath)
|
||||||
|
(["vim" "ui" "breadcrumbs" "navbuddy" "setupOpts"] ++ newPath);
|
||||||
|
in [
|
||||||
|
(renameSetupOpt ["useDefaultMappings"] ["use_default_mappings"])
|
||||||
|
(renameSetupOpt ["window"] ["window"])
|
||||||
|
(renameSetupOpt ["nodeMarkers"] ["node_markers"])
|
||||||
|
(renameSetupOpt ["lsp" "autoAttach"] ["lsp" "auto_attach"])
|
||||||
|
(renameSetupOpt ["lsp" "preference"] ["lsp" "preference"])
|
||||||
|
(renameSetupOpt ["sourceBuffer" "followNode"] ["source_buffer" "follow_node"])
|
||||||
|
(renameSetupOpt ["sourceBuffer" "highlight"] ["source_buffer" "highlight"])
|
||||||
|
(renameSetupOpt ["sourceBuffer" "reorient"] ["source_buffer" "reorient"])
|
||||||
|
(renameSetupOpt ["sourceBuffer" "scrolloff"] ["source_buffer" "scrolloff"])
|
||||||
|
# TODO: every option under icon is renamed to first letter capitalized
|
||||||
|
(renameSetupOpt ["icon"] ["icon"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.ui.breadcrumbs = {
|
options.vim.ui.breadcrumbs = {
|
||||||
enable = mkEnableOption "breadcrumbs";
|
enable = mkEnableOption "breadcrumbs";
|
||||||
source = mkOption {
|
source = mkOption {
|
||||||
|
@ -27,13 +54,6 @@ in {
|
||||||
navbuddy = {
|
navbuddy = {
|
||||||
enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic";
|
enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic";
|
||||||
|
|
||||||
# this option is interpreted as null if mkEnableOption is used, and therefore cannot be converted to a string in config.nix
|
|
||||||
useDefaultMappings = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
description = "use default Navbuddy keybindings (disables user-specified keybinds)";
|
|
||||||
};
|
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
close = mkOption {
|
close = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
|
@ -61,7 +81,7 @@ in {
|
||||||
|
|
||||||
children = mkOption {
|
children = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "h";
|
default = "l";
|
||||||
description = "keybinding to navigate to the child node";
|
description = "keybinding to navigate to the child node";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -180,6 +200,13 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "navbuddy" {
|
||||||
|
useDefaultMappings = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "use default Navbuddy keybindings (disables user-specified keybinds)";
|
||||||
|
};
|
||||||
|
|
||||||
window = {
|
window = {
|
||||||
# size = {}
|
# size = {}
|
||||||
# position = {}
|
# position = {}
|
||||||
|
@ -201,8 +228,8 @@ in {
|
||||||
# left section
|
# left section
|
||||||
left = {
|
left = {
|
||||||
/*
|
/*
|
||||||
size = {
|
size = mkOption {
|
||||||
type = with types; nullOr (intBetween 0 100);
|
type = nullOr (intBetween 0 100);
|
||||||
default = null;
|
default = null;
|
||||||
description = "size of the left section of Navbuddy UI in percentage (0-100)";
|
description = "size of the left section of Navbuddy UI in percentage (0-100)";
|
||||||
};
|
};
|
||||||
|
@ -220,7 +247,7 @@ in {
|
||||||
mid = {
|
mid = {
|
||||||
/*
|
/*
|
||||||
size = {
|
size = {
|
||||||
type = with types; nullOr (intBetween 0 100);
|
type = nullOr (intBetween 0 100);
|
||||||
default = null;
|
default = null;
|
||||||
description = "size of the left section of Navbuddy UI in percentage (0-100)";
|
description = "size of the left section of Navbuddy UI in percentage (0-100)";
|
||||||
};
|
};
|
||||||
|
@ -253,31 +280,17 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nodeMarkers = {
|
node_markers = {
|
||||||
enable = mkEnableOption "node markers";
|
enable = mkEnableOption "node markers";
|
||||||
icons = {
|
icons = {
|
||||||
leaf = mkOption {
|
leaf = mkSimpleIconOption " ";
|
||||||
type = str;
|
leaf_selected = mkSimpleIconOption " → ";
|
||||||
default = " ";
|
branch = mkSimpleIconOption " ";
|
||||||
description = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
leafSelected = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " → ";
|
|
||||||
description = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
branch = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
autoAttach = mkOption {
|
auto_attach = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Whether to attach to LSP server manually";
|
description = "Whether to attach to LSP server manually";
|
||||||
|
@ -290,7 +303,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sourceBuffer = {
|
source_buffer = {
|
||||||
followNode = mkOption {
|
followNode = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -316,163 +329,33 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# there probably is a better way to do this
|
|
||||||
# alas, I am not a nix wizard
|
|
||||||
icons = {
|
icons = {
|
||||||
file = mkOption {
|
File = mkSimpleIconOption " ";
|
||||||
type = str;
|
Module = mkSimpleIconOption " ";
|
||||||
default = " ";
|
Namespace = mkSimpleIconOption " ";
|
||||||
description = "File icon";
|
Package = mkSimpleIconOption " ";
|
||||||
};
|
Class = mkSimpleIconOption " ";
|
||||||
|
Property = mkSimpleIconOption " ";
|
||||||
module = mkOption {
|
Field = mkSimpleIconOption " ";
|
||||||
type = str;
|
Constructor = mkSimpleIconOption " ";
|
||||||
default = " ";
|
Enum = mkSimpleIconOption "";
|
||||||
description = "Module icon";
|
Interface = mkSimpleIconOption "";
|
||||||
};
|
Function = mkSimpleIconOption " ";
|
||||||
|
Variable = mkSimpleIconOption " ";
|
||||||
namespace = mkOption {
|
Constant = mkSimpleIconOption " ";
|
||||||
type = str;
|
String = mkSimpleIconOption " ";
|
||||||
default = " ";
|
Number = mkSimpleIconOption " ";
|
||||||
description = "Namespace icon";
|
Boolean = mkSimpleIconOption "◩ ";
|
||||||
};
|
Array = mkSimpleIconOption " ";
|
||||||
|
Object = mkSimpleIconOption " ";
|
||||||
package = mkOption {
|
Method = mkSimpleIconOption " ";
|
||||||
type = str;
|
Key = mkSimpleIconOption " ";
|
||||||
default = " ";
|
Null = mkSimpleIconOption " ";
|
||||||
description = "Package icon";
|
EnumMember = mkSimpleIconOption " ";
|
||||||
};
|
Struct = mkSimpleIconOption " ";
|
||||||
|
Event = mkSimpleIconOption " ";
|
||||||
class = mkOption {
|
Operator = mkSimpleIconOption " ";
|
||||||
type = str;
|
TypeParameter = mkSimpleIconOption " ";
|
||||||
default = " ";
|
|
||||||
description = "Class icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
property = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Property icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
field = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Field icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Constructor icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
enum = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "";
|
|
||||||
description = "Enum icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
interface = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "";
|
|
||||||
description = "Interface icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
function = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Function icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
variable = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Variable icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
constant = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Constant icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
string = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "String icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
number = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Number icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
boolean = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Boolean icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
array = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Array icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
object = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Object icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
method = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Method icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
key = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Key icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
null = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Null icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
enumMember = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Enum member icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
struct = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Struct icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
event = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Event icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
operator = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Operator icon";
|
|
||||||
};
|
|
||||||
|
|
||||||
typeParameter = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = " ";
|
|
||||||
description = "Type parameter icon";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,15 +3,14 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.lists) optionals;
|
||||||
inherit (lib.nvim.lua) nullString;
|
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
|
||||||
cfg = config.vim.ui.breadcrumbs;
|
cfg = config.vim.ui.breadcrumbs;
|
||||||
nbcfg = cfg.navbuddy;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins =
|
vim.startPlugins =
|
||||||
|
@ -30,6 +29,55 @@ in {
|
||||||
"nvim-navic"
|
"nvim-navic"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
vim.ui.breadcrumbs.navbuddy.setupOpts = {
|
||||||
|
mappings = {
|
||||||
|
${cfg.navbuddy.mappings.close} = mkLuaInline "actions.close()";
|
||||||
|
${cfg.navbuddy.mappings.nextSibling} = mkLuaInline "actions.next_sibling()";
|
||||||
|
${cfg.navbuddy.mappings.previousSibling} = mkLuaInline "actions.previous_sibling()";
|
||||||
|
${cfg.navbuddy.mappings.parent} = mkLuaInline "actions.parent()";
|
||||||
|
${cfg.navbuddy.mappings.children} = mkLuaInline "actions.children()";
|
||||||
|
${cfg.navbuddy.mappings.root} = mkLuaInline "actions.root()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.visualName} = mkLuaInline "actions.visual_name()";
|
||||||
|
${cfg.navbuddy.mappings.visualScope} = mkLuaInline "actions.visual_scope()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.yankName} = mkLuaInline "actions.yank_name()";
|
||||||
|
${cfg.navbuddy.mappings.yankScope} = mkLuaInline "actions.yank_scope()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.insertName} = mkLuaInline "actions.insert_name()";
|
||||||
|
${cfg.navbuddy.mappings.insertScope} = mkLuaInline "actions.insert_scope()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.appendName} = mkLuaInline "actions.append_name()";
|
||||||
|
${cfg.navbuddy.mappings.appendScope} = mkLuaInline "actions.append_scope()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.rename} = mkLuaInline "actions.rename()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.delete} = mkLuaInline "actions.delete()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.foldCreate} = mkLuaInline "actions.fold_create()";
|
||||||
|
${cfg.navbuddy.mappings.foldDelete} = mkLuaInline "actions.fold_delete()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.comment} = mkLuaInline "actions.comment()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.select} = mkLuaInline "actions.select()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.moveDown} = mkLuaInline "actions.move_down()";
|
||||||
|
${cfg.navbuddy.mappings.moveUp} = mkLuaInline "actions.move_up()";
|
||||||
|
|
||||||
|
${cfg.navbuddy.mappings.telescope} = mkLuaInline ''
|
||||||
|
actions.telescope({
|
||||||
|
layout_strategy = "horizontal",
|
||||||
|
layout_config = {
|
||||||
|
height = 0.60,
|
||||||
|
width = 0.75,
|
||||||
|
prompt_position = "top",
|
||||||
|
preview_width = 0.50
|
||||||
|
},
|
||||||
|
})'';
|
||||||
|
${cfg.navbuddy.mappings.help} = mkLuaInline "actions.help()";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
vim.luaConfigRC.breadcrumbs = entryAfter ["lspconfig"] ''
|
vim.luaConfigRC.breadcrumbs = entryAfter ["lspconfig"] ''
|
||||||
|
|
||||||
${optionalString (cfg.source == "nvim-navic") ''
|
${optionalString (cfg.source == "nvim-navic") ''
|
||||||
|
@ -42,128 +90,7 @@ in {
|
||||||
${optionalString cfg.navbuddy.enable ''
|
${optionalString cfg.navbuddy.enable ''
|
||||||
local navbuddy = require("nvim-navbuddy")
|
local navbuddy = require("nvim-navbuddy")
|
||||||
local actions = require("nvim-navbuddy.actions")
|
local actions = require("nvim-navbuddy.actions")
|
||||||
navbuddy.setup {
|
navbuddy.setup ${toLuaObject cfg.navbuddy.setupOpts}
|
||||||
window = {
|
|
||||||
border = "${nbcfg.window.border}", -- "rounded", "double", "solid", "none"
|
|
||||||
size = "60%",
|
|
||||||
position = "50%",
|
|
||||||
scrolloff = ${(nullString nbcfg.window.scrolloff)},
|
|
||||||
sections = {
|
|
||||||
left = {
|
|
||||||
size = "20%",
|
|
||||||
border = ${(nullString nbcfg.window.sections.left.border)},
|
|
||||||
},
|
|
||||||
|
|
||||||
mid = {
|
|
||||||
size = "40%",
|
|
||||||
border = ${(nullString nbcfg.window.sections.mid.border)},
|
|
||||||
},
|
|
||||||
|
|
||||||
right = {
|
|
||||||
border = ${(nullString nbcfg.window.sections.right.border)},
|
|
||||||
preview = "leaf",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
node_markers = {
|
|
||||||
enabled = ${boolToString nbcfg.nodeMarkers.enable},
|
|
||||||
icons = {
|
|
||||||
leaf = "${nbcfg.nodeMarkers.icons.leaf}",
|
|
||||||
leaf_selected = "${nbcfg.nodeMarkers.icons.leafSelected}",
|
|
||||||
branch = "${nbcfg.nodeMarkers.icons.branch}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
lsp = {
|
|
||||||
auto_attach = ${boolToString nbcfg.lsp.autoAttach},
|
|
||||||
-- preference = nil, -- TODO: convert list to lua table if not null
|
|
||||||
},
|
|
||||||
|
|
||||||
source_buffer = {
|
|
||||||
follow_node = ${boolToString nbcfg.sourceBuffer.followNode},
|
|
||||||
highlight = ${boolToString nbcfg.sourceBuffer.highlight},
|
|
||||||
reorient = "${nbcfg.sourceBuffer.reorient}",
|
|
||||||
scrolloff = ${nullString nbcfg.sourceBuffer.scrolloff}
|
|
||||||
},
|
|
||||||
|
|
||||||
icons = {
|
|
||||||
File = "${cfg.navbuddy.icons.file}",
|
|
||||||
Module = "${cfg.navbuddy.icons.module}",
|
|
||||||
Namespace = "${cfg.navbuddy.icons.namespace}",
|
|
||||||
Package = "${cfg.navbuddy.icons.package}",
|
|
||||||
Class = "${cfg.navbuddy.icons.class}",
|
|
||||||
Method = "${cfg.navbuddy.icons.method}",
|
|
||||||
Property = "${cfg.navbuddy.icons.property}",
|
|
||||||
Field = "${cfg.navbuddy.icons.field}",
|
|
||||||
Constructor = "${cfg.navbuddy.icons.constructor}",
|
|
||||||
Enum = "${cfg.navbuddy.icons.enum}",
|
|
||||||
Interface = "${cfg.navbuddy.icons.interface}",
|
|
||||||
Function = "${cfg.navbuddy.icons.function}",
|
|
||||||
Variable = "${cfg.navbuddy.icons.variable}",
|
|
||||||
Constant = "${cfg.navbuddy.icons.constant}",
|
|
||||||
String = "${cfg.navbuddy.icons.string}",
|
|
||||||
Number = "${cfg.navbuddy.icons.number}",
|
|
||||||
Boolean = "${cfg.navbuddy.icons.boolean}",
|
|
||||||
Array = "${cfg.navbuddy.icons.array}",
|
|
||||||
Object = "${cfg.navbuddy.icons.object}",
|
|
||||||
Key = "${cfg.navbuddy.icons.key}",
|
|
||||||
Null = "${cfg.navbuddy.icons.null}",
|
|
||||||
EnumMember = "${cfg.navbuddy.icons.enumMember}",
|
|
||||||
Struct = "${cfg.navbuddy.icons.struct}",
|
|
||||||
Event = "${cfg.navbuddy.icons.event}",
|
|
||||||
Operator = "${cfg.navbuddy.icons.operator}",
|
|
||||||
TypeParameter = "${cfg.navbuddy.icons.typeParameter}"
|
|
||||||
},
|
|
||||||
|
|
||||||
-- make those configurable
|
|
||||||
use_default_mappings = ${boolToString cfg.navbuddy.useDefaultMappings},
|
|
||||||
mappings = {
|
|
||||||
["${cfg.navbuddy.mappings.close}"] = actions.close(),
|
|
||||||
["${cfg.navbuddy.mappings.nextSibling}"] = actions.next_sibling(),
|
|
||||||
["${cfg.navbuddy.mappings.previousSibling}"] = actions.previous_sibling(),
|
|
||||||
["${cfg.navbuddy.mappings.close}"] = actions.parent(),
|
|
||||||
["${cfg.navbuddy.mappings.children}"] = actions.children(),
|
|
||||||
["${cfg.navbuddy.mappings.root}"] = actions.root(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.visualName}"] = actions.visual_name(),
|
|
||||||
["${cfg.navbuddy.mappings.visualScope}"] = actions.visual_scope(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.yankName}"] = actions.yank_name(),
|
|
||||||
["${cfg.navbuddy.mappings.yankScope}"] = actions.yank_scope(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.insertName}"] = actions.insert_name(),
|
|
||||||
["${cfg.navbuddy.mappings.insertScope}"] = actions.insert_scope(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.appendName}"] = actions.append_name(),
|
|
||||||
["${cfg.navbuddy.mappings.appendScope}"] = actions.append_scope(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.rename}"] = actions.rename(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.delete}"] = actions.delete(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.foldCreate}"] = actions.fold_create(),
|
|
||||||
["${cfg.navbuddy.mappings.foldDelete}"] = actions.fold_delete(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.comment}"] = actions.comment(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.select}"] = actions.select(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.moveDown}"] = actions.move_down(),
|
|
||||||
["${cfg.navbuddy.mappings.moveUp}"] = actions.move_up(),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.telescope}"] = actions.telescope({
|
|
||||||
layout_strategy = "horizontal",
|
|
||||||
layout_config = {
|
|
||||||
height = 0.60,
|
|
||||||
width = 0.75,
|
|
||||||
prompt_position = "top",
|
|
||||||
preview_width = 0.50
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
|
|
||||||
["${cfg.navbuddy.mappings.help}"] = actions.help(), -- Open mappings help window
|
|
||||||
},
|
|
||||||
}
|
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) attrsOf attrs bool enum;
|
inherit (lib.types) attrsOf attrs bool enum;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRenamedOptionModule ["vim" "ui" "colorizer" "options"] ["vim" "ui" "colorizer" "setupOpts" "user_default_options"])
|
||||||
|
(mkRenamedOptionModule ["vim" "ui" "colorizer" "filetypes"] ["vim" "ui" "colorizer" "setupOpts" "filetypes"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.ui.colorizer = {
|
options.vim.ui.colorizer = {
|
||||||
enable = mkEnableOption "color highlighting [nvim-colorizer.lua]";
|
enable = mkEnableOption "color highlighting [nvim-colorizer.lua]";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "nvim-colorizer" {
|
||||||
filetypes = mkOption {
|
filetypes = mkOption {
|
||||||
type = attrsOf attrs;
|
type = attrsOf attrs;
|
||||||
default = {
|
default = {
|
||||||
|
@ -14,9 +26,7 @@ in {
|
||||||
description = "Filetypes to highlight on";
|
description = "Filetypes to highlight on";
|
||||||
};
|
};
|
||||||
|
|
||||||
options = {
|
user_default_options = {
|
||||||
alwaysUpdate = mkEnableOption "updating color values even if buffer is not focused, like when using cmp_menu, cmp_docs";
|
|
||||||
|
|
||||||
rgb = mkOption {
|
rgb = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -53,16 +63,42 @@ in {
|
||||||
description = "CSS hsl() and hsla() functions";
|
description = "CSS hsl() and hsla() functions";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
css = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB";
|
||||||
|
};
|
||||||
|
|
||||||
|
css_fn = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable all CSS *functions*: rgb_fn, hsl_fn";
|
||||||
|
};
|
||||||
|
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
type = enum ["foreground" "background"];
|
type = enum ["foreground" "background"];
|
||||||
default = "background";
|
default = "background";
|
||||||
description = "Set the display mode";
|
description = "Set the display mode";
|
||||||
};
|
};
|
||||||
|
|
||||||
tailwind = mkEnableOption "tailwind colors";
|
tailwind = mkOption {
|
||||||
sass = mkEnableOption "sass colors";
|
type = bool;
|
||||||
css = mkEnableOption "all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB";
|
default = false;
|
||||||
css_fn = mkEnableOption "all CSS *functions*: rgb_fn, hsl_fn";
|
description = "Enable tailwind colors";
|
||||||
|
};
|
||||||
|
|
||||||
|
sass = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable sass colors";
|
||||||
|
};
|
||||||
|
|
||||||
|
alwaysUpdate = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Update color values even if buffer is not focused, like when using cmp_menu, cmp_docs";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.nvim.lua) attrsetToLuaTable;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.ui.colorizer;
|
cfg = config.vim.ui.colorizer;
|
||||||
in {
|
in {
|
||||||
|
@ -16,23 +15,7 @@ in {
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.colorizer = entryAnywhere ''
|
vim.luaConfigRC.colorizer = entryAnywhere ''
|
||||||
require('colorizer').setup({
|
require('colorizer').setup(${toLuaObject cfg.setupOpts})
|
||||||
filetypes = ${attrsetToLuaTable cfg.filetypes},
|
|
||||||
user_default_options = {
|
|
||||||
RGB = ${boolToString cfg.options.rgb};
|
|
||||||
RRGGBB = ${boolToString cfg.options.rrggbb};
|
|
||||||
RRGGBBAA = ${boolToString cfg.options.rrggbbaa};
|
|
||||||
names = ${boolToString cfg.options.names};
|
|
||||||
rgb_fn = ${boolToString cfg.options.rgb_fn};
|
|
||||||
hsl_fn = ${boolToString cfg.options.hsl_fn};
|
|
||||||
css = ${boolToString cfg.options.css};
|
|
||||||
css_fn = ${boolToString cfg.options.css_fn};
|
|
||||||
mode = '${toString cfg.options.mode}';
|
|
||||||
tailwind = ${boolToString cfg.options.tailwind};
|
|
||||||
sass = ${boolToString cfg.options.tailwind};
|
|
||||||
always_update = ${boolToString cfg.options.alwaysUpdate};
|
|
||||||
}
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.ui.modes-nvim;
|
cfg = config.vim.ui.modes-nvim;
|
||||||
in {
|
in {
|
||||||
|
@ -15,18 +15,7 @@ in {
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.modes-nvim = entryAnywhere ''
|
vim.luaConfigRC.modes-nvim = entryAnywhere ''
|
||||||
require('modes').setup({
|
require('modes').setup(${toLuaObject cfg.setupOpts})
|
||||||
set_cursorline = ${boolToString cfg.setCursorline},
|
|
||||||
line_opacity = {
|
|
||||||
visual = 0,
|
|
||||||
},
|
|
||||||
colors = {
|
|
||||||
copy = "${toString cfg.colors.copy}",
|
|
||||||
delete = "${toString cfg.colors.delete}",
|
|
||||||
insert = "${toString cfg.colors.insert}",
|
|
||||||
visual = "${toString cfg.colors.visual}",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,42 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) str;
|
inherit (lib.types) bool str float;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.ui.modes-nvim = {
|
options.vim.ui.modes-nvim = {
|
||||||
enable = mkEnableOption "prismatic line decorations [modes.nvim]";
|
enable = mkEnableOption "modes.nvim's prismatic line decorations";
|
||||||
setCursorline = mkEnableOption "colored cursorline on current line";
|
|
||||||
colors = {
|
setupOpts = {
|
||||||
|
setCursorline = mkOption {
|
||||||
|
type = bool;
|
||||||
|
description = "Set a colored cursorline on current line";
|
||||||
|
default = false; # looks ugly, disabled by default
|
||||||
|
};
|
||||||
|
|
||||||
|
line_opacity = {
|
||||||
|
visual = mkOption {
|
||||||
|
type = float;
|
||||||
|
description = "Set opacity for cursorline and number background";
|
||||||
|
default = 0.0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
colors = mkPluginSetupOption "modes.nvim" {
|
||||||
copy = mkOption {
|
copy = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "The #RRGGBB color code for the visual mode highlights";
|
description = "The #RRGGBB color code for the visual mode highlights";
|
||||||
default = "#f5c359";
|
default = "#f5c359";
|
||||||
};
|
};
|
||||||
|
|
||||||
delete = mkOption {
|
delete = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "The #RRGGBB color code for the visual mode highlights";
|
description = "The #RRGGBB color code for the visual mode highlights";
|
||||||
default = "#c75c6a";
|
default = "#c75c6a";
|
||||||
};
|
};
|
||||||
|
|
||||||
insert = mkOption {
|
insert = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "The #RRGGBB color code for the visual mode highlights";
|
description = "The #RRGGBB color code for the visual mode highlights";
|
||||||
default = "#78ccc5";
|
default = "#78ccc5";
|
||||||
};
|
};
|
||||||
|
|
||||||
visual = mkOption {
|
visual = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "The #RRGGBB color code for the visual mode highlights";
|
description = "The #RRGGBB color code for the visual mode highlights";
|
||||||
|
@ -31,4 +44,5 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
in {
|
in {
|
||||||
options.vim.ui.noice = {
|
options.vim.ui.noice = {
|
||||||
enable = mkEnableOption "UI modification library [noice.nvim]";
|
enable = mkEnableOption "noice.nvim UI modification library";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.notify.nvim-notify;
|
cfg = config.vim.notify.nvim-notify;
|
||||||
in {
|
in {
|
||||||
|
@ -13,19 +14,7 @@ in {
|
||||||
startPlugins = ["nvim-notify"];
|
startPlugins = ["nvim-notify"];
|
||||||
|
|
||||||
luaConfigRC.nvim-notify = entryAnywhere ''
|
luaConfigRC.nvim-notify = entryAnywhere ''
|
||||||
require('notify').setup {
|
require('notify').setup(${toLuaObject cfg.setupOpts})
|
||||||
stages = "${cfg.stages}",
|
|
||||||
timeout = ${toString cfg.timeout},
|
|
||||||
background_colour = "${cfg.background_colour}",
|
|
||||||
position = "${cfg.position}",
|
|
||||||
icons = {
|
|
||||||
ERROR = "${cfg.icons.ERROR}",
|
|
||||||
WARN = "${cfg.icons.WARN}",
|
|
||||||
INFO = "${cfg.icons.INFO}",
|
|
||||||
DEBUG = "${cfg.icons.DEBUG}",
|
|
||||||
TRACE = "${cfg.icons.TRACE}",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- required to fix offset_encoding errors
|
-- required to fix offset_encoding errors
|
||||||
local notify = vim.notify
|
local notify = vim.notify
|
||||||
|
|
|
@ -1,9 +1,30 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
config,
|
||||||
inherit (lib.types) enum int str attrsOf;
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.types) int str enum attrsOf;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renamedSetupOpt = name:
|
||||||
|
mkRenamedOptionModule
|
||||||
|
["vim" "notify" "nvim-notify" name]
|
||||||
|
["vim" "notify" "nvim-notify" "setupOpts" name];
|
||||||
|
in [
|
||||||
|
(renamedSetupOpt "stages")
|
||||||
|
(renamedSetupOpt "timeout")
|
||||||
|
(renamedSetupOpt "background_colour")
|
||||||
|
(renamedSetupOpt "position")
|
||||||
|
(renamedSetupOpt "icons")
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.notify.nvim-notify = {
|
options.vim.notify.nvim-notify = {
|
||||||
enable = mkEnableOption "nvim-notify notifications";
|
enable = mkEnableOption "nvim-notify notifications";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "nvim-notify" {
|
||||||
stages = mkOption {
|
stages = mkOption {
|
||||||
type = enum ["fade_in_slide_out" "fade_in" "slide_out" "none"];
|
type = enum ["fade_in_slide_out" "fade_in" "slide_out" "none"];
|
||||||
default = "fade_in_slide_out";
|
default = "fade_in_slide_out";
|
||||||
|
@ -40,4 +61,5 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) concatStringsSep;
|
|
||||||
inherit (lib.nvim.lua) attrsetToLuaTable;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.ui.smartcolumn;
|
cfg = config.vim.ui.smartcolumn;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -14,13 +14,7 @@ in {
|
||||||
startPlugins = ["smartcolumn"];
|
startPlugins = ["smartcolumn"];
|
||||||
|
|
||||||
luaConfigRC.smartcolumn = entryAnywhere ''
|
luaConfigRC.smartcolumn = entryAnywhere ''
|
||||||
require("smartcolumn").setup({
|
require("smartcolumn").setup(${toLuaObject cfg.setupOpts})
|
||||||
colorcolumn = "${toString cfg.showColumnAt}",
|
|
||||||
-- { "help", "text", "markdown", "NvimTree", "alpha"},
|
|
||||||
disabled_filetypes = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.disabledFiletypes)} },
|
|
||||||
custom_colorcolumn = ${attrsetToLuaTable cfg.columnAt.languages},
|
|
||||||
scope = "file",
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,31 +1,41 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf either nullOr listOf int str submodule;
|
inherit (lib.types) nullOr int str attrsOf either listOf;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renamedSetupOpt = oldPath: newPath:
|
||||||
|
mkRenamedOptionModule (["vim" "ui" "smartcolumn"] ++ oldPath) (["vim" "ui" "smartcolumn" "setupOpts"] ++ newPath);
|
||||||
|
in [
|
||||||
|
(renamedSetupOpt ["disabledFiletypes"] ["disabled_filetypes"])
|
||||||
|
(renamedSetupOpt ["showColumnAt"] ["colorcolumn"])
|
||||||
|
(renamedSetupOpt ["columnAt" "languages"] ["custom_colorcolumn"])
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.ui.smartcolumn = {
|
options.vim.ui.smartcolumn = {
|
||||||
enable = mkEnableOption "line length indicator";
|
enable = mkEnableOption "line length indicator";
|
||||||
|
|
||||||
showColumnAt = mkOption {
|
setupOpts = mkPluginSetupOption "smartcolumn.nvim" {
|
||||||
type = nullOr int;
|
colorcolumn = mkOption {
|
||||||
default = 120;
|
type = nullOr (either str (listOf str));
|
||||||
|
default = "120";
|
||||||
description = "The position at which the column will be displayed. Set to null to disable";
|
description = "The position at which the column will be displayed. Set to null to disable";
|
||||||
};
|
};
|
||||||
|
|
||||||
disabledFiletypes = mkOption {
|
disabled_filetypes = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = ["help" "text" "markdown" "NvimTree" "alpha"];
|
default = ["help" "text" "markdown" "NvimTree" "alpha"];
|
||||||
description = "The filetypes smartcolumn will be disabled for.";
|
description = "The filetypes smartcolumn will be disabled for.";
|
||||||
};
|
};
|
||||||
|
|
||||||
columnAt = {
|
custom_colorcolumn = mkOption {
|
||||||
languages = mkOption {
|
|
||||||
description = "The position at which smart column should be displayed for each individual buffer type";
|
description = "The position at which smart column should be displayed for each individual buffer type";
|
||||||
type = submodule {
|
type = attrsOf (either int (listOf int));
|
||||||
freeformType = attrsOf (either int (listOf int));
|
default = {};
|
||||||
};
|
|
||||||
|
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
vim.ui.smartcolumn.columnAt.languages = {
|
vim.ui.smartcolumn.setupOpts.custom_colorcolumn = {
|
||||||
nix = 110;
|
nix = 110;
|
||||||
ruby = 120;
|
ruby = 120;
|
||||||
java = 130;
|
java = 130;
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
# TODO: move this to its own module
|
# TODO: move this to its own module
|
||||||
inherit (lib) pushDownDefault;
|
inherit (lib) pushDownDefault;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.telescope;
|
cfg = config.vim.telescope;
|
||||||
self = import ./telescope.nix {inherit lib;};
|
self = import ./telescope.nix {inherit pkgs lib;};
|
||||||
mappingDefinitions = self.options.vim.telescope.mappings;
|
mappingDefinitions = self.options.vim.telescope.mappings;
|
||||||
|
|
||||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||||
|
@ -66,52 +67,7 @@ in {
|
||||||
|
|
||||||
vim.luaConfigRC.telescope = entryAnywhere ''
|
vim.luaConfigRC.telescope = entryAnywhere ''
|
||||||
local telescope = require('telescope')
|
local telescope = require('telescope')
|
||||||
telescope.setup {
|
telescope.setup(${toLuaObject cfg.setupOpts})
|
||||||
defaults = {
|
|
||||||
vimgrep_arguments = {
|
|
||||||
"${pkgs.ripgrep}/bin/rg",
|
|
||||||
"--color=never",
|
|
||||||
"--no-heading",
|
|
||||||
"--with-filename",
|
|
||||||
"--line-number",
|
|
||||||
"--column",
|
|
||||||
"--smart-case",
|
|
||||||
"--hidden",
|
|
||||||
"--no-ignore",
|
|
||||||
},
|
|
||||||
pickers = {
|
|
||||||
find_command = {
|
|
||||||
"${pkgs.fd}/bin/fd",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
prompt_prefix = " ",
|
|
||||||
selection_caret = " ",
|
|
||||||
entry_prefix = " ",
|
|
||||||
initial_mode = "insert",
|
|
||||||
selection_strategy = "reset",
|
|
||||||
sorting_strategy = "ascending",
|
|
||||||
layout_strategy = "horizontal",
|
|
||||||
layout_config = {
|
|
||||||
horizontal = {
|
|
||||||
prompt_position = "top",
|
|
||||||
preview_width = 0.55,
|
|
||||||
results_width = 0.8,
|
|
||||||
},
|
|
||||||
vertical = {
|
|
||||||
mirror = false,
|
|
||||||
},
|
|
||||||
width = 0.8,
|
|
||||||
height = 0.8,
|
|
||||||
preview_cutoff = 120,
|
|
||||||
},
|
|
||||||
file_ignore_patterns = { "node_modules", ".git/", "dist/", "build/", "target/", "result/" }, -- TODO: make this configurable
|
|
||||||
color_devicons = true,
|
|
||||||
path_display = { "absolute" },
|
|
||||||
set_env = { ["COLORTERM"] = "truecolor" },
|
|
||||||
winblend = 0,
|
|
||||||
border = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
${
|
${
|
||||||
if config.vim.ui.noice.enable
|
if config.vim.ui.noice.enable
|
||||||
|
|
|
@ -1,6 +1,152 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkEnableOption;
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) int str listOf float bool either enum submodule attrsOf;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
|
setupOptions = {
|
||||||
|
defaults = {
|
||||||
|
vimgrep_arguments = mkOption {
|
||||||
|
description = ''
|
||||||
|
Defines the command that will be used for `live_grep` and `grep_string` pickers.
|
||||||
|
Make sure that color is set to `never` because telescope does not yet interpret color codes.
|
||||||
|
'';
|
||||||
|
type = listOf str;
|
||||||
|
default = [
|
||||||
|
"${pkgs.ripgrep}/bin/rg"
|
||||||
|
"--color=never"
|
||||||
|
"--no-heading"
|
||||||
|
"--with-filename"
|
||||||
|
"--line-number"
|
||||||
|
"--column"
|
||||||
|
"--smart-case"
|
||||||
|
"--hidden"
|
||||||
|
"--no-ignore"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
pickers.find_command = mkOption {
|
||||||
|
description = "cmd to use for finding files";
|
||||||
|
type = either (listOf str) luaInline;
|
||||||
|
default = ["${pkgs.fd}/bin/fd"];
|
||||||
|
};
|
||||||
|
prompt_prefix = mkOption {
|
||||||
|
description = "Shown in front of Telescope's prompt";
|
||||||
|
type = str;
|
||||||
|
default = " ";
|
||||||
|
};
|
||||||
|
selection_caret = mkOption {
|
||||||
|
description = "Character(s) to show in front of the current selection";
|
||||||
|
type = str;
|
||||||
|
default = " ";
|
||||||
|
};
|
||||||
|
entry_prefix = mkOption {
|
||||||
|
description = "Prefix in front of each result entry. Current selection not included.";
|
||||||
|
type = str;
|
||||||
|
default = " ";
|
||||||
|
};
|
||||||
|
initial_mode = mkOption {
|
||||||
|
description = "Determines in which mode telescope starts.";
|
||||||
|
type = enum ["insert" "normal"];
|
||||||
|
default = "insert";
|
||||||
|
};
|
||||||
|
selection_strategy = mkOption {
|
||||||
|
description = "Determines how the cursor acts after each sort iteration.";
|
||||||
|
type = enum ["reset" "follow" "row" "closest" "none"];
|
||||||
|
default = "reset";
|
||||||
|
};
|
||||||
|
sorting_strategy = mkOption {
|
||||||
|
description = ''Determines the direction "better" results are sorted towards.'';
|
||||||
|
type = enum ["descending" "ascending"];
|
||||||
|
default = "ascending";
|
||||||
|
};
|
||||||
|
layout_strategy = mkOption {
|
||||||
|
description = "Determines the default layout of Telescope pickers. See `:help telescope.layout`.";
|
||||||
|
type = str;
|
||||||
|
default = "horizontal";
|
||||||
|
};
|
||||||
|
layout_config = mkOption {
|
||||||
|
description = ''
|
||||||
|
Determines the default configuration values for layout strategies.
|
||||||
|
See telescope.layout for details of the configurations options for
|
||||||
|
each strategy.
|
||||||
|
'';
|
||||||
|
default = {};
|
||||||
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
horizontal = {
|
||||||
|
prompt_position = mkOption {
|
||||||
|
description = "";
|
||||||
|
type = str;
|
||||||
|
default = "top";
|
||||||
|
};
|
||||||
|
preview_width = mkOption {
|
||||||
|
description = "";
|
||||||
|
type = float;
|
||||||
|
default = 0.55;
|
||||||
|
};
|
||||||
|
results_width = mkOption {
|
||||||
|
description = "";
|
||||||
|
type = float;
|
||||||
|
default = 0.8;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
vertical = {
|
||||||
|
mirror = mkOption {
|
||||||
|
description = "";
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
width = mkOption {
|
||||||
|
description = "";
|
||||||
|
type = float;
|
||||||
|
default = 0.8;
|
||||||
|
};
|
||||||
|
height = mkOption {
|
||||||
|
description = "";
|
||||||
|
type = float;
|
||||||
|
default = 0.8;
|
||||||
|
};
|
||||||
|
preview_cutoff = mkOption {
|
||||||
|
description = "";
|
||||||
|
type = int;
|
||||||
|
default = 120;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
file_ignore_patterns = mkOption {
|
||||||
|
description = "A table of lua regex that define the files that should be ignored.";
|
||||||
|
type = listOf str;
|
||||||
|
default = ["node_modules" ".git/" "dist/" "build/" "target/" "result/"];
|
||||||
|
};
|
||||||
|
color_devicons = mkOption {
|
||||||
|
description = "Boolean if devicons should be enabled or not.";
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
path_display = mkOption {
|
||||||
|
description = "Determines how file paths are displayed.";
|
||||||
|
type = listOf (enum ["hidden" "tail" "absolute" "smart" "shorten" "truncate"]);
|
||||||
|
default = ["absolute"];
|
||||||
|
};
|
||||||
|
set_env = mkOption {
|
||||||
|
description = "Set an envrionment for term_previewer";
|
||||||
|
type = attrsOf str;
|
||||||
|
default = {
|
||||||
|
COLORTERM = "truecolor";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
winblend = mkOption {
|
||||||
|
description = "pseudo-transparency of keymap hints floating window";
|
||||||
|
type = int;
|
||||||
|
default = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.telescope = {
|
options.vim.telescope = {
|
||||||
mappings = {
|
mappings = {
|
||||||
|
@ -30,5 +176,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
|
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "Telescope" setupOptions;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
inherit (lib.strings) toUpper;
|
inherit (lib.strings) toUpper;
|
||||||
inherit (lib.types) int float bool str enum listOf attrsOf;
|
inherit (lib.types) int float bool str enum listOf attrsOf;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
rawLua = lua: {__raw = lua;};
|
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule ["vim" "visuals" "fidget-nvim" "align" "bottom"] ["vim" "visuals" "fidget-nvim" "setupOpts" "notification" "window" "align"])
|
(mkRenamedOptionModule ["vim" "visuals" "fidget-nvim" "align" "bottom"] ["vim" "visuals" "fidget-nvim" "setupOpts" "notification" "window" "align"])
|
||||||
|
@ -50,7 +49,7 @@ in {
|
||||||
apply = clear:
|
apply = clear:
|
||||||
if clear
|
if clear
|
||||||
then
|
then
|
||||||
rawLua ''
|
mkLuaInline ''
|
||||||
function(client_id)
|
function(client_id)
|
||||||
local client = vim.lsp.get_client_by_id(client_id)
|
local client = vim.lsp.get_client_by_id(client_id)
|
||||||
return client and client.name or nil
|
return client and client.name or nil
|
||||||
|
@ -66,7 +65,7 @@ in {
|
||||||
return msg.lsp_client.name
|
return msg.lsp_client.name
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
apply = rawLua;
|
apply = mkLuaInline;
|
||||||
};
|
};
|
||||||
ignore = mkOption {
|
ignore = mkOption {
|
||||||
description = "Ignore LSP servers by name";
|
description = "Ignore LSP servers by name";
|
||||||
|
@ -177,7 +176,7 @@ in {
|
||||||
default = ''
|
default = ''
|
||||||
require("fidget.progress.display").default_format_message
|
require("fidget.progress.display").default_format_message
|
||||||
'';
|
'';
|
||||||
apply = rawLua;
|
apply = mkLuaInline;
|
||||||
};
|
};
|
||||||
format_annote = mkOption {
|
format_annote = mkOption {
|
||||||
description = "How to format a progress annotation";
|
description = "How to format a progress annotation";
|
||||||
|
@ -185,7 +184,7 @@ in {
|
||||||
default = ''
|
default = ''
|
||||||
function(msg) return msg.title end
|
function(msg) return msg.title end
|
||||||
'';
|
'';
|
||||||
apply = rawLua;
|
apply = mkLuaInline;
|
||||||
};
|
};
|
||||||
format_group_name = mkOption {
|
format_group_name = mkOption {
|
||||||
description = "How to format a progress notification group's name";
|
description = "How to format a progress notification group's name";
|
||||||
|
@ -193,13 +192,13 @@ in {
|
||||||
default = ''
|
default = ''
|
||||||
function(group) return tostring(group) end
|
function(group) return tostring(group) end
|
||||||
'';
|
'';
|
||||||
apply = rawLua;
|
apply = mkLuaInline;
|
||||||
};
|
};
|
||||||
overrides = mkOption {
|
overrides = mkOption {
|
||||||
description = "Override options from the default notification config";
|
description = "Override options from the default notification config";
|
||||||
type = attrsOf str;
|
type = attrsOf str;
|
||||||
default = {rust_analyzer = "{ name = 'rust-analyzer' }";};
|
default = {rust_analyzer = "{ name = 'rust-analyzer' }";};
|
||||||
apply = mapAttrs (key: lua: rawLua lua);
|
apply = mapAttrs (key: lua: mkLuaInline lua);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -227,7 +226,7 @@ in {
|
||||||
description = "Minimum notifications level";
|
description = "Minimum notifications level";
|
||||||
type = enum ["debug" "info" "warn" "error"];
|
type = enum ["debug" "info" "warn" "error"];
|
||||||
default = "info";
|
default = "info";
|
||||||
apply = filter: rawLua "vim.log.levels.${toUpper filter}";
|
apply = filter: mkLuaInline "vim.log.levels.${toUpper filter}";
|
||||||
};
|
};
|
||||||
history_size = mkOption {
|
history_size = mkOption {
|
||||||
description = "Number of removed messages to retain in history";
|
description = "Number of removed messages to retain in history";
|
||||||
|
@ -243,7 +242,7 @@ in {
|
||||||
description = "How to configure notification groups when instantiated";
|
description = "How to configure notification groups when instantiated";
|
||||||
type = attrsOf str;
|
type = attrsOf str;
|
||||||
default = {default = "require('fidget.notification').default_config";};
|
default = {default = "require('fidget.notification').default_config";};
|
||||||
apply = mapAttrs (key: lua: rawLua lua);
|
apply = mapAttrs (key: lua: mkLuaInline lua);
|
||||||
};
|
};
|
||||||
redirect = mkOption {
|
redirect = mkOption {
|
||||||
description = "Conditionally redirect notifications to another backend";
|
description = "Conditionally redirect notifications to another backend";
|
||||||
|
@ -255,7 +254,7 @@ in {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
apply = rawLua;
|
apply = mkLuaInline;
|
||||||
};
|
};
|
||||||
|
|
||||||
view = {
|
view = {
|
||||||
|
@ -287,7 +286,7 @@ in {
|
||||||
return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
|
return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
apply = rawLua;
|
apply = mkLuaInline;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -373,7 +372,7 @@ in {
|
||||||
description = "Minimum logging level";
|
description = "Minimum logging level";
|
||||||
type = enum ["debug" "error" "info" "trace" "warn" "off"];
|
type = enum ["debug" "error" "info" "trace" "warn" "off"];
|
||||||
default = "warn";
|
default = "warn";
|
||||||
apply = logLevel: rawLua "vim.log.levels.${toUpper logLevel}";
|
apply = logLevel: mkLuaInline "vim.log.levels.${toUpper logLevel}";
|
||||||
};
|
};
|
||||||
max_size = mkOption {
|
max_size = mkOption {
|
||||||
description = "Maximum log file size, in KB";
|
description = "Maximum log file size, in KB";
|
||||||
|
@ -391,7 +390,7 @@ in {
|
||||||
default = ''
|
default = ''
|
||||||
string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache"))
|
string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache"))
|
||||||
'';
|
'';
|
||||||
apply = rawLua;
|
apply = mkLuaInline;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue