* fix: bookmark filter should include parent directory
* fix: dont match mark's siblings
* fix: match mark from the start
---------
Co-authored-by: Alexander Courtis <alex@courtis.org>
* feat(#2654): add `binaries` field to `filters`
* feat(#2648): allow functions in `filters.custom`
* ci: fix: stylua check
* ci: fix: add new keybind and config to docs
* fix: replace os-specific binary filter with `vim.fn.executable`
* fix: remove function and mapping for `binaries` filter
* fix: add `node` parameter to custom filter function
* fix: update doc for custom filter function signature
* fix: add custom filter to `ACCEPTED_TYPES`
* fix: accept single function for custom filter
* fix: change custom filter on `ACCEPTED_TYPES`
* fix: revert to using `path` for custom filter function
* fix: use `function` type for custom filter
* fix: type for custom filter in help
* fix: custom filter single function no longer mutates `M.config.filter_custom`
* fix: remove dead `if` statement in custom filter
* fix: separate custom filter function from `M.ignore_list`
* doc nit
---------
Co-authored-by: darcy <44690813+darccyy@users.noreply.github.com>
Co-authored-by: Alexander Courtis <alex@courtis.org>
* fix(#2382): use --absolute-git-dir when available
* fix(#2382): use --absolute-git-dir when available
* fix(#2382): rename private git members, destroy git watchers on purge
* fix(#2382): consistent naming of toplevel
* fix(#2382): more doc and safety
* fix(#2382): consistent naming of toplevel
* fix(#2382): consistent naming of toplevel
* feat(#2364): add option to show files first
* Refactor `folders_or_files_first` function
* Improve readability
* Remove `fallback` from `folders_or_files_first` function
---------
Co-authored-by: Alexander Courtis <alex@courtis.org>
* fix(#1931): do not execute git status in git ignored directories
* fix(#1931): reload.refresh_node is always asynchronous
* fix(#2327): set parent folder ignore status following file update
* feat: Watch $GIT_DIR for git changes, if set
While rarely used, it's possible to set the $GIT_DIR environment
variable to instruct git to use a directory other than `.git`.
This checks if that environment variable is set; if it is, the plugin
will watch that directory. If it's not set, it'll fall back to the
default `.git` directory.
* fix: Don't create two watchers for $GIT_DIR
This will ignore a path for watching if EITHER it's '.git', or the value
of $GIT_DIR (if it's set).
If $GIT_DIR is not set, the vim.env object returns `nil`, which will
never match `path`.
* fix: Attempt to make a relative $GIT_DIR absolute
* feat: adds new type of sorting based on the filename's suffix
* chore(syntax): using string colon methods
* fix(regex): use alphanumeric match for extensions
* feat: adds new type of sorting based on the filename's suffix
---------
Co-authored-by: Alexander Courtis <alex@courtis.org>
* fix(extension/sorter): fallbacks to C.name when both exts are the same or nil
* fix(nil): files with no extension
* fix(nil): files with no extension
---------
Co-authored-by: Alexander Courtis <alex@courtis.org>
* feat: adds new type of sorting based on vim's filetype detection
* fix(ft/sorter): fallbacks to C.name when both ft's are nil or equal
* feat: adds new type of sorting based on vim's filetype detection
---------
Co-authored-by: Alexander Courtis <alex@courtis.org>
* #1961 diagnostic logging refresh_nodes_for_path
* #1961 add cycle detection to refresh_nodes_for_path
* #1961 escape special characters on when path matching during refresh
* #1961 escape special characters on when path matching during refresh
* fix(#1822): test directory capable of watching before presenting it (#1901)
* feat(git): support `DA` state
Co-authored-by: Alexander Courtis <alex@courtis.org>
* coding style
* outlined git.show_on_open_dirs behavior
* show some icon on opendir even if show_on_open_dir=false
and show all children's status on parent
* fixed renamed icon not showing
* sorted icons
* removed DU from deleted as file will show up in tree
* fixed update_git_status in reloaders not tested
* fixed Api.git.reload()
Tested update_git_status in reloaders.lua
* sort icon only if not git signcolumn
* fixed crashing when root dir isn't git dir
* made git.show_on_dirs doc more concise
* git_statuses -> git_status for consistency
* explorer/common.lua -> explorer/node.lua
* fixed#1784 conflict
* don't order icons
* Revert "don't order icons"
This reverts commit 23f6276ef7.
* Filtered dir with git status that are open when show_on_open_dir is false
* refactored for single source of truth of existence of git status on a node
Putting `has_git_status()` in `explorer.common` because that's where node.status is constructed
Or at least I think that's where it's constructed
* 1786 semantic nit
Co-authored-by: Alexander Courtis <alex@courtis.org>
* fix(#1731): watcher refreshes node rather than the first node matching absolute path, profile refresh
* fix(#1731): reload explorer reloads closed folders
* fix(#1731): do not fire folder created event on file create
* fix(#1731): reload profile absolute path, not link to
* fix(#1731): find-file locks/profiles on real path, reloads when watchers disabled
* Revert "fix(#1731): reload explorer reloads closed folders"
This reverts commit 5dfd8bd2fa.
* fix(#1731): tidy watch reload
* fix(#1731): move refresh_node from watch to reload
* fix(#1731): find-file reloads all nodes for the containing directory
* fix(#1731): create-file refreshes synchronously
* fix(#1731): remove unused watch node
* fix(#1731): find-file refreshes root
* fix(#1716): create-file invokes find-file
* fix(#1731): refresh path walks down the tree to the targedt
* fix(#1615): focus created file when command line prompt requires confirmation
* fix(#1615): focus created file when command line prompt requires confirmation
* feat: Mixin Sorter (#1565) Self Solved
adding `mixin` sort options for `rust` like package systems
```
package.rs
package/
__inside__
lib.rs
lib/
_inside_
a.rs
b.rs
module.rs
```
* feat: sort_by, after_sort options for more convinient using
```
*nvim-tree.sort_by*
Changes how files within the same directory are sorted.
Can be one of 'name', 'case_sensitive', 'modification_time' or 'extension',
'function'.
>
sort_by = function(a, b)
if not (a and b) then
return true
end
if a.nodes and not b.nodes then
return true
elseif not a.nodes and b.nodes then
return false
end
return a.name:lower() <= b.name:lower()
end
end
Type: `string | function(a, b)`, Default: `"name"`
*nvim-tree.after_sort*
Related to nvim-tree.sort_by, this function runs without mergesort.
Can be defined by your own after-sort works.
Type: `function(table)`, Default: `disable`
>
after_sort = function(t)
local i = 1
while i <= #t do
if t[i] and t[i].nodes then
local j = i + 1
while j <= #t do
if t[j] and not t[j].nodes and t[i].name:lower() == t[j].name:lower():match "(.+)%..+$" then
local change_target = t[j]
table.remove(t, j)
table.insert(t, i, change_target)
break
end
j = j + 1
end
end
i = i + 1
end
end
```
* remove: after_sort ( misunderstood feature )
sort_by parameter can be function.
``` lua
sort_by = function(t)
local sorters = require "nvim-tree.explorer.sorters"
local comparator = sorters.retrieve_comparator("name")
sorters.split_merge(t, 1, #t, comparator) -- run default merge_sort
local i = 1
while i <= #t do
if t[i] and t[i].nodes then
local j = i + 1
while j <= #t do
if t[j] and not t[j].nodes and t[i].name:lower() == t[j].name:lower():match "(.+)%..+$" then
local change_target = t[j]
table.remove(t, j)
table.insert(t, i, change_target)
break
end
j = j + 1
end
end
i = i + 1
end
end,
```
* try-fix: change existing merge_sort function, call user's sort_by
hope.. like it...?
* doc: explain function parameter and return, add more complex example
* fix: reorder with user-comparator exceed memory limit
apply merge_sort
check nil & type for senitize
* fix: user_index based sorting ( create index )
for performance, create index once,
using index to re-ordering
* fix: fence problems
* doc & fix: merge_sort problem fix & nil sorting
add complex example
* fix: sort_by detect and use string and nil
* doc: revert sort_by to simple
* fix: sort_by does not return anything
Co-authored-by: Alexander Courtis <alex@courtis.org>
* feat(explorer): add experimental watchers
This commit introduces watchers to update the tree.
This behavior is introduced behind an "filesystem_watchers" option
which should prevent instabilities.
It will become the default at some point.
Co-authored-by: Alexander Courtis <alex@courtis.org>
next step needs to merge the reloader and the explorer, the ancient code
was super complicated and long and the new one is very similar to the explorer.