Commit Graph

1510 Commits

Author SHA1 Message Date
Alexander Courtis
74959750f7
feat: automated migration from view.mappings.list to on_attach, see https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach (#1579)
* chore(mappings): migrate legacy mappings under the hood

* chore(mappings): POC for help and :help on_attach keymaps

* chore(mappings): POC for help and :help on_attach keymaps

* chore(mappings): add desc to all mappings, show in help, reformat help

* chore(mappings): add desc to all mappings

* chore(mappings): add desc to all mappings

* chore(mappings): escape help keys

* chore(mappings): migrate legacy mappings under the hood: map keymap to legacy mappings

* chore(mappings): migrate legacy mappings under the hood: remove dispatch

* Revert "chore(mappings): migrate legacy mappings under the hood: remove dispatch"

This reverts commit f6f439ba59.

* chore(mappings): migrate legacy mappings under the hood: pass node to action_cb

* chore(mappings): migrate legacy mappings under the hood: remove dispatch

* chore(mappings): migrate legacy mappings under the hood: replace mappigns with keymaps in help

* chore(mappings): generate on_attach from user's legacy mappings

* chore(mappings): generate on_attach from user's legacy mappings

* chore(mappings): merge cleanup

* chore(mappings): use default mappings when on_attach not present, log legacy migration

* on_attach is default or user only, legacy and generation includes defaults (#1777)

* chore(mappings): remove mappings via vim.keymap.del instead of filtering mappings, to allow for multiple ways of specifying a key

* doc: specify that the terminal emulator must be configured to use the patched font

* 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

* 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

* docs: Update feature_request.md (#1788)

* Update feature_request.md

Closes #1654

* Update feature_request.md

Co-authored-by: Alexander Courtis <alex@courtis.org>

* 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>

* 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

* feat(view): always enable cursorline, users may change this behaviour via Event.TreeOpen (#1814)

* Update view.lua

* set cursorline to true

* feat(event): dispatch Event.NodeRenamed on cut-paste (#1817)

* 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

* doc: consolidate and clarify :help examples

* doc: format help

* 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>

* on_attach is user's or default, nothing else; legacy generated on_attach includes defaults

Co-authored-by: baahrens <bahrens@compeon.de>
Co-authored-by: Richard Li <38484873+chomosuke@users.noreply.github.com>
Co-authored-by: gegoune <69750637+gegoune@users.noreply.github.com>
Co-authored-by: rishabhjain9191 <rishabh.jain9191@gmail.com>
Co-authored-by: Anton <14187674+antosha417@users.noreply.github.com>
Co-authored-by: Eric Haynes <ehaynes99@gmail.com>

* on_attach_default hardcoded

* format default_on_attach

* source default on_attach directly

* remove human mappings help

* simplified on_attach generation

* simplified on_attach generation

* generate default on_attach

* generate default on_attach

* split out keymap_legacy

* add recently introduced mappings

* legacy api.config.mappings.active and default

* legacy api.config.mappings.active and default

* on_attach help and readme

* legacy generate handles action = ""

* legacy generate handles action =

* legacy generate gives defaults when no user mappings

* legacy generate handles action = ""

* legacy generate api handles overrides

* legacy generate handles subsequent setup, on_attach retains deep copies of legacy config

* add wiki link to generated on_attach

* add opts helper function for on_attach, prefixing 'nvim-tree: '

---------

Co-authored-by: kiyan <yazdani.kiyan@protonmail.com>
Co-authored-by: baahrens <bahrens@compeon.de>
Co-authored-by: Richard Li <38484873+chomosuke@users.noreply.github.com>
Co-authored-by: gegoune <69750637+gegoune@users.noreply.github.com>
Co-authored-by: rishabhjain9191 <rishabh.jain9191@gmail.com>
Co-authored-by: Anton <14187674+antosha417@users.noreply.github.com>
Co-authored-by: Eric Haynes <ehaynes99@gmail.com>
2023-02-27 14:19:50 +11:00
Alexander Courtis
9c97e6449b
fix(#1961): stop unnecessary find file refreshes, avoid find file refresh cycles (#2010) 2023-02-21 10:34:01 +11:00
Kai Ting
66c15afd13
fix(#2004): relative path detection handles regex magic (#2005)
* fix(#2004): Change path_relative to use string find and substring to avoid using regex.

- This removed the original gsub with unintentional captures in path_to_matching_str
- The original regex based code captures create a limit where input path cannot
  have more than 32 special charactors ( `.`  , `_` or `-`)

* style nit

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
2023-02-20 10:15:42 +11:00
Alexander Courtis
04f99f14b5
fix(#2003): obey user split command for modified buffers when hidden not set (#2008) 2023-02-20 10:04:55 +11:00
Alexander Courtis
bcb969c869
doc(#1997): clarify renderer.highlight_ and correct highlight group names (#2007) 2023-02-19 11:24:35 +11:00
Alexander Courtis
08a0aa1a3b Revert "fix(#1961): cycle detection on refresh, preventing infinite loop (#1996)"
This reverts commit 4222bb875d.
2023-02-15 09:24:12 +11:00
Alexander Courtis
4222bb875d
fix(#1961): cycle detection on refresh, preventing infinite loop (#1996)
* #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
2023-02-14 15:08:41 +11:00
Alexander Courtis
8b8d457e07
fix(#1993): always fire TreeOpen event (#1994) 2023-02-13 14:57:01 +11:00
Alexander Courtis
ba1778e061
fix(#1923): handle empty git icons (#1987) 2023-02-13 10:32:02 +11:00
Alexander Courtis
36e29c3a95
fix(#1970): disable git integration after 5 timeouts (#1990)
* fix(#1970): additional log function gating for efficiency when not logging

* fix(#1970): additional log function gating for efficiency when not logging

* fix(#1970): disable git integration after 10 timeouts

* fix(#1970): disable git integration after 10 timeouts

* fix(#1970): disable git integration after 10 timeouts

* fix(#1970): cleanly kill timed out git processes

* fix(#1970): revert git kill, to be completed via #1974 experiment

* fix(#1970): revert git kill, to be completed via #1974 experiment
2023-02-12 14:28:48 +11:00
Alexander Courtis
b712b82b0c
fix(#1961): harden profiling functions (#1986) 2023-02-11 17:05:01 +11:00
Alexander Courtis
02fdc262eb
fix(#1970): additional log function gating for efficiency when not logging (#1971)
* fix(#1970): additional log function gating for efficiency when not logging

* fix(#1970): additional log function gating for efficiency when not logging
2023-02-06 10:23:20 +11:00
Alexander Courtis
59e65d88db doc: README: broadcast Open At Startup change 2023-02-05 12:39:14 +11:00
Alexander Courtis
7eb33d2a6d
fix(#1831): remove instrumentation (#1969) 2023-02-04 16:57:05 +11:00
Alexander Courtis
e0166d1469
fix(#1831): remove instrumentation (#1968) 2023-02-04 16:54:36 +11:00
Alexander Courtis
8505b6ecd8
fix(#1923): handle empty git icons (#1952)
* 1923 skip empty git icons

* 1923 skip empty git icons
2023-02-04 16:27:27 +11:00
Alexander Courtis
215b29bfad
feat(api): api.tree.open feature parity with api.tree.toggle (#1955) 2023-01-31 12:27:10 +11:00
Alexander Courtis
f3b73725c5 stylua: nit 2023-01-30 11:51:30 +11:00
Alexander Courtis
9fcd50d3e1 doc: clarify open/toggle defaults, more robust legacy argument handling 2023-01-30 11:49:21 +11:00
Alexander Courtis
fb775b3353
feat(view): deprecate open_on_setup.* in favour of https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup (#1951) 2023-01-30 10:10:41 +11:00
Adam Karim
e14989c0ea
Remove what appears to have been a debug message. (#1949) 2023-01-28 12:51:28 +01:00
Alexander Courtis
8567841b87
fix(#1946): only change vim's global cwd on startup when opening the tree (#1947) 2023-01-28 14:48:05 +11:00
Peter van der Meulen
e05ed6a60f
feat(view): add view.width.padding (#1941)
* fix: variable width accounts for sign/number columns

* Add dynamic sizing padding options

with https://github.com/neovim/neovim/pull/20621 merged in it is now
possible to fully customize the status-column in nvim (the column on the
left containing line-numbers, fold info, signs and borders).

A fair few cool implementations have popped up like:
- https://github.com/CKolkey/config/blob/master/nvim/after/plugin/statuscolumn.lua
- https://github.com/luukvbaal/statuscol.nvim
- and my own personal one (based on CKolkey's fantastic work) https://git.hendrikpeter.net/hendrikpeter/pico-vim/-/blob/main/lua/peva/status_column.lua

The problem with nvim-tree however is that dynamic sizing doesn't take
the custom size of a status column into account and the end of file
names get clipped off. This little patch should fix that (and give some
examples to help other status_column modders get started).

Thanks for looking at this and thanks for making this amazing plugin,
I've been using it for a while and I really like it!

* allow padding function, update docs, rollback readme

* typo in example setup

* help formatting

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
2023-01-28 14:07:14 +11:00
tummetott
55028e30d7
fix(#1942): nvim-tree window options do not trigger OptionSet event (#1945) 2023-01-28 13:31:27 +11:00
Alexander Courtis
9e87ee2d6e fix(#1940): NvimTreeFindFileToggle focus tree 2023-01-26 10:38:47 +11:00
Joanjajas
7944e479c1
doc: fix incorrect tag (#1938) 2023-01-24 12:55:59 +11:00
Alexander Courtis
f1c2d6d372
feat(api): api.tree.open/toggle: add current_window option (#1935)
* feat(api): api.tree.open: add current_window option

* feat(api): api.tree.toggle: add current_window option

* feat(api): api.tree.toggle: add current_window option

* doc: api.tree.*

* doc: api.tree.*
2023-01-24 08:30:49 +11:00
yioneko
16f2806d59
fix: remove redundant file existence check in create file operation (#1936) 2023-01-23 15:12:45 +11:00
ramezgerges
96506fee49
feat(view): add view.width.min/max replacing adaptive_size, allowing upper bound (#1915)
* feat: max_width for adaptive_size

* view grow calculates size correctly based on sign column visibility

* limit width to a minimum of 20

* adaptive_size -> min/max table

* harden view size calculations against bad user input

* style

* add back an extra column of padding to adaptive resizing

* back out: limit width to a minimum of 20

* revert unnecessary change

* backout: view grow calculates size correctly based on sign column visibility

* remove adaptive_size from help

* backout unnecessary change M.View.config

Co-authored-by: Alexander Courtis <alex@courtis.org>
2023-01-21 15:21:18 +11:00
Alexander Courtis
13adc94e8e doc: clarify system_open, specifying defaults 2023-01-21 11:54:24 +11:00
Alexander Courtis
e8a89db1bb doc: move vinegar-style to wiki 2023-01-17 12:02:42 +11:00
Alexander Courtis
1b13a49f91
fix(#1916): suppress EPERM watcher failures on windows (#1919) 2023-01-16 13:00:57 +11:00
Alexander Courtis
1f0fc8d6e8
feat(event): add au, global: NvimTreeRequired, NvimTreeSetup (#1912)
* feat(even): add autocommands NvimTreeRequired, NvimTreeSetup

* feat(event): add vim.g.NvimTreeRequired, vim.g.NvimTreeSetup
2023-01-15 10:12:50 +11:00
gegoune
3ce0a8e770
feat(git): support DA state, fix(#1822): test directory capable of watching before presenting it (#1905)
* fix(#1822): test directory capable of watching before presenting it (#1901)

* feat(git): support `DA` state

Co-authored-by: Alexander Courtis <alex@courtis.org>
2023-01-10 13:32:53 +11:00
Telman Babayev
ccb6d8a518
feat: add ui.confirm.remove and ui.confirm.trash, deprecate trash.require_confirm (#1887)
* Implement turning off y/n prompt for file deletion

* Refactor different prompt configs to single ui table

* Remove unused fields

* add ui.confirm doc, format/tidy

* trash.require_confirm -> ui.confirm.trash

* Fix nil value trash field

Co-authored-by: Alexander Courtis <alex@courtis.org>
2023-01-08 17:43:01 +11:00
gegoune
5b554a9e2d
ci: fix release-please workflow (#1899) 2023-01-08 02:38:01 +01:00
dependabot[bot]
3a42468a58
chore(deps): bump JohnnyMorganz/stylua-action from 1 to 2 (#1897) 2023-01-08 02:16:23 +01:00
dependabot[bot]
f2ee30998e
chore(deps): bump actions/checkout from 2 to 3 (#1898)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-07 11:31:28 +01:00
gegoune
92a0802b88
ci: add release-please workflow (#1892)
Closes https://github.com/nvim-tree/nvim-tree.lua/issues/1881
2023-01-07 11:29:21 +01:00
Alexander Courtis
f43f3110a5
feat(event): add TreeAttachedPost (#1877)
* feat(event): add OnAttachPost

* feat(event): add TreeAttachPost

* feat(event): add TreeAttachPost

* feat(event): TreeAttachedPost fired after all mappings created, not just on_attach
2023-01-07 11:50:41 +11:00
Alexander Courtis
bac962caf4
feat(api): add api.config.mappings.active, api.config.mappings.default (#1876)
* feat(api): add config.mappings.current and config.mappings.default

* feat(api): add config.mappings.current and config.mappings.default

* feat(api): add config.mappings.current and config.mappings.default
2023-01-03 13:13:49 +11:00
Richard Li
cdbd7daf29
fix(#1878): nvim frozen on no name buffer when modified.enable (#1879) 2023-01-03 13:11:14 +11:00
Richard Li
951b6e7e55
fix(#1836): add view.debounce_delay (#1871)
* fix(#1836):add view.debounce_delay to avoid some unnecessary explorer reloads

* fixed BufReadPost & BufUnload nil pointer

* update_focused_file.debouce_delay to view.debounce_delay

* changed docs to be more accurate

* added debounce on modified update

* Using same event for filter buffer

* removed unused View.debounce_delay

* changed docs to be more accurate

Co-authored-by: doot <gugegby@gmail.com>
Co-authored-by: Alexander Courtis <alex@courtis.org>
2023-01-02 07:32:56 +11:00
Alexander Courtis
e322fbb80b chore: remove diagnostic suppressions after tidying nits 2023-01-01 13:27:05 +11:00
Alexander Courtis
9d27c9ebea doc: add recipes and tips links to API 2023-01-01 08:32:18 +11:00
Alexander Courtis
013b4982d9 doc: add recipes and tips links to API 2023-01-01 08:31:47 +11:00
Richard Li
dcc344cc72
feat(view): indicate modified buffers (#1835)
* Outlined new options

* highlight_modified is highlight_opened_files

* prototype with autocmd

* moved modified into glyphs

* show_on_dirs and show_on_open_dirs

* icon placement before & after

* _get_filename_offset

* fixed :wq doesn't update modified indicator

* highlight_modified, signcolumn modified_placement

Refactored to make everything use HighlightedString to remove all the complex `insert_highlight` calculation.
Not tested.

* updated doc to match the reality of no multi char for glyphs.modified

* fixed git signcolumn doesn't show

* fixed highlight_modified gets replaced by highlight_opened_files

* fixed renderer.icons.show.modified = false crash

* updated doc to reflect empty icon not breaking rendering

* removed debounce_delay to implement in a later PR

* doc nit: order placement

* change modified dirs default to be consistent with git

* illegal git & modified placement changed to default

* don't assume icon exist

* nit remove comment

* Noted in doc that glyphs can't have more than 2 characters if in signcolumn

* Don't sign_define if placement isn't signcolumn

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-12-31 15:54:04 +11:00
youkwhd
9ad93b6ac0
feat(view): add view.cursorline (#1859)
* feat(#1814): added cursorline config to DEFAULT_OPTS

Extends #1814

Currently, the config cursorline is set to `true` by default.

This behaviour can only be changed by a hacky way of listening to an event, as @alex-courtis mentioned that: "The user can change this default if they want via event".

This PR generalizes the configuration to be easier to config via the function `setup()`.

* doc: add cursorline

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-12-31 15:27:31 +11:00
Alexander Courtis
3c4958ab3d
fix(#1831): remove windows executable functionality due to occasional vim freeze and performance concerns (#1868)
* #1831 exploratory testing: disable file executable checks

* fix(#1831): remove windows executable functionality
2022-12-31 12:34:55 +11:00
Alexander Courtis
9e4c39572f
fix(#1833): do not find file when view is not visible on the current tab (#1845) 2022-12-23 12:47:39 +11:00