mirror of
https://github.com/nvim-tree/nvim-tree.lua.git
synced 2026-07-28 07:49:46 +05:30
Compare commits
9 Commits
nvim-tree-
...
01970ed801
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01970ed801 | ||
|
|
82f58063d6 | ||
|
|
07f541fcaa | ||
|
|
f9bfc0059e | ||
|
|
24cfcc9437 | ||
|
|
5f65bd3d93 | ||
|
|
5a1d08bc0c | ||
|
|
d277467fc0 | ||
|
|
509962f21a |
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: install lua ${{ matrix.lua_version }}
|
||||
uses: leafo/gh-actions-lua@v12
|
||||
uses: leafo/gh-actions-lua@v13
|
||||
with:
|
||||
luaVersion: ${{ matrix.lua_version }}
|
||||
|
||||
@@ -87,11 +87,12 @@ jobs:
|
||||
- run: make format-check
|
||||
|
||||
- name: build Nvim from source
|
||||
if: ${{ matrix.nvim_version == 'stable' }}
|
||||
run: |
|
||||
mkdir -p "${DIR_NVIM_SRC}"
|
||||
curl -L "https://github.com/neovim/neovim/archive/refs/tags/${{ matrix.nvim_version }}.tar.gz" | tar zx --directory "${DIR_NVIM_SRC}/.."
|
||||
cd "${DIR_NVIM_SRC}"
|
||||
make doc
|
||||
make lintdoc
|
||||
|
||||
- run: make help-check
|
||||
if: ${{ matrix.nvim_version == 'stable' }}
|
||||
|
||||
2
.github/workflows/release-please.yml
vendored
2
.github/workflows/release-please.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: googleapis/release-please-action@v4
|
||||
- uses: googleapis/release-please-action@v5
|
||||
id: release
|
||||
- uses: actions/checkout@v6
|
||||
- name: tag major and minor versions
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "1.17.0"
|
||||
".": "1.17.1"
|
||||
}
|
||||
|
||||
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## [1.17.1](https://github.com/nvim-tree/nvim-tree.lua/compare/nvim-tree-v1.17.0...nvim-tree-v1.17.1) (2026-06-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **#3312:** correct cursor when full name shown, requires nvim 0.12.2+ ([#3316](https://github.com/nvim-tree/nvim-tree.lua/issues/3316)) ([d277467](https://github.com/nvim-tree/nvim-tree.lua/commit/d277467fc0d1d0e2bca88165a1de6b526f9f6fe8))
|
||||
* **#3324:** deprecated BufModifiedSet event replaced by OptionSet event for Nvim 0.13+ ([#3325](https://github.com/nvim-tree/nvim-tree.lua/issues/3325)) ([f9bfc00](https://github.com/nvim-tree/nvim-tree.lua/commit/f9bfc0059eca24546b69a7006110463da4808f8f))
|
||||
* **#3327:** pass nvim_tree.api.node.open.Opts to all applicable nvim_tree.api.node.open function ([#3329](https://github.com/nvim-tree/nvim-tree.lua/issues/3329)) ([07f541f](https://github.com/nvim-tree/nvim-tree.lua/commit/07f541fcaa4a5ae019598240362449ab7e9812b3))
|
||||
* **full-name:** lower `zindex` to get consistent cursor shape ([d277467](https://github.com/nvim-tree/nvim-tree.lua/commit/d277467fc0d1d0e2bca88165a1de6b526f9f6fe8))
|
||||
|
||||
## [1.17.0](https://github.com/nvim-tree/nvim-tree.lua/compare/nvim-tree-v1.16.0...nvim-tree-v1.17.0) (2026-04-07)
|
||||
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ make help-update
|
||||
- Generate config classes `*nvim-tree-config*`
|
||||
- Generate API `*nvim-tree-api*`
|
||||
|
||||
## Checking And Linting
|
||||
## Checking
|
||||
|
||||
This is run in CI. Commit or stage your changes and run:
|
||||
|
||||
@@ -194,7 +194,6 @@ make help-check
|
||||
|
||||
- Re-runs `make help-update`
|
||||
- Checks that `git diff` is empty, to ensure that all content has been generated. This is why a stage or commit is necessary.
|
||||
- Lints `doc/nvim-tree-lua.txt` using `scripts/vimdoc.sh lintdoc` to check for no broken links etc.
|
||||
|
||||
# Windows
|
||||
|
||||
|
||||
4
Makefile
4
Makefile
@@ -43,11 +43,9 @@ help-update:
|
||||
|
||||
#
|
||||
# CI
|
||||
# --ignore-blank-lines is used as nightly has removed unnecessary blank lines that stable (0.11.5) currently inserts
|
||||
#
|
||||
help-check: help-update
|
||||
scripts/vimdoc.sh lintdoc
|
||||
git diff --ignore-blank-lines --exit-code doc/nvim-tree-lua.txt
|
||||
git diff --exit-code doc/nvim-tree-lua.txt
|
||||
|
||||
|
||||
.PHONY: all lint style check luacheck style-check style-doc luals format-fix format-check help-update help-check
|
||||
|
||||
@@ -1075,8 +1075,6 @@ Config *nvim-tree-config*
|
||||
• {log}? (`nvim_tree.config.log`)
|
||||
|nvim_tree.config.log|
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: sort *nvim-tree-config-sort*
|
||||
|
||||
@@ -1115,8 +1113,6 @@ Config: sort *nvim-tree-config-sort*
|
||||
folders. Has no effect when {sorter} is a function.
|
||||
Overrides {folders_first}.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: view *nvim-tree-config-view*
|
||||
|
||||
@@ -1201,8 +1197,6 @@ Config: view *nvim-tree-config-view*
|
||||
• {padding}? (`nvim_tree.config.view.width.spec`, default: `1`)
|
||||
Extra padding to the right.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: renderer *nvim-tree-config-renderer*
|
||||
|
||||
@@ -1447,8 +1441,6 @@ Config: renderer *nvim-tree-config-renderer*
|
||||
• {bottom}? (`string`) (default: `"─"`)
|
||||
• {none}? (`string`) (default: `" "`)
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: hijack_directories *nvim-tree-config-hijack-directories*
|
||||
|
||||
@@ -1465,8 +1457,6 @@ Config: hijack_directories *nvim-tree-config-hijack-directories*
|
||||
• {auto_open}? (`boolean`, default: `true`) Open if the tree was
|
||||
previously closed.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: update_focused_file *nvim-tree-config-update-focused-file*
|
||||
|
||||
@@ -1497,8 +1487,6 @@ Config: update_focused_file *nvim-tree-config-update-focused-file*
|
||||
tree if the file isn't found under the current root
|
||||
directory.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: git *nvim-tree-config-git*
|
||||
|
||||
@@ -1531,8 +1519,6 @@ Config: git *nvim-tree-config-git*
|
||||
• {cygwin_support}? (`boolean`, default: `false`) Use `cygpath` if
|
||||
available to resolve paths for git.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: diagnostics *nvim-tree-config-diagnostics*
|
||||
|
||||
@@ -1565,8 +1551,6 @@ Config: diagnostics *nvim-tree-config-diagnostics*
|
||||
• {warning}? (`string`) (default: `""` )
|
||||
• {error}? (`string`) (default: `""` )
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: modified *nvim-tree-config-modified*
|
||||
|
||||
@@ -1587,13 +1571,11 @@ Config: modified *nvim-tree-config-modified*
|
||||
indication on open directories. Requires
|
||||
{show_on_dirs}.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: filters *nvim-tree-config-filters*
|
||||
|
||||
*nvim_tree.config.filters*
|
||||
Filters may be applied to the tree to exlude the display of
|
||||
Filters may be applied to the tree to exclude the display of
|
||||
file/directories.
|
||||
|
||||
Multiple filters may be applied at once.
|
||||
@@ -1642,8 +1624,6 @@ Config: filters *nvim-tree-config-filters*
|
||||
(default: `{}`)
|
||||
• {exclude}? (`string[]`) (default: `{}`)
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: live_filter *nvim-tree-config-live-filter*
|
||||
|
||||
@@ -1660,8 +1640,6 @@ Config: live_filter *nvim-tree-config-live-filter*
|
||||
• {always_show_folders}? (`boolean`, default: `true`) Whether to filter
|
||||
folders or not.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: filesystem_watchers *nvim-tree-config-filesystem-watchers*
|
||||
|
||||
@@ -1708,8 +1686,6 @@ Config: filesystem_watchers *nvim-tree-config-filesystem-watchers*
|
||||
{debounce_delay}. Set to 0 to allow unlimited
|
||||
consecutive events.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: actions *nvim-tree-config-actions*
|
||||
|
||||
@@ -1831,8 +1807,6 @@ Config: actions *nvim-tree-config-actions*
|
||||
displays a file when removing that file from the
|
||||
tree.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: trash *nvim-tree-config-trash*
|
||||
|
||||
@@ -1846,8 +1820,6 @@ Config: trash *nvim-tree-config-trash*
|
||||
Fields: ~
|
||||
• {cmd}? (`string`) (default: `"gio trash"` or `"trash"`)
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: tab *nvim-tree-config-tab*
|
||||
|
||||
@@ -1867,8 +1839,6 @@ Config: tab *nvim-tree-config-tab*
|
||||
• {ignore}? (`string[]`, default: `{}`) List of filetypes or buffer
|
||||
names on new tab that will prevent `open` and `close`
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: notify *nvim-tree-config-notify*
|
||||
|
||||
@@ -1886,8 +1856,6 @@ Config: notify *nvim-tree-config-notify*
|
||||
• {absolute_path}? (`boolean`, default: `true`) Use absolute paths in
|
||||
FS action notifications, otherwise item names.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: bookmarks *nvim-tree-config-bookmarks*
|
||||
|
||||
@@ -1900,8 +1868,6 @@ Config: bookmarks *nvim-tree-config-bookmarks*
|
||||
Fields: ~
|
||||
• {persist}? (`boolean|string`) (default: `false`)
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: help *nvim-tree-config-help*
|
||||
|
||||
@@ -1915,8 +1881,6 @@ Config: help *nvim-tree-config-help*
|
||||
Fields: ~
|
||||
• {sort_by}? (`nvim_tree.config.help.sort_by`) (default: `"key"`)
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: ui *nvim-tree-config-ui*
|
||||
|
||||
@@ -1935,8 +1899,6 @@ Config: ui *nvim-tree-config-ui*
|
||||
• {default_yes}? (`boolean`, default: `false`) If `true` the prompt
|
||||
will be `Y/n`, otherwise `y/N`
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: experimental *nvim-tree-config-experimental*
|
||||
|
||||
@@ -1946,8 +1908,6 @@ Config: experimental *nvim-tree-config-experimental*
|
||||
In the event of a problem please disable the experiment and raise an
|
||||
issue.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: log *nvim-tree-config-log*
|
||||
|
||||
@@ -1982,8 +1942,6 @@ Config: log *nvim-tree-config-log*
|
||||
|nvim_tree.config.filesystem_watchers| processing,
|
||||
verbose.
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
Config: Default *nvim-tree-config-default*
|
||||
|
||||
@@ -2273,8 +2231,6 @@ Following is the default configuration, see |nvim_tree.config| for details. >lua
|
||||
}
|
||||
<
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
API *nvim-tree-api*
|
||||
|
||||
@@ -2354,8 +2310,6 @@ e.g. the following are functionally identical: >lua
|
||||
• {dir}? (`table<"direct"|"indirect", nvim_tree.git.XY[]>`) direct
|
||||
inclusive-or indirect status
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
API: appearance *nvim-tree-api-appearance*
|
||||
|
||||
@@ -2811,6 +2765,13 @@ navigate.sibling.prev({node})
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) directory or file
|
||||
|
||||
open.drop({node}) *nvim_tree.api.node.open.drop()*
|
||||
Switch to window with selected file if it exists, otherwise open, see
|
||||
|:drop|
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) directory or file
|
||||
|
||||
open.edit({node}, {opts}) *nvim_tree.api.node.open.edit()*
|
||||
• file: open as per |nvim_tree.config.actions.open_file|
|
||||
• directory: expand or collapse
|
||||
@@ -2824,39 +2785,64 @@ open.edit({node}, {opts}) *nvim_tree.api.node.open.edit()*
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
open.horizontal({node}) *nvim_tree.api.node.open.horizontal()*
|
||||
open.horizontal({node}, {opts}) *nvim_tree.api.node.open.horizontal()*
|
||||
Open file in a new horizontal split.
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) file
|
||||
• {opts} (`table?`) optional
|
||||
• {quit_on_open}? (`boolean`, default: false) Quits the tree
|
||||
when opening the file.
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
*nvim_tree.api.node.open.horizontal_no_picker()*
|
||||
open.horizontal_no_picker({node})
|
||||
open.horizontal_no_picker({node}, {opts})
|
||||
Open file in a new horizontal split without using the window picker.
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) file
|
||||
• {opts} (`table?`) optional
|
||||
• {quit_on_open}? (`boolean`, default: false) Quits the tree
|
||||
when opening the file.
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
*nvim_tree.api.node.open.no_window_picker()*
|
||||
open.no_window_picker({node})
|
||||
open.no_window_picker({node}, {opts})
|
||||
Open file without using the window picker.
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) file
|
||||
• {opts} (`table?`) optional
|
||||
• {quit_on_open}? (`boolean`, default: false) Quits the tree
|
||||
when opening the file.
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
open.preview({node}) *nvim_tree.api.node.open.preview()*
|
||||
open.preview({node}, {opts}) *nvim_tree.api.node.open.preview()*
|
||||
Open file with |'bufhidden'| set to `delete`.
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) directory or file
|
||||
• {opts} (`table?`) optional
|
||||
• {quit_on_open}? (`boolean`, default: false) Quits the tree
|
||||
when opening the file.
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
*nvim_tree.api.node.open.preview_no_picker()*
|
||||
open.preview_no_picker({node})
|
||||
open.preview_no_picker({node}, {opts})
|
||||
Open file with |'bufhidden'| set to `delete` without using the window
|
||||
picker.
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) directory or file
|
||||
• {opts} (`table?`) optional
|
||||
• {quit_on_open}? (`boolean`, default: false) Quits the tree
|
||||
when opening the file.
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
*nvim_tree.api.node.open.replace_tree_buffer()*
|
||||
open.replace_tree_buffer({node})
|
||||
@@ -2865,15 +2851,20 @@ open.replace_tree_buffer({node})
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) file
|
||||
|
||||
open.tab({node}) *nvim_tree.api.node.open.tab()*
|
||||
open.tab({node}, {opts}) *nvim_tree.api.node.open.tab()*
|
||||
Open file in a new tab.
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) directory or file
|
||||
• {opts} (`table?`) optional
|
||||
• {quit_on_open}? (`boolean`, default: false) Quits the tree
|
||||
when opening the file.
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
open.tab_drop({node}) *nvim_tree.api.node.open.tab_drop()*
|
||||
Switch to tab containing window with selected file if it exists. Open file
|
||||
in new tab otherwise.
|
||||
Switch to tab containing window with selected file if it exists, otherwise
|
||||
open in new tab, see |:drop|
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) directory or file
|
||||
@@ -2886,18 +2877,28 @@ open.toggle_group_empty({node})
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) directory
|
||||
|
||||
open.vertical({node}) *nvim_tree.api.node.open.vertical()*
|
||||
open.vertical({node}, {opts}) *nvim_tree.api.node.open.vertical()*
|
||||
Open file in a new vertical split.
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) file
|
||||
• {opts} (`table?`) optional
|
||||
• {quit_on_open}? (`boolean`, default: false) Quits the tree
|
||||
when opening the file.
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
*nvim_tree.api.node.open.vertical_no_picker()*
|
||||
open.vertical_no_picker({node})
|
||||
open.vertical_no_picker({node}, {opts})
|
||||
Open file in a new vertical split without using the window picker.
|
||||
|
||||
Parameters: ~
|
||||
• {node} (`nvim_tree.api.Node?`) file
|
||||
• {opts} (`table?`) optional
|
||||
• {quit_on_open}? (`boolean`, default: false) Quits the tree
|
||||
when opening the file.
|
||||
• {focus}? (`boolean`, default: false) Keep focus in the tree
|
||||
when opening the file.
|
||||
|
||||
run.cmd({node}) *nvim_tree.api.node.run.cmd()*
|
||||
Enter |cmdline| with the full path of the node and the cursor at the start
|
||||
@@ -3466,6 +3467,4 @@ Contents of `my-decorator.lua`: >lua
|
||||
return MyDecorator
|
||||
<
|
||||
|
||||
|
||||
|
||||
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
|
||||
|
||||
@@ -16,6 +16,12 @@ nvim_tree.api.node.open = {}
|
||||
---@field focus? boolean
|
||||
|
||||
|
||||
---
|
||||
---Switch to window with selected file if it exists, otherwise open, see [:drop]
|
||||
---
|
||||
---@param node? nvim_tree.api.Node directory or file
|
||||
function nvim_tree.api.node.open.drop(node) end
|
||||
|
||||
---
|
||||
---- file: open as per [nvim_tree.config.actions.open_file]
|
||||
---- directory: expand or collapse
|
||||
@@ -29,31 +35,36 @@ function nvim_tree.api.node.open.edit(node, opts) end
|
||||
---Open file in a new horizontal split.
|
||||
---
|
||||
---@param node? nvim_tree.api.Node file
|
||||
function nvim_tree.api.node.open.horizontal(node) end
|
||||
---@param opts? nvim_tree.api.node.open.Opts optional
|
||||
function nvim_tree.api.node.open.horizontal(node, opts) end
|
||||
|
||||
---
|
||||
---Open file in a new horizontal split without using the window picker.
|
||||
---
|
||||
---@param node? nvim_tree.api.Node file
|
||||
function nvim_tree.api.node.open.horizontal_no_picker(node) end
|
||||
---@param opts? nvim_tree.api.node.open.Opts optional
|
||||
function nvim_tree.api.node.open.horizontal_no_picker(node, opts) end
|
||||
|
||||
---
|
||||
---Open file without using the window picker.
|
||||
---
|
||||
---@param node? nvim_tree.api.Node file
|
||||
function nvim_tree.api.node.open.no_window_picker(node) end
|
||||
---@param opts? nvim_tree.api.node.open.Opts optional
|
||||
function nvim_tree.api.node.open.no_window_picker(node, opts) end
|
||||
|
||||
---
|
||||
---Open file with ['bufhidden'] set to `delete`.
|
||||
---
|
||||
---@param node? nvim_tree.api.Node directory or file
|
||||
function nvim_tree.api.node.open.preview(node) end
|
||||
---@param opts? nvim_tree.api.node.open.Opts optional
|
||||
function nvim_tree.api.node.open.preview(node, opts) end
|
||||
|
||||
---
|
||||
---Open file with ['bufhidden'] set to `delete` without using the window picker.
|
||||
---
|
||||
---@param node? nvim_tree.api.Node directory or file
|
||||
function nvim_tree.api.node.open.preview_no_picker(node) end
|
||||
---@param opts? nvim_tree.api.node.open.Opts optional
|
||||
function nvim_tree.api.node.open.preview_no_picker(node, opts) end
|
||||
|
||||
---
|
||||
---Open file in place: in the nvim-tree window.
|
||||
@@ -65,10 +76,11 @@ function nvim_tree.api.node.open.replace_tree_buffer(node) end
|
||||
---Open file in a new tab.
|
||||
---
|
||||
---@param node? nvim_tree.api.Node directory or file
|
||||
function nvim_tree.api.node.open.tab(node) end
|
||||
---@param opts? nvim_tree.api.node.open.Opts optional
|
||||
function nvim_tree.api.node.open.tab(node, opts) end
|
||||
|
||||
---
|
||||
---Switch to tab containing window with selected file if it exists. Open file in new tab otherwise.
|
||||
---Switch to tab containing window with selected file if it exists, otherwise open in new tab, see [:drop]
|
||||
---
|
||||
---@param node? nvim_tree.api.Node directory or file
|
||||
function nvim_tree.api.node.open.tab_drop(node) end
|
||||
@@ -83,13 +95,15 @@ function nvim_tree.api.node.open.toggle_group_empty(node) end
|
||||
---Open file in a new vertical split.
|
||||
---
|
||||
---@param node? nvim_tree.api.Node file
|
||||
function nvim_tree.api.node.open.vertical(node) end
|
||||
---@param opts? nvim_tree.api.node.open.Opts optional
|
||||
function nvim_tree.api.node.open.vertical(node, opts) end
|
||||
|
||||
---
|
||||
---Open file in a new vertical split without using the window picker.
|
||||
---
|
||||
---@param node? nvim_tree.api.Node file
|
||||
function nvim_tree.api.node.open.vertical_no_picker(node) end
|
||||
---@param opts? nvim_tree.api.node.open.Opts optional
|
||||
function nvim_tree.api.node.open.vertical_no_picker(node, opts) end
|
||||
|
||||
---
|
||||
---@class nvim_tree.api.node.buffer.RemoveOpts
|
||||
|
||||
@@ -3,7 +3,7 @@ error("Cannot require a meta file")
|
||||
|
||||
|
||||
|
||||
---Filters may be applied to the tree to exlude the display of file/directories.
|
||||
---Filters may be applied to the tree to exclude the display of file/directories.
|
||||
---
|
||||
---Multiple filters may be applied at once.
|
||||
---
|
||||
|
||||
@@ -10,10 +10,6 @@ local DirectoryNode = require("nvim-tree.node.directory")
|
||||
local FileLinkNode = require("nvim-tree.node.file-link")
|
||||
local RootNode = require("nvim-tree.node.root")
|
||||
|
||||
---@class NodeEditOpts
|
||||
---@field quit_on_open boolean|nil default false
|
||||
---@field focus boolean|nil default true
|
||||
|
||||
---@alias NodeOpenFileMode ""|"change_dir"|"drop"|"edit"|"edit_in_place"|"edit_no_picker"|"preview"|"preview_no_picker"|"split"|"split_no_picker"|"tab_drop"|"tabnew"|"toggle_group_empty"|"vsplit"|"vsplit_no_picker"
|
||||
|
||||
local M = {}
|
||||
@@ -416,7 +412,7 @@ end
|
||||
|
||||
---@param mode string
|
||||
---@param node Node
|
||||
---@param edit_opts NodeEditOpts?
|
||||
---@param edit_opts nvim_tree.api.node.open.Opts?
|
||||
local function edit(mode, node, edit_opts)
|
||||
local file_link = node:as(FileLinkNode)
|
||||
local path = file_link and file_link.link_to or node.absolute_path
|
||||
@@ -432,7 +428,7 @@ local function edit(mode, node, edit_opts)
|
||||
end
|
||||
|
||||
local mode_unsupported_focus = mode == "drop" or mode == "tab_drop" or mode == "edit_in_place"
|
||||
local focus = edit_opts.focus == nil or edit_opts.focus == true
|
||||
local focus = edit_opts.focus == nil or edit_opts.focus == false
|
||||
if not mode_unsupported_focus and not focus then
|
||||
-- if mode == "tabnew" a new tab will be opened and we need to focus back to the previous tab
|
||||
if mode == "tabnew" then
|
||||
@@ -445,7 +441,7 @@ end
|
||||
---@param node Node
|
||||
---@param mode NodeOpenFileMode
|
||||
---@param toggle_group boolean?
|
||||
---@param edit_opts NodeEditOpts?
|
||||
---@param edit_opts nvim_tree.api.node.open.Opts?
|
||||
local function open_or_expand_or_dir_up(node, mode, toggle_group, edit_opts)
|
||||
local root = node:as(RootNode)
|
||||
local dir = node:as(DirectoryNode)
|
||||
@@ -468,18 +464,21 @@ function M.toggle_group_empty(node)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.preview(node)
|
||||
open_or_expand_or_dir_up(node, "preview")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.preview(node, opts)
|
||||
open_or_expand_or_dir_up(node, "preview", false, opts)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.preview_no_picker(node)
|
||||
open_or_expand_or_dir_up(node, "preview_no_picker")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.preview_no_picker(node, opts)
|
||||
open_or_expand_or_dir_up(node, "preview_no_picker", false, opts)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.edit(node)
|
||||
open_or_expand_or_dir_up(node, "edit")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.edit(node, opts)
|
||||
open_or_expand_or_dir_up(node, "edit", false, opts)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
@@ -498,33 +497,39 @@ function M.replace_tree_buffer(node)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.no_window_picker(node)
|
||||
open_or_expand_or_dir_up(node, "edit_no_picker")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.no_window_picker(node, opts)
|
||||
open_or_expand_or_dir_up(node, "edit_no_picker", false, opts)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.vertical(node)
|
||||
open_or_expand_or_dir_up(node, "vsplit")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.vertical(node, opts)
|
||||
open_or_expand_or_dir_up(node, "vsplit", false, opts)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.vertical_no_picker(node)
|
||||
open_or_expand_or_dir_up(node, "vsplit_no_picker")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.vertical_no_picker(node, opts)
|
||||
open_or_expand_or_dir_up(node, "vsplit_no_picker", false, opts)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.horizontal(node)
|
||||
open_or_expand_or_dir_up(node, "split")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.horizontal(node, opts)
|
||||
open_or_expand_or_dir_up(node, "split", false, opts)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.horizontal_no_picker(node)
|
||||
open_or_expand_or_dir_up(node, "split_no_picker")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.horizontal_no_picker(node, opts)
|
||||
open_or_expand_or_dir_up(node, "split_no_picker", false, opts)
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
function M.tab(node)
|
||||
open_or_expand_or_dir_up(node, "tabnew")
|
||||
---@param opts nvim_tree.api.node.open.Opts?
|
||||
function M.tab(node, opts)
|
||||
open_or_expand_or_dir_up(node, "tabnew", false, opts)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -136,6 +136,11 @@ end
|
||||
---Called explicitly after nvim-tree setup
|
||||
---@param api table not properly typed to prevent LSP from referencing implementations
|
||||
function M.hydrate_post_setup(api)
|
||||
-- Parameter naming conventions:
|
||||
-- `e` explorer
|
||||
-- `n` node
|
||||
-- `o` opts
|
||||
|
||||
api.config.global = __(function() return require("nvim-tree.config").g_clone() end)
|
||||
api.config.user = __(function() return require("nvim-tree.config").u_clone() end)
|
||||
|
||||
@@ -182,10 +187,10 @@ function M.hydrate_post_setup(api)
|
||||
api.marks.navigate.select = e_(function(e) e.marks:navigate_select() end)
|
||||
api.marks.toggle = ev(function(e, n) e.marks:toggle(n) end)
|
||||
|
||||
api.node.buffer.delete = _n(function(n, opts) require("nvim-tree.actions.node.buffer").delete(n, opts) end)
|
||||
api.node.buffer.wipe = _n(function(n, opts) require("nvim-tree.actions.node.buffer").wipe(n, opts) end)
|
||||
api.node.collapse = _n(function(n, opts) require("nvim-tree.actions.tree.collapse").node(n, opts) end)
|
||||
api.node.expand = en(function(e, n, opts) e:expand_node(n, opts) end)
|
||||
api.node.buffer.delete = _n(function(n, o) require("nvim-tree.actions.node.buffer").delete(n, o) end)
|
||||
api.node.buffer.wipe = _n(function(n, o) require("nvim-tree.actions.node.buffer").wipe(n, o) end)
|
||||
api.node.collapse = _n(function(n, o) require("nvim-tree.actions.tree.collapse").node(n, o) end)
|
||||
api.node.expand = en(function(e, n, o) e:expand_node(n, o) end)
|
||||
api.node.navigate.diagnostics.next = __(function() require("nvim-tree.actions.moves.item").diagnostics_next() end)
|
||||
api.node.navigate.diagnostics.next_recursive = __(function() require("nvim-tree.actions.moves.item").diagnostics_next_recursive() end)
|
||||
api.node.navigate.diagnostics.prev = __(function() require("nvim-tree.actions.moves.item").diagnostics_prev() end)
|
||||
@@ -205,18 +210,21 @@ function M.hydrate_post_setup(api)
|
||||
api.node.navigate.sibling.next = _n(function(n) require("nvim-tree.actions.moves.sibling").next(n) end)
|
||||
api.node.navigate.sibling.prev = _n(function(n) require("nvim-tree.actions.moves.sibling").prev(n) end)
|
||||
api.node.open.drop = _n(function(n) require("nvim-tree.actions.node.open-file").drop(n) end)
|
||||
api.node.open.edit = _n(function(n) require("nvim-tree.actions.node.open-file").edit(n) end)
|
||||
api.node.open.horizontal = _n(function(n) require("nvim-tree.actions.node.open-file").horizontal(n) end)
|
||||
api.node.open.horizontal_no_picker = _n(function(n) require("nvim-tree.actions.node.open-file").horizontal_no_picker(n) end)
|
||||
api.node.open.no_window_picker = _n(function(n) require("nvim-tree.actions.node.open-file").no_window_picker(n) end)
|
||||
api.node.open.preview = _n(function(n) require("nvim-tree.actions.node.open-file").preview(n) end)
|
||||
api.node.open.preview_no_picker = _n(function(n) require("nvim-tree.actions.node.open-file").preview_no_picker(n) end)
|
||||
api.node.open.edit = _n(function(n, o) require("nvim-tree.actions.node.open-file").edit(n, o) end)
|
||||
api.node.open.horizontal = _n(function(n, o) require("nvim-tree.actions.node.open-file").horizontal(n, o) end)
|
||||
api.node.open.horizontal_no_picker = _n(function(n, o)
|
||||
require("nvim-tree.actions.node.open-file").horizontal_no_picker(n,
|
||||
o)
|
||||
end)
|
||||
api.node.open.no_window_picker = _n(function(n, o) require("nvim-tree.actions.node.open-file").no_window_picker(n, o) end)
|
||||
api.node.open.preview = _n(function(n, o) require("nvim-tree.actions.node.open-file").preview(n, o) end)
|
||||
api.node.open.preview_no_picker = _n(function(n, o) require("nvim-tree.actions.node.open-file").preview_no_picker(n, o) end)
|
||||
api.node.open.replace_tree_buffer = _n(function(n) require("nvim-tree.actions.node.open-file").replace_tree_buffer(n) end)
|
||||
api.node.open.tab = _n(function(n) require("nvim-tree.actions.node.open-file").tab(n) end)
|
||||
api.node.open.tab = _n(function(n, o) require("nvim-tree.actions.node.open-file").tab(n, o) end)
|
||||
api.node.open.tab_drop = _n(function(n) require("nvim-tree.actions.node.open-file").tab_drop(n) end)
|
||||
api.node.open.toggle_group_empty = _n(function(n) require("nvim-tree.actions.node.open-file").toggle_group_empty(n) end)
|
||||
api.node.open.vertical = _n(function(n) require("nvim-tree.actions.node.open-file").vertical(n) end)
|
||||
api.node.open.vertical_no_picker = _n(function(n) require("nvim-tree.actions.node.open-file").vertical_no_picker(n) end)
|
||||
api.node.open.vertical = _n(function(n, o) require("nvim-tree.actions.node.open-file").vertical(n, o) end)
|
||||
api.node.open.vertical_no_picker = _n(function(n, o) require("nvim-tree.actions.node.open-file").vertical_no_picker(n, o) end)
|
||||
api.node.run.cmd = _n(function(n) require("nvim-tree.actions.node.run-command").run_file_command(n) end)
|
||||
api.node.run.system = _n(function(n) require("nvim-tree.actions.node.system-open").fn(n) end)
|
||||
api.node.show_info_popup = _n(function(n) require("nvim-tree.actions.node.file-popup").toggle_file_info(n) end)
|
||||
@@ -227,22 +235,22 @@ function M.hydrate_post_setup(api)
|
||||
api.tree.close = __(function() require("nvim-tree.view").close() end)
|
||||
api.tree.close_in_all_tabs = __(function() require("nvim-tree.view").close_all_tabs() end)
|
||||
api.tree.close_in_this_tab = __(function() require("nvim-tree.view").close_this_tab_only() end)
|
||||
api.tree.collapse_all = __(function(opts) require("nvim-tree.actions.tree.collapse").all(opts) end)
|
||||
api.tree.expand_all = en(function(e, n, opts) e:expand_all(n, opts) end)
|
||||
api.tree.find_file = __(function(opts) require("nvim-tree.actions.tree.find-file").fn(opts) end)
|
||||
api.tree.focus = __(function(opts) require("nvim-tree.actions.tree.open").fn(opts) end)
|
||||
api.tree.collapse_all = __(function(o) require("nvim-tree.actions.tree.collapse").all(o) end)
|
||||
api.tree.expand_all = en(function(e, n, o) e:expand_all(n, o) end)
|
||||
api.tree.find_file = __(function(o) require("nvim-tree.actions.tree.find-file").fn(o) end)
|
||||
api.tree.focus = __(function(o) require("nvim-tree.actions.tree.open").fn(o) end)
|
||||
api.tree.get_node_under_cursor = en(function(e) return e:get_node_at_cursor() end)
|
||||
api.tree.get_nodes = en(function(e) return e:get_nodes() end)
|
||||
api.tree.is_tree_buf = __(function(bufnr) return require("nvim-tree.utils").is_nvim_tree_buf(bufnr) end)
|
||||
api.tree.is_visible = __(function(opts) return require("nvim-tree.view").is_visible(opts) end)
|
||||
api.tree.open = __(function(opts) require("nvim-tree.actions.tree.open").fn(opts) end)
|
||||
api.tree.is_visible = __(function(o) return require("nvim-tree.view").is_visible(o) end)
|
||||
api.tree.open = __(function(o) require("nvim-tree.actions.tree.open").fn(o) end)
|
||||
api.tree.reload = e_(function(e) e:reload_explorer() end)
|
||||
api.tree.reload_git = e_(function(e) e:reload_git() end)
|
||||
api.tree.resize = __(function(opts) require("nvim-tree.actions.tree.resize").fn(opts) end)
|
||||
api.tree.resize = __(function(o) require("nvim-tree.actions.tree.resize").fn(o) end)
|
||||
api.tree.search_node = __(function() require("nvim-tree.actions.finders.search-node").fn() end)
|
||||
api.tree.toggle = __(function(opts) require("nvim-tree.actions.tree.toggle").fn(opts) end)
|
||||
api.tree.toggle = __(function(o) require("nvim-tree.actions.tree.toggle").fn(o) end)
|
||||
api.tree.toggle_help = __(function() require("nvim-tree.help").toggle() end)
|
||||
api.tree.winid = __(function(opts) return require("nvim-tree.view").winid(opts) end)
|
||||
api.tree.winid = __(function(o) return require("nvim-tree.view").winid(o) end)
|
||||
|
||||
-- Map all legacy functions to implementations
|
||||
require("nvim-tree.legacy").map_api(api)
|
||||
|
||||
@@ -181,15 +181,30 @@ function Explorer:create_autocmds()
|
||||
end
|
||||
|
||||
if self.opts.modified.enable then
|
||||
vim.api.nvim_create_autocmd({ "BufModifiedSet", "BufWritePost" }, {
|
||||
group = self.augroup_id,
|
||||
callback = function()
|
||||
utils.debounce("Buf:modified_" .. self.uid_explorer, self.opts.view.debounce_delay, function()
|
||||
buffers.reload_modified()
|
||||
self.renderer:draw()
|
||||
end)
|
||||
end,
|
||||
})
|
||||
local function on_modified_or_buf_write()
|
||||
utils.debounce("Buf:modified_" .. self.uid_explorer, self.opts.view.debounce_delay, function()
|
||||
buffers.reload_modified()
|
||||
self.renderer:draw()
|
||||
end)
|
||||
end
|
||||
|
||||
if vim.fn.has("nvim-0.13") == 1 then
|
||||
vim.api.nvim_create_autocmd({ "OptionSet", }, {
|
||||
group = self.augroup_id,
|
||||
pattern = "modified",
|
||||
callback = on_modified_or_buf_write,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
group = self.augroup_id,
|
||||
callback = on_modified_or_buf_write,
|
||||
})
|
||||
else
|
||||
-- BufModifiedSet event was removed in 0.13: it was a specific case of OptionSet
|
||||
vim.api.nvim_create_autocmd({ "BufModifiedSet", "BufWritePost" }, { ---@diagnostic disable-line: assign-type-mismatch
|
||||
group = self.augroup_id,
|
||||
callback = on_modified_or_buf_write,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ function M.show()
|
||||
height = 1,
|
||||
noautocmd = true,
|
||||
style = "minimal",
|
||||
zindex = 40,
|
||||
border = "none"
|
||||
})
|
||||
vim.wo[M.popup_win].winhl = view_state.Active.winopts.winhl
|
||||
|
||||
@@ -1,26 +1,17 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Wrapper around Nvim make targets:
|
||||
# Wrapper around Nvim make doc target:
|
||||
#
|
||||
# make doc - gen_vimdoc.lua
|
||||
# Generates doc/nvim-tree-lua.txt
|
||||
# Uses nvim-tree sources defined in scripts/vimdoc_config.lua
|
||||
# Shims above into src/gen/gen_vimdoc.lua, replacing Nvim's config.
|
||||
#
|
||||
# make lintdoc - lintdoc.lua
|
||||
# Validates doc/nvim-tree-lua.txt
|
||||
# Desired:
|
||||
# - tags valid
|
||||
# - links valid
|
||||
# Also:
|
||||
# - brand spelling, notably Nvim and Lua
|
||||
# Generates doc/nvim-tree-lua.txt
|
||||
# Uses nvim-tree sources defined in scripts/vimdoc_config.lua
|
||||
# Shims above into src/gen/gen_vimdoc.lua, replacing Nvim's config.
|
||||
#
|
||||
# There are some hardcoded expectations which we work around as commented.
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# -ne 1 ] || [ "${1}" != "doc" ] && [ "${1}" != "lintdoc" ]; then
|
||||
echo "usage: ${0} <doc|lintdoc>" 1>&2
|
||||
if [ $# -ne 1 ] || [ "${1}" != "doc" ]; then
|
||||
echo "usage: ${0} <doc>" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -38,7 +29,7 @@ fi
|
||||
if [ ! -d "${DIR_NVIM_SRC}" ]; then
|
||||
cat << EOM
|
||||
|
||||
Nvim source v0.11+ is required to run ${0}
|
||||
Nvim stable source is required to run ${0}
|
||||
|
||||
Unavailable: ${DIR_NVIM_SRC_DEF} or \$DIR_NVIM_SRC=${DIR_NVIM_SRC}
|
||||
|
||||
@@ -84,7 +75,15 @@ if [ "${1}" = "doc" ]; then
|
||||
|
||||
# modify gen_vimdoc.lua to use our config, backing up original
|
||||
cp "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua" "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua.org"
|
||||
sed -i -E 's/spairs\(config\)/spairs\(require("gen.vimdoc_config")\)/g' "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua"
|
||||
sed -i -E '
|
||||
|
||||
# use our config
|
||||
s/spairs\(config\)/spairs\(require("gen.vimdoc_config") --[[injected by nvim-tree]]\)/g ;
|
||||
|
||||
# remove the name linter
|
||||
s/(^run\(\)$)/\n--injected by nvim-tree\nlint.lint_names = function\(\)\nend\n\n\1 --/g
|
||||
|
||||
' "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua"
|
||||
|
||||
# leave a generic placeholder to bridge between nvim.gen_vimdoc.Config
|
||||
echo "---@brief placeholder" > "${DIR_NVIM_SRC}/runtime/lua/placeholder.lua"
|
||||
|
||||
Reference in New Issue
Block a user