plugins/neo-tree: init module (#248)

* plugins/neo-tree: init module

* filetree/neo-tree: add setup options until border styles

* plugins/filetree: rename module name

* docs: update changelogs

Mention the addition of neo-tree.
This commit is contained in:
raf 2024-07-14 18:30:12 +00:00 committed by GitHub
parent 1426c83ce6
commit a4d35b4419
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 237 additions and 11 deletions

View file

@ -21,7 +21,8 @@ Release notes for release 0.7
group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and optionally group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and optionally
`NvimTreeNormal` to `none`. `NvimTreeNormal` to `none`.
- Fix [vim.ui.smartcolumn.setupOpts.custom_colorcolumn](#opt-vim.ui.smartcolumn.setupOpts.custom_colorcolumn) - Fix
[vim.ui.smartcolumn.setupOpts.custom_colorcolumn](#opt-vim.ui.smartcolumn.setupOpts.custom_colorcolumn)
using the wrong type `int` instead of the expected type `string`. using the wrong type `int` instead of the expected type `string`.
[horriblename](https://github.com/horriblename): [horriblename](https://github.com/horriblename):
@ -44,21 +45,32 @@ Release notes for release 0.7
- Add rustfmt as the default formatter for Rust. - Add rustfmt as the default formatter for Rust.
- Enabled the terminal integration of catppuccin for theming Neovim's built-in terminal (this also affects toggleterm). - Enabled the terminal integration of catppuccin for theming Neovim's built-in
terminal (this also affects toggleterm).
- Migrate bufferline to setupOpts for more customizability - Migrate bufferline to setupOpts for more customizability
- Use `clangd` as the default language server for C languages - Use `clangd` as the default language server for C languages
- Expose `lib.nvim.types.pluginType`, which for example allows the user to create abstractions for adding plugins - Expose `lib.nvim.types.pluginType`, which for example allows the user to
create abstractions for adding plugins
- Migrate indent-blankline to setupOpts for more customizability. While the plugin's options can now be found under `indentBlankline.setupOpts`, the previous iteration of the module also included out of place/broken options, which have been removed for the time being. These are: - Migrate indent-blankline to setupOpts for more customizability. While the
plugin's options can now be found under `indentBlankline.setupOpts`, the
previous iteration of the module also included out of place/broken options,
which have been removed for the time being. These are:
- `listChar` - this was already unused - `listChar` - this was already unused
- `fillChar` - this had nothing to do with the plugin, please configure it yourself by adding `vim.opt.listchars:append({ space = '<char>' })` to your lua configuration - `fillChar` - this had nothing to do with the plugin, please configure it
- `eolChar` - this also had nothing to do with the plugin, please configure it yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your lua configuration yourself by adding `vim.opt.listchars:append({ space = '<char>' })` to your
lua configuration
- `eolChar` - this also had nothing to do with the plugin, please configure it
yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your
lua configuration
[NotAShelf](https://github.com/notashelf): [NotAShelf](https://github.com/notashelf):
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
- Add `deno fmt` as the default Markdown formatter. This will be enabled - Add `deno fmt` as the default Markdown formatter. This will be enabled
automatically if you have autoformatting enabled, but can be disabled manually automatically if you have autoformatting enabled, but can be disabled manually
if you choose to. if you choose to.
@ -76,7 +88,9 @@ Release notes for release 0.7
- Clean up Lualine module to reduce theme dependency on Catppuccin, and fixed - Clean up Lualine module to reduce theme dependency on Catppuccin, and fixed
blending issues in component separators. blending issues in component separators.
- Add - Add [ts-ereror-translator.nvim] extension of the TS language module, under
[ts-error-translator.nvim](https://github.com/dmmulroy/ts-error-translator.nvim) `vim.languages.ts.extensions.ts-error-translator` to aid with Typescript
extension of the TS language module, under development.
`vim.languages.ts.extensions.ts-error-translator`
- Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available
under `vim.filetree.neo-tree`, similar to nvimtree.

View file

@ -891,6 +891,22 @@
"type": "github" "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": { "plugin-neocord": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1843,6 +1859,7 @@
"plugin-mind-nvim": "plugin-mind-nvim", "plugin-mind-nvim": "plugin-mind-nvim",
"plugin-minimap-vim": "plugin-minimap-vim", "plugin-minimap-vim": "plugin-minimap-vim",
"plugin-modes-nvim": "plugin-modes-nvim", "plugin-modes-nvim": "plugin-modes-nvim",
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
"plugin-neocord": "plugin-neocord", "plugin-neocord": "plugin-neocord",
"plugin-neodev-nvim": "plugin-neodev-nvim", "plugin-neodev-nvim": "plugin-neodev-nvim",
"plugin-noice-nvim": "plugin-noice-nvim", "plugin-noice-nvim": "plugin-noice-nvim",

View file

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

View file

@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./nvimtree ./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 = [ imports = [
./config.nix ./config.nix
./nvimtree.nix ./nvimtree.nix