This commit is contained in:
NotAShelf 2024-04-23 10:16:49 -04:00 committed by GitHub
commit cc6ec83089
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 215 additions and 4 deletions

View file

@ -132,9 +132,8 @@ inputs: let
};
filetree = {
nvimTree = {
enable = true;
};
nvimTree.enable = false;
neo-tree.enable = true;
};
tabline = {

View file

@ -931,6 +931,22 @@
"type": "github"
}
},
"plugin-neo-tree-nvim": {
"flake": false,
"locked": {
"lastModified": 1713050882,
"narHash": "sha256-cZwOVpdMT0NCtp6Ha592QA2RzKVS6LhXXcjfDBCQ+0k=",
"owner": "nvim-neo-tree",
"repo": "neo-tree.nvim",
"rev": "22e566aeb075c94f670f34077e05ba95190dfb4a",
"type": "github"
},
"original": {
"owner": "nvim-neo-tree",
"repo": "neo-tree.nvim",
"type": "github"
}
},
"plugin-neocord": {
"flake": false,
"locked": {
@ -1851,6 +1867,7 @@
"plugin-mind-nvim": "plugin-mind-nvim",
"plugin-minimap-vim": "plugin-minimap-vim",
"plugin-modes-nvim": "plugin-modes-nvim",
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
"plugin-neocord": "plugin-neocord",
"plugin-neodev-nvim": "plugin-neodev-nvim",
"plugin-noice-nvim": "plugin-noice-nvim",

View file

@ -223,6 +223,11 @@
flake = false;
};
plugin-neo-tree-nvim = {
url = "github:nvim-neo-tree/neo-tree.nvim";
flake = false;
};
# Tablines
plugin-nvim-bufferline-lua = {
url = "github:akinsho/nvim-bufferline.lua";

View file

@ -1,5 +1,6 @@
{
imports = [
./nvimtree
./neo-tree
];
}

View file

@ -0,0 +1,28 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.filetree.neo-tree;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
# dependencies
"plenary-nvim" # commons library
"image-nvim" # optional for image previews
"nui-nvim" # ui library
# neotree
"neo-tree-nvim"
];
luaConfigRC.neo-tree = entryAnywhere ''
require("neo-tree").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./neo-tree.nix
];
}

View file

@ -0,0 +1,155 @@
{lib, ...}: let
inherit (lib.types) bool str int submodule enum either listOf;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.filetree.neo-tree = {
enable = mkEnableOption "filetree via neo-tree.nvim";
# Permalink:
# https://github.com/nvim-neo-tree/neo-tree.nvim/blob/22e566aeb075c94f670f34077e05ba95190dfb4a/lua/neo-tree/defaults.lua
setupOpts = mkPluginSetupOption "neo-tree" {
add_blank_line_at_top = mkOption {
type = bool;
default = false;
description = ''
Whether to add a blank line at the top of the tree
'';
};
auto_clean_after_session_restore = mkOption {
type = bool;
default = false;
description = ''
Whether to automatically clean up broken neo-tree buffers
saved in sessions
'';
};
default_source = mkOption {
type = str;
default = "filesystem";
description = ''
You can choose a specific source.
`last` here which indicates the last used source
'';
};
enable_diagnostics = mkEnableOption "diagnostics" // {default = true;};
enable_git_status = mkEnableOption "git status" // {default = true;};
enable_modified_markers = mkEnableOption "markers for files with unsaved changes." // {default = true;};
enable_opened_markers =
mkEnableOption ''
tracking of opened files.
Required for `components.name.highlight_opened_files`
''
// {default = true;};
enable_refresh_on_write =
mkEnableOption ''
Refresh the tree when a file is written.
Only used if `use_libuv_file_watcher` is false.
''
// {default = true;};
enable_cursor_hijack = mkEnableOption ''
cursor hijacking.
If enabled neotree will keep the cursor on the first letter of the filename when moving in the tree
'';
git_status_async = mkEnableOption ''
async git status.
This will make the git status check async and will not block the UI.
'';
/*
git_status_async_options = mkOption {
description = "These options are for people with VERY large git repos";
type = submodule {
batch_size = mkOption {
type = int;
default = 1000;
description = "How many lines of git status results to process at a time";
};
batch_delay = mkOption {
type = int;
default = 10;
description = "Delay, in ms, between batches. Spreads out the workload to let other processes run";
};
max_lines = mkOption {
type = int;
default = 10000;
description = ''
How many lines of git status results to process.
Anything after this will be dropped. Anything before this will be used.
The last items to be processed are the untracked files.
'';
};
};
};
*/
hide_root_node = mkOption {
type = bool;
default = false;
description = ''
Whether to hide the root node of the tree
'';
};
retain_hidden_root_indent = mkOption {
type = bool;
default = false;
description = ''
Whether to retain the indent of the hidden root node
IF the root node is hidden, keep the indentation anyhow.
This is needed if you use expanders because they render in the indent.
'';
};
log_level = mkOption {
type = enum ["trace" "debug" "info" "warn" "error" "fatal"];
default = "info";
description = "Log level for the plugin.";
};
log_to_file = mkOption {
type = either bool str;
default = false;
example = literalExpression "/tmp/neo-tree.log";
description = ''
Must be either a boolean or a path to your log file.
Use :NeoTreeLogs to show the file
'';
};
open_files_in_last_window = mkOption {
type = bool;
default = true;
description = ''
Whether to open files in the last window
If disabled, neo-tree will open files in top left window
'';
};
open_files_do_not_replace_types = mkOption {
type = listOf str;
default = ["terminal" "Trouble" "qf" "edgy"];
description = ''
A list of filetypes that should not be replaced when opening a file
'';
};
};
};
}

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./config.nix
./nvimtree.nix