Commit Graph

278 Commits

Author SHA1 Message Date
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
emmanueltouzery
79f631bc1d
feat(view): add float.quit_on_focus_loss, float respects actions.open_file.quit_on_open (#1621) 2022-10-08 14:35:20 +11:00
Alexander Courtis
c5536db0b7
fix(#1270): open_on_setup_file does not override open_on_setup, hijack_directories does not override startup behaviour (#1618) 2022-10-08 14:25:38 +11:00
longguzzz
7282f7de8a
feat: add NvimTreeCursorLineNr (#1616) 2022-10-01 12:51:22 +02:00
Alexander Courtis
0417d9148b feat: focus_empty_on_setup 2022-09-22 15:15:03 +10:00
Alexander Courtis
540055be5f
chore: document :NvimTreeFindFile! and add bang :NvimTreeFindFileToggle! 2022-09-22 14:18:49 +10:00
Alexander Courtis
fbd421da71 chore: remove non-functional sides bottom/top 2022-09-22 13:53:09 +10:00
Alexander Courtis
ac8d259bad fix(prompt): add select_prompts to suit UI decorator plugins such as dressing and telescope 2022-09-22 13:23:49 +10:00
KuuWang
3676e0b124
feat(sorters): allow user sort_by
* 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>
2022-09-18 16:00:49 +10:00
Alexander Courtis
fb8735e96c doc: eager netrw disabling 2022-09-11 11:41:12 +10:00
Mivort
e8bf3d778a
feat(renderer): add renderer.indent_width (#1505)
* feat: add config option for a tree indent width

add 'indent_width' option to configure visible indent for tree nesting
levels (default is 2).

* add 'bottom' char for a corner extension

* apply stylua formatting

* provide value constraints in documentation

* limit minimal indent width

* make marker symbols have one utf8 char width

* match stylua formatting

* add the commentary regarding utf-8 first symbol match
2022-08-30 09:44:30 +10:00
Alexander Courtis
c3ea264947
feat(view): allow function for view.float.open_win_config (#1538) 2022-08-23 17:14:23 +10:00
Hoang Nguyen
a73d0d4800
feat(file-popup): add actions.file_popup.open_win_config
* file-popup: add nvim_open_win configuration

* docs: update file-popup configuration
2022-08-08 10:52:14 +10:00
Krzysztof Cieśla
7323c81bd6
feat(view): Floating nvim tree window #1377 (#1462)
* Simple mock-up of floating nvim-tree window

* Passing whole table to nvim_open_win()

* Run update-help.sh

* Use vim.api alias

* Add comment to float options

* Added `anchor` to float options

* Enabling float window enforces `actions.open_file.quit_on_open`

* Added documentation

* add view.float.open_win_config, skipping validation

* Made nvim-tree window closes when float is enabled

* Close nvim-tree window when out of focus

* Update help

Co-authored-by: Krzysztof Cieśla <krzysztof.marcin.ciesla@cern.ch>
Co-authored-by: Alexander Courtis <alex@courtis.org>
2022-08-06 15:40:07 +10:00
Alexander Courtis
1685484738
doc: reinstate mapping doc, mark on_attach as experimental (#1481) 2022-08-02 13:59:51 +02:00
Austin Harris
7fcb48c852
feat: add option for folder arrows to be inline with indent markers (#1468) 2022-07-28 11:49:23 +02:00
Kian-Meng Ang
2928f8fe31
fix(docs): typos (#1470) 2022-07-27 13:48:14 +02:00
Kiyan
64cc3c17e1
feat(mapping): deprecate user mappings and add on_attach (#1424) 2022-07-26 11:09:39 +02:00
kiyan
5f30a7bee4 chore(config): enable filesystem watchers by default 2022-07-26 10:46:59 +02:00
kiyan
e5222970d9 chore(api): add missing functions 2022-07-25 15:02:55 +02:00