From 1e46923924698eec70c2e0cd14a6edae970f77e4 Mon Sep 17 00:00:00 2001 From: Sander Date: Fri, 31 May 2024 02:11:58 +0200 Subject: [PATCH 1/6] feat(filter): custom title --- lua/neo-tree/sources/filesystem/lib/filter.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/neo-tree/sources/filesystem/lib/filter.lua b/lua/neo-tree/sources/filesystem/lib/filter.lua index 90e7d456..6cc33fdd 100644 --- a/lua/neo-tree/sources/filesystem/lib/filter.lua +++ b/lua/neo-tree/sources/filesystem/lib/filter.lua @@ -43,6 +43,9 @@ M.show_filter = function(state, search_as_you_type, fuzzy_finder_mode, use_fzy) popup_msg = "Filter:" end end + if state.config.title then + popup_msg = state.config.title + end if state.current_position == "float" then scroll_padding = 0 local width = vim.fn.winwidth(winid) From 9c04cdf14e97f4c882ddcadd7fd0865b9bdd3456 Mon Sep 17 00:00:00 2001 From: Sander Date: Fri, 31 May 2024 03:33:55 +0200 Subject: [PATCH 2/6] docs(README): add example filter config --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d93515a8..66bf8ce4 100644 --- a/README.md +++ b/README.md @@ -331,11 +331,11 @@ use { [""] = "navigate_up", ["."] = "set_root", ["H"] = "toggle_hidden", - ["/"] = "fuzzy_finder", - ["D"] = "fuzzy_finder_directory", + ["/"] = { "fuzzy_finder", config = { title = "Filter:" }, + ["D"] = { "fuzzy_finder_directory", config = { title = "Filter Directories:" }, ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm -- ["D"] = "fuzzy_sorter_directory", - ["f"] = "filter_on_submit", + ["f"] = { "filter_on_submit", config = { title = "Search:" }, [""] = "clear_filter", ["[g"] = "prev_git_modified", ["]g"] = "next_git_modified", From 5fb87646cb4436299fb96639f493214d9bd7bcbc Mon Sep 17 00:00:00 2001 From: Sander Date: Fri, 31 May 2024 12:41:23 +0200 Subject: [PATCH 3/6] docs(README): revert --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 66bf8ce4..d93515a8 100644 --- a/README.md +++ b/README.md @@ -331,11 +331,11 @@ use { [""] = "navigate_up", ["."] = "set_root", ["H"] = "toggle_hidden", - ["/"] = { "fuzzy_finder", config = { title = "Filter:" }, - ["D"] = { "fuzzy_finder_directory", config = { title = "Filter Directories:" }, + ["/"] = "fuzzy_finder", + ["D"] = "fuzzy_finder_directory", ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm -- ["D"] = "fuzzy_sorter_directory", - ["f"] = { "filter_on_submit", config = { title = "Search:" }, + ["f"] = "filter_on_submit", [""] = "clear_filter", ["[g"] = "prev_git_modified", ["]g"] = "next_git_modified", From af77ecd2072eac1beaaba0372fc7199e7f8f4d2e Mon Sep 17 00:00:00 2001 From: Sander Date: Fri, 31 May 2024 12:46:38 +0200 Subject: [PATCH 4/6] docs(neo-tree): add title config --- doc/neo-tree.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/neo-tree.txt b/doc/neo-tree.txt index be49813b..b6aacbe3 100644 --- a/doc/neo-tree.txt +++ b/doc/neo-tree.txt @@ -586,8 +586,14 @@ the config options are in a table bound to the `config` key: filesystem = { window = { mappings = { + ["/"] = { + "fuzzy_finder", + config = { + title = "Filter" -- An empty string hides the title + } + }, ["a"] = { - "add", + "add", nowait = true config = { show_path = "none" -- "none", "relative", "absolute" From 40c4361bb5a2e41f1aad8cc34ea3978f571bdfb9 Mon Sep 17 00:00:00 2001 From: Sander Date: Fri, 31 May 2024 12:49:48 +0200 Subject: [PATCH 5/6] docs(neo-tree): fix spacing --- doc/neo-tree.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/neo-tree.txt b/doc/neo-tree.txt index b6aacbe3..85edf27e 100644 --- a/doc/neo-tree.txt +++ b/doc/neo-tree.txt @@ -593,7 +593,7 @@ the config options are in a table bound to the `config` key: } }, ["a"] = { - "add", + "add", nowait = true config = { show_path = "none" -- "none", "relative", "absolute" From 9dd8f93e1c38b6555f236801dea179b30003a335 Mon Sep 17 00:00:00 2001 From: pynappo Date: Fri, 17 Jan 2025 18:40:45 -0800 Subject: [PATCH 6/6] add to external filters as well --- lua/neo-tree/sources/common/filters/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/neo-tree/sources/common/filters/init.lua b/lua/neo-tree/sources/common/filters/init.lua index 8575c7eb..79d0336b 100644 --- a/lua/neo-tree/sources/common/filters/init.lua +++ b/lua/neo-tree/sources/common/filters/init.lua @@ -119,6 +119,9 @@ M.show_filter = function(state, search_as_you_type, keep_filter_on_submit) if search_as_you_type then popup_msg = "Filter:" end + if state.config.title then + popup_msg = state.config.title + end local width = vim.fn.winwidth(0) - 2 local row = height - 3