mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
utility/oil-nvim: add oil-git-status support
This commit is contained in:
parent
69659e078b
commit
de1f36b4be
4 changed files with 49 additions and 5 deletions
|
@ -3,18 +3,38 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.attrsets) optionalAttrs recursiveUpdate;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.dag) entryAfter entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.oil-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["oil-nvim"];
|
||||
pluginRC.oil-nvim = entryAnywhere ''
|
||||
require("oil").setup(${toLuaObject cfg.setupOpts});
|
||||
'';
|
||||
startPlugins = ["oil-nvim"] ++ (optionals cfg.gitStatus.enable ["oil-git-status.nvim"]);
|
||||
|
||||
pluginRC.oil-nvim = let
|
||||
gitStatusDefaultOpts = {
|
||||
# https://github.com/refractalize/oil-git-status.nvim?tab=readme-ov-file#configuration
|
||||
win_options = {
|
||||
signcolumn = "yes:2";
|
||||
};
|
||||
};
|
||||
|
||||
setupOpts =
|
||||
recursiveUpdate
|
||||
(optionalAttrs cfg.gitStatus.enable gitStatusDefaultOpts)
|
||||
cfg.setupOpts;
|
||||
in
|
||||
entryAnywhere ''
|
||||
require("oil").setup(${toLuaObject setupOpts});
|
||||
'';
|
||||
|
||||
pluginRC.oil-git-status-nvim = mkIf cfg.gitStatus.enable (entryAfter ["oil-nvim"] ''
|
||||
require("oil-git-status").setup(${toLuaObject cfg.gitStatus.setupOpts})
|
||||
'');
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,5 +8,13 @@ in {
|
|||
'';
|
||||
|
||||
setupOpts = mkPluginSetupOption "oil-nvim" {};
|
||||
|
||||
gitStatus = {
|
||||
enable = mkEnableOption ''
|
||||
Git status on [oil-nvim] directory listings
|
||||
'';
|
||||
|
||||
setupOpts = mkPluginSetupOption "oil-git-status-nvim" {};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue