Commit Graph

297 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
b9aaf805a1 doc: format help 2022-12-11 12:12:19 +11:00
Alexander Courtis
3c5d9dd31f doc: consolidate and clarify :help examples 2022-12-10 16:25:02 +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
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
9f7bed5536 doc: specify that the terminal emulator must be configured to use the patched font 2022-11-28 10:26:37 +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
e38e061710 feat(api): add api.tree.get_nodes 2022-11-19 15:54:16 +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
Alexander Courtis
ed9db632a8
feat(watcher): add filesystem_watchers.ignore_dirs (#1705) 2022-11-05 10:24:25 +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
wyrid
cd2f7569db
feat(api): add api.marks.clear (#1708) 2022-11-01 08:46:56 +11:00
wyrid
cbb5313f90
feat(api): add api.fs.clear_clipboard (#1706)
* feat: command to clear the clipboard

* feat: command to clear the clipboard: stylua

* feat: command to clear the clipboard: add to :help

Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-10-31 15:48:05 +11:00
Alexander Courtis
1044eba9e7 doc: update event subscription example 2022-10-31 13:59:03 +11:00
Alexander Courtis
cb98892dea doc: add hitest notes and add termguicolors to example setups 2022-10-29 12:45:24 +11:00
Alexander Courtis
1be1e17be5 doc(#1676): clarify view.mapping.list contents including case of key 2022-10-25 09:37:02 +11:00
Ofir Gal
23c0fe9a0a
Added NvimTreeLineNr higlight (#1684) 2022-10-24 19:53:13 +00:00
Alexander Courtis
58055a0397 doc(#1672): clarify mappings example and doc 2022-10-24 11:45:33 +11:00
Alexander Courtis
ea09ab497e doc(#731): add single mouse mapping notes 2022-10-23 10:25:18 +11:00
Alexander Courtis
3a2f68b9d5 fix(#1668): revert all startup behaviour changes back to 540055b 2022-10-18 11:14:35 +11:00
Alexander Courtis
4e24505e2b
fix(#1664): respect hijack_directories.enable on startup when not open_on_setup (#1665) 2022-10-17 14:49:57 +11:00
Alexander Courtis
6ff828b25b doc: vim.g.loaded -> vim.g.loaded_netrw 2022-10-15 10:50:07 +11:00
Alexander Courtis
c66cbdfc25
fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer (#1634)
* fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer

* Revert "fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer"

This reverts commit e7136078f7.

* fix(#1629): nvim start with file named *NvimTree* treats file as tree

* fix(#1629): nvim start with file named *NvimTree* treats file as tree
2022-10-11 10:00:03 +11:00
kiyan
b4d704e88d chore: replace urls from kyazdani42 -> nvim-tree 2022-10-08 11:31:57 +02:00
Alexander Courtis
4a01f90d11 feat(view): float.quit_on_focus_loss documentation clarification 2022-10-08 14:39:23 +11:00