Commit Graph

972 Commits

Author SHA1 Message Date
Alexander Courtis
d949af7245 fix(#1804): do not refresh watched nodes that have been destroyed (deleted) 2022-12-19 14:36:42 +11:00
Ross Wilson
e0cfbbb93d
fix(copy-paste): fix message on clipboard clear (#1838)
* Clear clipboard function was calling utils to
  notify when the clipboard was cleared
* This produced a nil value error
* Replaced with notify
2022-12-19 09:59:38 +11:00
Richard Li
29788cc32a
fix(git): git folder fixes and improvements (#1809)
* 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.
2022-12-17 17:05:33 +11:00
Alexander Courtis
89c79cb33b fix(#1831): improve fs_scandir error handling, add profiling 2022-12-17 16:59:09 +11:00
Alexander Courtis
87409bb4af
fix(#1815): don't schedule find_file calls, debounce update_focused_file with 15ms default (#1828)
* Revert "Revert "fix(#1815): don't schedule find_file calls, debounce update_focused_file with 15ms default (#1820)""

This reverts commit a8d26bb088.

* fix(#1723): find_file for externally created new file results in folder unable to be opened

* fix(#1723): find_file for externally created new file results in folder unable to be opened
2022-12-16 15:35:09 +11:00
David Sierra DiazGranados
d85b6718ce
feat(picker): allow custom function actions.open_file.window_picker.picker (#1782)
* feat: allow passing a custom function as a window picker

WIP

* fix: move logic expression to if statement

If `M.window_picker.custom_function()` returns `nil` then `pick_win_id()`
will run (the or part). We don't want that. More verbose, but better.

* feat(open): add window_picker.picker

* feat(open): add window_picker.picker

* style nit

* feat(open): add window_picker.picker

* docs: add window_picker.picker documentation

* docs: add window_picker.picker documentation

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-12-16 15:14:33 +11:00
Richard Li
18272f8df3
fix(view): refresh opened files highlight on buffer read, unload (#1827) 2022-12-16 14:36:00 +11:00
Anton
e8ea62c198
fix(#1824): Don't modify jumplist when edit_in_place. (#1825) 2022-12-16 14:08:27 +11:00
Alexander Courtis
cdb40dc42e neovim requirement 0.7.0 -> 0.8.0, remove WinSeparator/VertSplit compatibility shims 2022-12-16 13:45:16 +11:00
Ian Homer
949913f186
feat(api): rename_basename API and action (#1791)
* relative rename action

* 🔥 remove debug print statement

* 🐛 better handling of dot files

Also pickout extension in filename with more one dot

* 🔧 keymap e for relative-rename action

* 📝 update help with relative-rename mapping

*  add API for rename_relative

* 🚨 correct lint warnings

* rename_relative -> rename_root

* stylua

* ♻️ use fnamemodify instead of custom logic

* 💥 refactor renaming api using vim filename modifiers

Rename API now supports filename modifiers as arguments, although
only with limited support of options. The function signature however
will allow improvements going forward. The API signature is backward
compatible, although the behviour has changed as per the next comment.

This change changes the default behaviour of the renames, rename_full is
what rename was, rename now just renames the tail (i.e. the filename)

* 🐛 make api rename, without args, functional

*  allow modifier argument to be used in API call

* 📝 update documentation with new command name

* rename-file.fn takes only a modifier as argument

* add Api.fs.rename_basename, specify modifiers for rename, rename_sub

* add Api.fs.rename_node

* rename-file tidy allowed modifiers

* 🐛 fix bugs after last refactoring

rename ":t" and ":t:r" was moving file to root of project and not
maintaining sub-directory

* 🐛 correct absolute rename

which was loosing sub-directory on rename

* 🔥 remove debug print statements

* stylua

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-12-16 13:32:48 +11:00
Alexander Courtis
a8d26bb088 Revert "fix(#1815): don't schedule find_file calls, debounce update_focused_file with 15ms default (#1820)"
This reverts commit 623cecb809.
2022-12-16 13:15:32 +11:00
Alexander Courtis
623cecb809
fix(#1815): don't schedule find_file calls, debounce update_focused_file with 15ms default (#1820)
* fix(#1815): don't schedule find file calls

* fix(#1815): debounce BufEnter find_file

* fix(#1815): deprecate nvim-tree.find_file

* fix(#1815): debounce BufEnter find_file

* fix(#1815): debounce BufEnter find_file
2022-12-16 13:01:37 +11:00
Alexander Courtis
95ed588211 fix(#549): add more profiling ~tree init 2022-12-16 12:12:06 +11:00
Alexander Courtis
899ed45602 fix(watcher): only purge on subsequent setup calls, add git_purge log 2022-12-16 11:47:50 +11:00
David
0cd8ac4751
fix: Implicit current buf on centralize selection (#1792) 2022-12-12 13:14:41 +01:00
Anton
a2c75567ad
feat(event): add WillRenameNode (#1821) 2022-12-12 11:56:50 +11:00
Alexander Courtis
8b4aaff783 remove legacy g: option migration 2022-12-12 09:50:52 +11:00
Eric Haynes
7177d95ac0
feat: paste and create always target closed folder, remove create_in_closed_folder (#1802)
* Fix default for file creation in closed directories

* Make paste in closed directories consistent with create

* doc: clarify create_in_closed_folder

* Remove create_in_closed_folder option

* doc: clarify create_in_closed_folder removal message (whoops)

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-12-11 14:40:38 +11:00
Alexander Courtis
c5dc80c36b
feat(view): add filters.git_clean, filters.no_buffer (#1784)
* feat(view): add filters.git_clean

* feat(view): add filters.git_clean

* feat(view): add filters.no_buffer

* feat(view): filters.no_buffer misses unloaded, handles buffer in/out

* feat(view): filters.no_buffer matches directories specifically

* feat(view): filters.no_buffer clarify targets

* feat: add placeholder filters.diagnostics_ok, refactor filters

* feat(view): remove placeholder filters.diagnostics_ok
2022-12-10 15:55:33 +11:00
Anton
e49fa4e529
feat(event): dispatch Event.NodeRenamed on cut-paste (#1817) 2022-12-10 11:29:05 +11:00
rishabhjain9191
69a07d169a
feat(view): always enable cursorline, users may change this behaviour via Event.TreeOpen (#1814)
* Update view.lua

* set cursorline to true
2022-12-10 11:20:40 +11:00
Richard Li
f8489c9929
fix(git): git rename not showing up for the renamed file (#1783)
* fixed git rename not showing up for the renamed file

* considered " -> " being a part of the filename

Fixed -> pattern to escape -
Fixed "\"" and "\\" in filename

* using string.find(, , true) to match plain ->

* Using -z and removed unnecessary logic
2022-12-03 14:56:38 +11:00
Richard Li
9d9c5711dc
1786 git next prev land on dirs (#1787)
* 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>
2022-12-03 14:39:00 +11:00
Richard Li
829e9f68e1
feat: add diagnostics.show_on_open_dirs git.show_on_open_dirs (#1778)
* feat(diagnostics): only show diagnostic on closed folder

* feat(git): only show git icon on closed folder
2022-11-29 11:12:34 +11:00
baahrens
0b319a1b28
feat(renderer): add NvimTreeOpenedFolderIcon NvimTreeClosedFolderIcon (#1768)
* feat: Add highlight group for opened folder

closes #1674

* docs: Add NvimTreeOpenedFolderIcon default

* feat: Add NvimTreeClosedFolderIcon highlight group

Defaults to NvimTreeFolderIcon
2022-11-28 11:17:09 +11:00
Alexander Courtis
b17358ff4d
fix(#1731 #1723 #1716): handle all external file system changes (#1757)
* 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
2022-11-26 14:19:09 +11:00
David Aguilera
99d713644d
feat(renderer): add renderer.root_folder_label (#1746)
* Add new renderer setting `add_root_updir` to fix #1743.

* Fix default value in docs.

* Remove proposed “add_root_updir” and rename “root_folder_modifier” to “root_folder_label”. Also, “root_folder_label” can be also a function now.

* chore: warn users about breaking change

* fix(#1743): use silent migration of root_folder_modifier

* fix(#1743): add example, document previous renderer.root_folder_modifier

* Add check to validate return type of “root_folder_label” is string.

* Change “root_folder_label” default value to “:~:s?$?/..?”.

* Add missing keyword “local” to local variable “label”.

Co-authored-by: David Aguilera <david.aguilera@neliosoftware.com>
Co-authored-by: gegoune <dev@clog.rocks>
Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-11-26 14:02:05 +11:00
Ibrahim Abdelkareem
68a2a0971e
feat(diagnostics): add diagnostics.severity (#1755)
* feat: Support diagnostics severity

* fix: Revert Hunk

* feat: Supports min/max severity

* feat: Supports min/max severity: tidy doc

* feat: Supports min/max severity: tidy doc

* feat: Supports min/max severity: tidy doc

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-11-21 09:09:09 +11:00
Alexander Courtis
cc18122be1 fix(notify): log file notice info->debug 2022-11-20 12:26:59 +11:00
Alexander Courtis
e38e061710 feat(api): add api.tree.get_nodes 2022-11-19 15:54:16 +11:00
Alexander Courtis
a65063cb0a fix(notify): remove unused varargs, log file notice debug->info 2022-11-19 14:34:39 +11:00
Wessel Blokzijl
c49499413a
feat(tabs): add tab.sync options (#1698)
* Sync closing of nvim-tree across tabs

* chore: remove vim.* "requires"

* Sync closing of nvim-tree across tabs

* Fix api.close calls

* Fix issue from merge

* Implement changes

* Finish todos and add close_all_tabs

* silently refactor options, add doc

* fix vinegar example

* Refactor close to work with tabid

* Close nvim tree if last buffer

* close and abandon all tabs on subsequent setup calls

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-11-19 13:57:45 +11:00
yazdani kiyan
1837751efb fix(paste): allow pasting into empty root directory
assign main explorer when node name is `..` to allow pasting into the
root directory when its empty.
Fixes #1736
2022-11-16 13:41:35 +01:00
yazdani kiyan
059e4cadd6 fix(paste): paste into empty root directory 2022-11-16 13:40:48 +01:00
Alexander Courtis
9d241e5f58 fix(system-open): use notify for system-open failures and tidy messages 2022-11-15 13:01:15 +11:00
Maxim Sokolov
cf908370fb
fix(#1740): Error while running :NvimTreeCollapseKeepBuffers (#1741) 2022-11-13 15:52:44 +11:00
Alexander Courtis
e204a7d819
fix(#1728): escape cwd changes to prevent environment variable expansion (#1729) 2022-11-12 14:50:14 +11:00
Alexander Courtis
bcb2a5a80d
fix(#1720): .git watch only FETCH_HEAD, HEAD, HEAD.lock, config, index (#1732)
* fix(#1720): .git watch only HEAD, config and index

* fix(#1720): .git watch only FETCH_HEAD, HEAD, HEAD.lock, config, index
2022-11-12 14:38:33 +11:00
Alexander Courtis
7e892767bd Revert "fix(#1716): focus file/directory when created in a sub-directory, don't dispatch FolderCreated on file creation (#1722)"
This reverts commit bdc4ec6abd.
2022-11-06 13:32:24 +11:00
Alexander Courtis
d91f885819 Revert "fix(#1723): find_file for externally created new file results in folder unable to be opened"
This reverts commit be2ccd4b1a.
2022-11-06 13:21:24 +11:00
Alexander Courtis
8cc369695b
fix: replace vim.* "requires" with explicit calls to vim functions (#1701) 2022-11-06 10:37:33 +11:00
Tomohiro Endo
6d6a44626d
fix(watcher): failure on watcher teardown message (#1726) 2022-11-06 10:30:12 +11:00
Alexander Courtis
bdc4ec6abd
fix(#1716): focus file/directory when created in a sub-directory, don't dispatch FolderCreated on file creation (#1722)
* fix(#1716): focus file/directory when created in a sub-directory, don't dispatch FolderCreated on file creation

* fix(#1716): focus file/directory when created in a sub-directory

* fix(#1716): focus file/directory when created in a sub-directory
2022-11-06 10:08:32 +11:00
Alexander Courtis
be2ccd4b1a
fix(#1723): find_file for externally created new file results in folder unable to be opened
* fix(#1723): find_file for externally created new file results in folder unable to be opened

* fix(#1723): find_file for externally created new file results in folder unable to be opened
2022-11-05 16:34:41 +11:00
Alexander Courtis
a0f3e99b2d
feat(watcher): tear down watcher on failue, warning the user (#1707) 2022-11-05 10:25:14 +11:00
Alexander Courtis
ed9db632a8
feat(watcher): add filesystem_watchers.ignore_dirs (#1705) 2022-11-05 10:24:25 +11:00
Alexander Courtis
33ce8e3c73
fix(#1711): open in a new window when no window picker and no available window (#1715) 2022-11-05 10:23:03 +11:00
kylo252
6ca6f99e76
feat(notify): add notify.threshold (#1693)
* feat: configurable notification level

add `notify.threshold` to setup opts

* feat: configurable notification level: add threshold example doc

* feat: configurable notification level: log always comes last

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-11-01 10:24:40 +11:00
David Brouwer
ada2c6441d
fix(#1712): invalid window ID on colorscheme (#1714) 2022-11-01 10:04:47 +11:00
wyrid
cd2f7569db
feat(api): add api.marks.clear (#1708) 2022-11-01 08:46:56 +11:00