From 8f1d581023d2630a6aafc445a0fe3a117a681a3a Mon Sep 17 00:00:00 2001 From: Fritiof Rusck Date: Tue, 23 Apr 2024 10:16:56 +0200 Subject: [PATCH 1/4] feat(filesystem): add option always_show_by_pattern --- lua/neo-tree/defaults.lua | 204 +++++++++++---------- lua/neo-tree/sources/common/file-items.lua | 5 + lua/neo-tree/sources/filesystem/init.lua | 2 +- 3 files changed, 110 insertions(+), 101 deletions(-) diff --git a/lua/neo-tree/defaults.lua b/lua/neo-tree/defaults.lua index 44736046..facad58d 100644 --- a/lua/neo-tree/defaults.lua +++ b/lua/neo-tree/defaults.lua @@ -9,48 +9,48 @@ local config = { "git_status", -- "document_symbols", }, - add_blank_line_at_top = false, -- Add a blank line at the top of the tree. + add_blank_line_at_top = false, -- Add a blank line at the top of the tree. auto_clean_after_session_restore = false, -- Automatically clean up broken neo-tree buffers saved in sessions - close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab - default_source = "filesystem", -- you can choose a specific source `last` here which indicates the last used source + close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab + default_source = "filesystem", -- you can choose a specific source `last` here which indicates the last used source enable_diagnostics = true, enable_git_status = true, enable_modified_markers = true, -- Show markers for files with unsaved changes. enable_opened_markers = true, -- Enable tracking of opened files. Required for `components.name.highlight_opened_files` enable_refresh_on_write = true, -- Refresh the tree when a file is written. Only used if `use_libuv_file_watcher` is false. - enable_cursor_hijack = false, -- If enabled neotree will keep the cursor on the first letter of the filename when moving in the tree. + enable_cursor_hijack = false, -- If enabled neotree will keep the cursor on the first letter of the filename when moving in the tree. git_status_async = true, -- These options are for people with VERY large git repos git_status_async_options = { batch_size = 1000, -- how many lines of git status results to process at a time batch_delay = 10, -- delay in ms between batches. Spreads out the workload to let other processes run. max_lines = 10000, -- 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. + -- Anything before this will be used. The last items to be processed are the untracked files. }, - hide_root_node = false, -- Hide the root node. - retain_hidden_root_indent = false, -- 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 = "info", -- "trace", "debug", "info", "warn", "error", "fatal" - log_to_file = false, -- true, false, "/path/to/file.log", use :NeoTreeLogs to show the file - open_files_in_last_window = true, -- false = open files in top left window + hide_root_node = false, -- Hide the root node. + retain_hidden_root_indent = false, -- 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 = "info", -- "trace", "debug", "info", "warn", "error", "fatal" + log_to_file = false, -- true, false, "/path/to/file.log", use :NeoTreeLogs to show the file + open_files_in_last_window = true, -- false = open files in top left window open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "edgy" }, -- when opening files, do not use windows containing these filetypes or buftypes -- popup_border_style is for input and confirmation dialogs. -- Configurtaion of floating window is done in the individual source sections. -- "NC" is a special style that works well with NormalNC set - popup_border_style = "NC", -- "double", "none", "rounded", "shadow", "single" or "solid" + popup_border_style = "NC", -- "double", "none", "rounded", "shadow", "single" or "solid" resize_timer_interval = 500, -- in ms, needed for containers to redraw right aligned and faded content - -- set to -1 to disable the resize timer entirely + -- set to -1 to disable the resize timer entirely -- -- NOTE: this will speed up to 50 ms for 1 second following a resize sort_case_insensitive = false, -- used when sorting files and directories in the tree - sort_function = nil , -- uses a custom function for sorting files and directories in the tree - use_popups_for_input = true, -- If false, inputs will use vim.ui.input() instead of custom floats. + sort_function = nil, -- uses a custom function for sorting files and directories in the tree + use_popups_for_input = true, -- If false, inputs will use vim.ui.input() instead of custom floats. use_default_mappings = true, -- source_selector provides clickable tabs to switch between sources. source_selector = { - winbar = false, -- toggle to show selector on winbar - statusline = false, -- toggle to show selector on statusline + winbar = false, -- toggle to show selector on winbar + statusline = false, -- toggle to show selector on statusline show_scrolled_off_parent_node = false, -- this will replace the tabs with the parent path - -- of the top visible node when scrolled down. + -- of the top visible node when scrolled down. sources = { { source = "filesystem" }, { source = "buffers" }, @@ -72,7 +72,7 @@ local config = { padding = 0, -- can be int or table -- padding = { left = 2, right = 0 }, -- separator = "▕", -- can be string or table, see below - separator = { left = "▏", right= "▕" }, + separator = { left = "▏", right = "▕" }, -- separator = { left = "/", right = "\\", override = nil }, -- |/ a \/ b \/ c \... -- separator = { left = "/", right = "\\", override = "right" }, -- |/ a \ b \ c \... -- separator = { left = "/", right = "\\", override = "left" }, -- |/ a / b / c /... @@ -211,10 +211,10 @@ local config = { }, name = { trailing_slash = false, - highlight_opened_files = false, -- Requires `enable_opened_markers = true`. - -- Take values in { false (no highlight), true (only loaded), - -- "all" (both loaded and unloaded)}. For more information, - -- see the `show_unloaded` config of the `buffers` source. + highlight_opened_files = false, -- Requires `enable_opened_markers = true`. + -- Take values in { false (no highlight), true (only loaded), + -- "all" (both loaded and unloaded)}. For more information, + -- see the `show_unloaded` config of the `buffers` source. use_git_status_colors = true, highlight = "NeoTreeFileName", }, @@ -263,19 +263,19 @@ local config = { { "container", content = { - { "name", zindex = 10 }, + { "name", zindex = 10 }, { "symlink_target", zindex = 10, highlight = "NeoTreeSymbolicLinkTarget", }, - { "clipboard", zindex = 10 }, - { "diagnostics", errors_only = true, zindex = 20, align = "right", hide_when_expanded = true }, - { "git_status", zindex = 10, align = "right", hide_when_expanded = true }, - { "file_size", zindex = 10, align = "right" }, - { "type", zindex = 10, align = "right" }, - { "last_modified", zindex = 10, align = "right" }, - { "created", zindex = 10, align = "right" }, + { "clipboard", zindex = 10 }, + { "diagnostics", errors_only = true, zindex = 20, align = "right", hide_when_expanded = true }, + { "git_status", zindex = 10, align = "right", hide_when_expanded = true }, + { "file_size", zindex = 10, align = "right" }, + { "type", zindex = 10, align = "right" }, + { "last_modified", zindex = 10, align = "right" }, + { "created", zindex = 10, align = "right" }, }, }, }, @@ -294,21 +294,21 @@ local config = { zindex = 10, highlight = "NeoTreeSymbolicLinkTarget", }, - { "clipboard", zindex = 10 }, - { "bufnr", zindex = 10 }, - { "modified", zindex = 20, align = "right" }, - { "diagnostics", zindex = 20, align = "right" }, - { "git_status", zindex = 10, align = "right" }, - { "file_size", zindex = 10, align = "right" }, - { "type", zindex = 10, align = "right" }, + { "clipboard", zindex = 10 }, + { "bufnr", zindex = 10 }, + { "modified", zindex = 20, align = "right" }, + { "diagnostics", zindex = 20, align = "right" }, + { "git_status", zindex = 10, align = "right" }, + { "file_size", zindex = 10, align = "right" }, + { "type", zindex = 10, align = "right" }, { "last_modified", zindex = 10, align = "right" }, - { "created", zindex = 10, align = "right" }, + { "created", zindex = 10, align = "right" }, }, }, }, message = { { "indent", with_markers = false }, - { "name", highlight = "NeoTreeMessage" }, + { "name", highlight = "NeoTreeMessage" }, }, terminal = { { "indent" }, @@ -331,15 +331,15 @@ local config = { -- } | } | end -- -- see `:h neo-tree-custom-commands-global` - commands = {}, -- A list of functions + commands = {}, -- A list of functions - window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for - -- possible options. These can also be functions that return these options. - position = "left", -- left, right, top, bottom, float, current - width = 40, -- applies to left and right positions - height = 15, -- applies to top and bottom positions + window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for + -- possible options. These can also be functions that return these options. + position = "left", -- left, right, top, bottom, float, current + width = 40, -- applies to left and right positions + height = 15, -- applies to top and bottom positions auto_expand_width = false, -- expand the window when file exceeds the window width. does not work with position = "float" - popup = { -- settings that apply to float position only + popup = { -- settings that apply to float position only size = { height = "80%", width = "50%", @@ -348,10 +348,10 @@ local config = { -- you can also specify border here, if you want a different setting from -- the global popup_border_style. }, - same_level = false, -- Create and paste/move files/directories on the same level as the directory under cursor (as opposed to within the directory under cursor). + same_level = false, -- Create and paste/move files/directories on the same level as the directory under cursor (as opposed to within the directory under cursor). insert_as = "child", -- Affects how nodes get inserted into the tree during creation/pasting/moving of files if the node under the cursor is a directory: - -- "child": Insert nodes as children of the directory under cursor. - -- "sibling": Insert nodes as siblings of the directory under cursor. + -- "child": Insert nodes as children of the directory under cursor. + -- "sibling": Insert nodes as siblings of the directory under cursor. -- Mappings for tree window. See `:h neo-tree-mappings` for a list of built-in commands. -- You can also create your own commands by providing a function instead of a string. mapping_options = { @@ -360,8 +360,8 @@ local config = { }, mappings = { [""] = { - "toggle_node", - nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use + "toggle_node", + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use }, ["<2-LeftMouse>"] = "open", [""] = "open", @@ -421,7 +421,7 @@ local config = { ["[g"] = "prev_git_modified", ["]g"] = "next_git_modified", ["i"] = "show_file_details", - ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, ["oc"] = { "order_by_created", nowait = false }, ["od"] = { "order_by_diagnostics", nowait = false }, ["og"] = { "order_by_git_status", nowait = false }, @@ -438,18 +438,18 @@ local config = { }, }, async_directory_scan = "auto", -- "auto" means refreshes are async, but it's synchronous when called from the Neotree commands. - -- "always" means directory scans are always async. - -- "never" means directory scans are never async. - scan_mode = "shallow", -- "shallow": Don't scan into directories to detect possible empty directory a priori - -- "deep": Scan into directories to detect empty or grouped empty directories a priori. - bind_to_cwd = true, -- true creates a 2-way binding between vim's cwd and neo-tree's root + -- "always" means directory scans are always async. + -- "never" means directory scans are never async. + scan_mode = "shallow", -- "shallow": Don't scan into directories to detect possible empty directory a priori + -- "deep": Scan into directories to detect empty or grouped empty directories a priori. + bind_to_cwd = true, -- true creates a 2-way binding between vim's cwd and neo-tree's root cwd_target = { - sidebar = "tab", -- sidebar is when position = left or right - current = "window" -- current is when position = current + sidebar = "tab", -- sidebar is when position = left or right + current = "window" -- current is when position = current }, check_gitignore_in_search = true, -- check gitignore status for files/directories when searching - -- setting this to false will speed up searches, but gitignored - -- items won't be marked if they are visible. + -- setting this to false will speed up searches, but gitignored + -- items won't be marked if they are visible. -- The renderer section provides the renderers that will be used to render the tree. -- The first level is the node type. -- For each node type, you can specify a list of components to render. @@ -457,9 +457,9 @@ local config = { -- The first field in each component is the name of the function to call. -- The rest of the fields are passed to the function as the "config" argument. filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items + visible = false, -- when true, they will just be displayed differently than normal items force_visible_in_empty_folder = false, -- when true, hidden files will be shown if the root folder is otherwise empty - show_hidden_count = true, -- when true, the number of hidden items in each folder will be shown as the last entry + show_hidden_count = true, -- when true, the number of hidden items in each folder will be shown as the last entry hide_dotfiles = true, hide_gitignored = true, hide_hidden = true, -- only works on Windows for hidden files/directories @@ -475,6 +475,9 @@ local config = { always_show = { -- remains visible even if other settings would normally hide it --".gitignored", }, + always_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show --".DS_Store", --"thumbs.db" @@ -483,16 +486,16 @@ local config = { --".null-ls_*", }, }, - find_by_full_path_words = false, -- `false` means it only searches the tail of a path. - -- `true` will change the filter into a full path - -- search with space as an implicit ".*", so - -- `fi init` - -- will match: `./sources/filesystem/init.lua + find_by_full_path_words = false, -- `false` means it only searches the tail of a path. + -- `true` will change the filter into a full path + -- search with space as an implicit ".*", so + -- `fi init` + -- will match: `./sources/filesystem/init.lua --find_command = "fd", -- this is determined automatically, you probably don't need to set it --find_args = { -- you can specify extra args to pass to the find command. -- fd = { - -- "--exclude", ".git", - -- "--exclude", "node_modules" + -- "--exclude", ".git", + -- "--exclude", "node_modules" -- } --}, ---- or use a function instead of list of strings @@ -516,39 +519,39 @@ local config = { -- end -- return args --end, - group_empty_dirs = false, -- when true, empty folders will be grouped together - search_limit = 50, -- max number of search results when using filters + group_empty_dirs = false, -- when true, empty folders will be grouped together + search_limit = 50, -- max number of search results when using filters follow_current_file = { - enabled = false, -- This will find and focus the file in the active buffer every time + enabled = false, -- This will find and focus the file in the active buffer every time -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` }, hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current",-- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + -- in whatever position is specified in window.position + -- "open_current",-- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. + -- instead of relying on nvim autocmd events. }, buffers = { bind_to_cwd = true, follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time + enabled = true, -- This will find and focus the file in the active buffer every time -- -- the current file is changed while the tree is open. leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` }, - group_empty_dirs = true, -- when true, empty directories will be grouped together - show_unloaded = false, -- When working with sessions, for example, restored but unfocused buffers - -- are mark as "unloaded". Turn this on to view these unloaded buffer. - terminals_first = false, -- when true, terminals will be listed before file buffers + group_empty_dirs = true, -- when true, empty directories will be grouped together + show_unloaded = false, -- When working with sessions, for example, restored but unfocused buffers + -- are mark as "unloaded". Turn this on to view these unloaded buffer. + terminals_first = false, -- when true, terminals will be listed before file buffers window = { mappings = { [""] = "navigate_up", ["."] = "set_root", ["bd"] = "buffer_delete", ["i"] = "show_file_details", - ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, ["oc"] = { "order_by_created", nowait = false }, ["od"] = { "order_by_diagnostics", nowait = false }, ["om"] = { "order_by_modified", nowait = false }, @@ -569,7 +572,7 @@ local config = { ["gp"] = "git_push", ["gg"] = "git_commit_and_push", ["i"] = "show_file_details", - ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, ["oc"] = { "order_by_created", nowait = false }, ["od"] = { "order_by_diagnostics", nowait = false }, ["om"] = { "order_by_modified", nowait = false }, @@ -584,17 +587,18 @@ local config = { client_filters = "first", renderers = { root = { - {"indent"}, - {"icon", default="C" }, - {"name", zindex = 10}, + { "indent" }, + { "icon", default = "C" }, + { "name", zindex = 10 }, }, symbol = { - {"indent", with_expanders = true}, - {"kind_icon", default="?" }, - {"container", - content = { - {"name", zindex = 10}, - {"kind_name", zindex = 20, align = "right"}, + { "indent", with_expanders = true }, + { "kind_icon", default = "?" }, + { + "container", + content = { + { "name", zindex = 10 }, + { "kind_name", zindex = 20, align = "right" }, } } }, @@ -663,10 +667,10 @@ local config = { example = { renderers = { custom = { - {"indent"}, - {"icon", default="C" }, - {"custom"}, - {"name"} + { "indent" }, + { "icon", default = "C" }, + { "custom" }, + { "name" } } }, window = { diff --git a/lua/neo-tree/sources/common/file-items.lua b/lua/neo-tree/sources/common/file-items.lua index 1d040421..3e4a7a75 100644 --- a/lua/neo-tree/sources/common/file-items.lua +++ b/lua/neo-tree/sources/common/file-items.lua @@ -167,6 +167,11 @@ function create_item(context, path, _type, bufnr) if f.always_show[name] then item.filtered_by = item.filtered_by or {} item.filtered_by.always_show = true + else + if utils.is_filtered_by_pattern(f.always_show_by_pattern, path, name) then + item.filtered_by = item.filtered_by or {} + item.filtered_by.always_show = true + end end if f.hide_by_name[name] then item.filtered_by = item.filtered_by or {} diff --git a/lua/neo-tree/sources/filesystem/init.lua b/lua/neo-tree/sources/filesystem/init.lua index a6a3e4b2..7101864c 100644 --- a/lua/neo-tree/sources/filesystem/init.lua +++ b/lua/neo-tree/sources/filesystem/init.lua @@ -260,7 +260,7 @@ M.setup = function(config, global_config) config.filtered_items = config.filtered_items or {} config.enable_git_status = global_config.enable_git_status - for _, key in ipairs({ "hide_by_pattern", "never_show_by_pattern" }) do + for _, key in ipairs({ "hide_by_pattern", "always_show_by_pattern", "never_show_by_pattern" }) do local list = config.filtered_items[key] if type(list) == "table" then for i, pattern in ipairs(list) do From 70595d8b6a4970e211e4f3974db98a1c196eac14 Mon Sep 17 00:00:00 2001 From: Fritiof Rusck Date: Tue, 23 Apr 2024 10:25:41 +0200 Subject: [PATCH 2/4] docs(filesystem): add always_show_by_pattern to neo-tree.txt --- doc/neo-tree.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/neo-tree.txt b/doc/neo-tree.txt index ccccb50b..0a3e186b 100644 --- a/doc/neo-tree.txt +++ b/doc/neo-tree.txt @@ -931,6 +931,9 @@ highlight group which will be applied when they are visible, see always_show = { -- remains visible even if other settings would normally hide it --".gitignored", }, + always_show_by_pattern = { -- uses glob style patterns + --".env*", + }, never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show --".DS_Store", --"thumbs.db", @@ -964,6 +967,10 @@ The `always_show` option is a list of file/folder names that will always be visible, even if other settings would normally hide it. This section takes precedence over all other options except for `never_show`. +the `always_show_by_pattern` option is a list of file/folder patterns that +always will be visible. This section takes precedence over all other options +except `never_show`. + The `never_show` option is the same as `hide_by_name`, except that those items will remain hidden even if you toggle `visible` to true. This section takes precedence over the others. From e245c997dfde976446dac338f94f0cb6671b85d4 Mon Sep 17 00:00:00 2001 From: Fritiof Rusck Date: Tue, 23 Apr 2024 10:27:31 +0200 Subject: [PATCH 3/4] docs(filesystem): add always_show_by_pattern to README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6693934c..95389d23 100644 --- a/README.md +++ b/README.md @@ -306,6 +306,9 @@ use { always_show = { -- remains visible even if other settings would normally hide it --".gitignored", }, + always_show_by_pattern = { -- uses glob style patterns + --".env*", + }, never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show --".DS_Store", --"thumbs.db" From 882a39ea4245037e2df684083cc9c50dfc8d858a Mon Sep 17 00:00:00 2001 From: Fritiof Rusck Date: Tue, 23 Apr 2024 10:39:40 +0200 Subject: [PATCH 4/4] fix: revert accidental formating on entire file --- lua/neo-tree/defaults.lua | 203 +++++++++++++++++++------------------- 1 file changed, 101 insertions(+), 102 deletions(-) diff --git a/lua/neo-tree/defaults.lua b/lua/neo-tree/defaults.lua index facad58d..205444be 100644 --- a/lua/neo-tree/defaults.lua +++ b/lua/neo-tree/defaults.lua @@ -9,48 +9,48 @@ local config = { "git_status", -- "document_symbols", }, - add_blank_line_at_top = false, -- Add a blank line at the top of the tree. + add_blank_line_at_top = false, -- Add a blank line at the top of the tree. auto_clean_after_session_restore = false, -- Automatically clean up broken neo-tree buffers saved in sessions - close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab - default_source = "filesystem", -- you can choose a specific source `last` here which indicates the last used source + close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab + default_source = "filesystem", -- you can choose a specific source `last` here which indicates the last used source enable_diagnostics = true, enable_git_status = true, enable_modified_markers = true, -- Show markers for files with unsaved changes. enable_opened_markers = true, -- Enable tracking of opened files. Required for `components.name.highlight_opened_files` enable_refresh_on_write = true, -- Refresh the tree when a file is written. Only used if `use_libuv_file_watcher` is false. - enable_cursor_hijack = false, -- If enabled neotree will keep the cursor on the first letter of the filename when moving in the tree. + enable_cursor_hijack = false, -- If enabled neotree will keep the cursor on the first letter of the filename when moving in the tree. git_status_async = true, -- These options are for people with VERY large git repos git_status_async_options = { batch_size = 1000, -- how many lines of git status results to process at a time batch_delay = 10, -- delay in ms between batches. Spreads out the workload to let other processes run. max_lines = 10000, -- 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. + -- Anything before this will be used. The last items to be processed are the untracked files. }, - hide_root_node = false, -- Hide the root node. - retain_hidden_root_indent = false, -- 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 = "info", -- "trace", "debug", "info", "warn", "error", "fatal" - log_to_file = false, -- true, false, "/path/to/file.log", use :NeoTreeLogs to show the file - open_files_in_last_window = true, -- false = open files in top left window + hide_root_node = false, -- Hide the root node. + retain_hidden_root_indent = false, -- 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 = "info", -- "trace", "debug", "info", "warn", "error", "fatal" + log_to_file = false, -- true, false, "/path/to/file.log", use :NeoTreeLogs to show the file + open_files_in_last_window = true, -- false = open files in top left window open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "edgy" }, -- when opening files, do not use windows containing these filetypes or buftypes -- popup_border_style is for input and confirmation dialogs. -- Configurtaion of floating window is done in the individual source sections. -- "NC" is a special style that works well with NormalNC set - popup_border_style = "NC", -- "double", "none", "rounded", "shadow", "single" or "solid" + popup_border_style = "NC", -- "double", "none", "rounded", "shadow", "single" or "solid" resize_timer_interval = 500, -- in ms, needed for containers to redraw right aligned and faded content - -- set to -1 to disable the resize timer entirely + -- set to -1 to disable the resize timer entirely -- -- NOTE: this will speed up to 50 ms for 1 second following a resize sort_case_insensitive = false, -- used when sorting files and directories in the tree - sort_function = nil, -- uses a custom function for sorting files and directories in the tree - use_popups_for_input = true, -- If false, inputs will use vim.ui.input() instead of custom floats. + sort_function = nil , -- uses a custom function for sorting files and directories in the tree + use_popups_for_input = true, -- If false, inputs will use vim.ui.input() instead of custom floats. use_default_mappings = true, -- source_selector provides clickable tabs to switch between sources. source_selector = { - winbar = false, -- toggle to show selector on winbar - statusline = false, -- toggle to show selector on statusline + winbar = false, -- toggle to show selector on winbar + statusline = false, -- toggle to show selector on statusline show_scrolled_off_parent_node = false, -- this will replace the tabs with the parent path - -- of the top visible node when scrolled down. + -- of the top visible node when scrolled down. sources = { { source = "filesystem" }, { source = "buffers" }, @@ -72,7 +72,7 @@ local config = { padding = 0, -- can be int or table -- padding = { left = 2, right = 0 }, -- separator = "▕", -- can be string or table, see below - separator = { left = "▏", right = "▕" }, + separator = { left = "▏", right= "▕" }, -- separator = { left = "/", right = "\\", override = nil }, -- |/ a \/ b \/ c \... -- separator = { left = "/", right = "\\", override = "right" }, -- |/ a \ b \ c \... -- separator = { left = "/", right = "\\", override = "left" }, -- |/ a / b / c /... @@ -211,10 +211,10 @@ local config = { }, name = { trailing_slash = false, - highlight_opened_files = false, -- Requires `enable_opened_markers = true`. - -- Take values in { false (no highlight), true (only loaded), - -- "all" (both loaded and unloaded)}. For more information, - -- see the `show_unloaded` config of the `buffers` source. + highlight_opened_files = false, -- Requires `enable_opened_markers = true`. + -- Take values in { false (no highlight), true (only loaded), + -- "all" (both loaded and unloaded)}. For more information, + -- see the `show_unloaded` config of the `buffers` source. use_git_status_colors = true, highlight = "NeoTreeFileName", }, @@ -263,19 +263,19 @@ local config = { { "container", content = { - { "name", zindex = 10 }, + { "name", zindex = 10 }, { "symlink_target", zindex = 10, highlight = "NeoTreeSymbolicLinkTarget", }, - { "clipboard", zindex = 10 }, - { "diagnostics", errors_only = true, zindex = 20, align = "right", hide_when_expanded = true }, - { "git_status", zindex = 10, align = "right", hide_when_expanded = true }, - { "file_size", zindex = 10, align = "right" }, - { "type", zindex = 10, align = "right" }, - { "last_modified", zindex = 10, align = "right" }, - { "created", zindex = 10, align = "right" }, + { "clipboard", zindex = 10 }, + { "diagnostics", errors_only = true, zindex = 20, align = "right", hide_when_expanded = true }, + { "git_status", zindex = 10, align = "right", hide_when_expanded = true }, + { "file_size", zindex = 10, align = "right" }, + { "type", zindex = 10, align = "right" }, + { "last_modified", zindex = 10, align = "right" }, + { "created", zindex = 10, align = "right" }, }, }, }, @@ -294,21 +294,21 @@ local config = { zindex = 10, highlight = "NeoTreeSymbolicLinkTarget", }, - { "clipboard", zindex = 10 }, - { "bufnr", zindex = 10 }, - { "modified", zindex = 20, align = "right" }, - { "diagnostics", zindex = 20, align = "right" }, - { "git_status", zindex = 10, align = "right" }, - { "file_size", zindex = 10, align = "right" }, - { "type", zindex = 10, align = "right" }, + { "clipboard", zindex = 10 }, + { "bufnr", zindex = 10 }, + { "modified", zindex = 20, align = "right" }, + { "diagnostics", zindex = 20, align = "right" }, + { "git_status", zindex = 10, align = "right" }, + { "file_size", zindex = 10, align = "right" }, + { "type", zindex = 10, align = "right" }, { "last_modified", zindex = 10, align = "right" }, - { "created", zindex = 10, align = "right" }, + { "created", zindex = 10, align = "right" }, }, }, }, message = { { "indent", with_markers = false }, - { "name", highlight = "NeoTreeMessage" }, + { "name", highlight = "NeoTreeMessage" }, }, terminal = { { "indent" }, @@ -331,15 +331,15 @@ local config = { -- } | } | end -- -- see `:h neo-tree-custom-commands-global` - commands = {}, -- A list of functions + commands = {}, -- A list of functions - window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for - -- possible options. These can also be functions that return these options. - position = "left", -- left, right, top, bottom, float, current - width = 40, -- applies to left and right positions - height = 15, -- applies to top and bottom positions + window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for + -- possible options. These can also be functions that return these options. + position = "left", -- left, right, top, bottom, float, current + width = 40, -- applies to left and right positions + height = 15, -- applies to top and bottom positions auto_expand_width = false, -- expand the window when file exceeds the window width. does not work with position = "float" - popup = { -- settings that apply to float position only + popup = { -- settings that apply to float position only size = { height = "80%", width = "50%", @@ -348,10 +348,10 @@ local config = { -- you can also specify border here, if you want a different setting from -- the global popup_border_style. }, - same_level = false, -- Create and paste/move files/directories on the same level as the directory under cursor (as opposed to within the directory under cursor). + same_level = false, -- Create and paste/move files/directories on the same level as the directory under cursor (as opposed to within the directory under cursor). insert_as = "child", -- Affects how nodes get inserted into the tree during creation/pasting/moving of files if the node under the cursor is a directory: - -- "child": Insert nodes as children of the directory under cursor. - -- "sibling": Insert nodes as siblings of the directory under cursor. + -- "child": Insert nodes as children of the directory under cursor. + -- "sibling": Insert nodes as siblings of the directory under cursor. -- Mappings for tree window. See `:h neo-tree-mappings` for a list of built-in commands. -- You can also create your own commands by providing a function instead of a string. mapping_options = { @@ -360,8 +360,8 @@ local config = { }, mappings = { [""] = { - "toggle_node", - nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use + "toggle_node", + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use }, ["<2-LeftMouse>"] = "open", [""] = "open", @@ -421,7 +421,7 @@ local config = { ["[g"] = "prev_git_modified", ["]g"] = "next_git_modified", ["i"] = "show_file_details", - ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, ["oc"] = { "order_by_created", nowait = false }, ["od"] = { "order_by_diagnostics", nowait = false }, ["og"] = { "order_by_git_status", nowait = false }, @@ -438,18 +438,18 @@ local config = { }, }, async_directory_scan = "auto", -- "auto" means refreshes are async, but it's synchronous when called from the Neotree commands. - -- "always" means directory scans are always async. - -- "never" means directory scans are never async. - scan_mode = "shallow", -- "shallow": Don't scan into directories to detect possible empty directory a priori - -- "deep": Scan into directories to detect empty or grouped empty directories a priori. - bind_to_cwd = true, -- true creates a 2-way binding between vim's cwd and neo-tree's root + -- "always" means directory scans are always async. + -- "never" means directory scans are never async. + scan_mode = "shallow", -- "shallow": Don't scan into directories to detect possible empty directory a priori + -- "deep": Scan into directories to detect empty or grouped empty directories a priori. + bind_to_cwd = true, -- true creates a 2-way binding between vim's cwd and neo-tree's root cwd_target = { - sidebar = "tab", -- sidebar is when position = left or right - current = "window" -- current is when position = current + sidebar = "tab", -- sidebar is when position = left or right + current = "window" -- current is when position = current }, check_gitignore_in_search = true, -- check gitignore status for files/directories when searching - -- setting this to false will speed up searches, but gitignored - -- items won't be marked if they are visible. + -- setting this to false will speed up searches, but gitignored + -- items won't be marked if they are visible. -- The renderer section provides the renderers that will be used to render the tree. -- The first level is the node type. -- For each node type, you can specify a list of components to render. @@ -457,9 +457,9 @@ local config = { -- The first field in each component is the name of the function to call. -- The rest of the fields are passed to the function as the "config" argument. filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items + visible = false, -- when true, they will just be displayed differently than normal items force_visible_in_empty_folder = false, -- when true, hidden files will be shown if the root folder is otherwise empty - show_hidden_count = true, -- when true, the number of hidden items in each folder will be shown as the last entry + show_hidden_count = true, -- when true, the number of hidden items in each folder will be shown as the last entry hide_dotfiles = true, hide_gitignored = true, hide_hidden = true, -- only works on Windows for hidden files/directories @@ -476,7 +476,7 @@ local config = { --".gitignored", }, always_show_by_pattern = { -- uses glob style patterns - --".null-ls_*", + --".env*", }, never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show --".DS_Store", @@ -486,16 +486,16 @@ local config = { --".null-ls_*", }, }, - find_by_full_path_words = false, -- `false` means it only searches the tail of a path. - -- `true` will change the filter into a full path - -- search with space as an implicit ".*", so - -- `fi init` - -- will match: `./sources/filesystem/init.lua + find_by_full_path_words = false, -- `false` means it only searches the tail of a path. + -- `true` will change the filter into a full path + -- search with space as an implicit ".*", so + -- `fi init` + -- will match: `./sources/filesystem/init.lua --find_command = "fd", -- this is determined automatically, you probably don't need to set it --find_args = { -- you can specify extra args to pass to the find command. -- fd = { - -- "--exclude", ".git", - -- "--exclude", "node_modules" + -- "--exclude", ".git", + -- "--exclude", "node_modules" -- } --}, ---- or use a function instead of list of strings @@ -519,39 +519,39 @@ local config = { -- end -- return args --end, - group_empty_dirs = false, -- when true, empty folders will be grouped together - search_limit = 50, -- max number of search results when using filters + group_empty_dirs = false, -- when true, empty folders will be grouped together + search_limit = 50, -- max number of search results when using filters follow_current_file = { - enabled = false, -- This will find and focus the file in the active buffer every time + enabled = false, -- This will find and focus the file in the active buffer every time -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` }, hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current",-- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + -- in whatever position is specified in window.position + -- "open_current",-- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. + -- instead of relying on nvim autocmd events. }, buffers = { bind_to_cwd = true, follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time + enabled = true, -- This will find and focus the file in the active buffer every time -- -- the current file is changed while the tree is open. leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` }, - group_empty_dirs = true, -- when true, empty directories will be grouped together - show_unloaded = false, -- When working with sessions, for example, restored but unfocused buffers - -- are mark as "unloaded". Turn this on to view these unloaded buffer. - terminals_first = false, -- when true, terminals will be listed before file buffers + group_empty_dirs = true, -- when true, empty directories will be grouped together + show_unloaded = false, -- When working with sessions, for example, restored but unfocused buffers + -- are mark as "unloaded". Turn this on to view these unloaded buffer. + terminals_first = false, -- when true, terminals will be listed before file buffers window = { mappings = { [""] = "navigate_up", ["."] = "set_root", ["bd"] = "buffer_delete", ["i"] = "show_file_details", - ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, ["oc"] = { "order_by_created", nowait = false }, ["od"] = { "order_by_diagnostics", nowait = false }, ["om"] = { "order_by_modified", nowait = false }, @@ -572,7 +572,7 @@ local config = { ["gp"] = "git_push", ["gg"] = "git_commit_and_push", ["i"] = "show_file_details", - ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, ["oc"] = { "order_by_created", nowait = false }, ["od"] = { "order_by_diagnostics", nowait = false }, ["om"] = { "order_by_modified", nowait = false }, @@ -587,18 +587,17 @@ local config = { client_filters = "first", renderers = { root = { - { "indent" }, - { "icon", default = "C" }, - { "name", zindex = 10 }, + {"indent"}, + {"icon", default="C" }, + {"name", zindex = 10}, }, symbol = { - { "indent", with_expanders = true }, - { "kind_icon", default = "?" }, - { - "container", - content = { - { "name", zindex = 10 }, - { "kind_name", zindex = 20, align = "right" }, + {"indent", with_expanders = true}, + {"kind_icon", default="?" }, + {"container", + content = { + {"name", zindex = 10}, + {"kind_name", zindex = 20, align = "right"}, } } }, @@ -667,10 +666,10 @@ local config = { example = { renderers = { custom = { - { "indent" }, - { "icon", default = "C" }, - { "custom" }, - { "name" } + {"indent"}, + {"icon", default="C" }, + {"custom"}, + {"name"} } }, window = {