From b67a773609e0d6995c49cf513974f7a4c7202641 Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Mon, 20 Nov 2023 01:21:56 +0100 Subject: [PATCH 1/5] docs: update quick start example (#2540) update sort configuration key --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 077afd9b..87a16d63 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,9 @@ require("nvim-tree").setup() -- OR setup with some options require("nvim-tree").setup({ - sort_by = "case_sensitive", + sort = { + sorter = "case_sensitive", + }, view = { width = 30, }, From fb892973477e131042d737c9fc822c7c2ace5076 Mon Sep 17 00:00:00 2001 From: Azad <49314270+Akmadan23@users.noreply.github.com> Date: Mon, 20 Nov 2023 11:43:35 +0100 Subject: [PATCH 2/5] fix(#2468): always apply filters to subdirectories (#2537) Co-authored-by: Alexander Courtis --- lua/nvim-tree/actions/reloaders/reloaders.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree/actions/reloaders/reloaders.lua b/lua/nvim-tree/actions/reloaders/reloaders.lua index ffa7d073..1292715c 100644 --- a/lua/nvim-tree/actions/reloaders/reloaders.lua +++ b/lua/nvim-tree/actions/reloaders/reloaders.lua @@ -11,7 +11,7 @@ local M = {} local function refresh_nodes(node, projects, unloaded_bufnr) Iterator.builder({ node }) :applier(function(n) - if n.open and n.nodes then + if n.nodes then local toplevel = git.get_toplevel(n.cwd or n.link_to or n.absolute_path) explorer_module.reload(n, projects[toplevel] or {}, unloaded_bufnr) end From 28cf0cd67868ebfc520e9e3ffd1ad18cf57d7d68 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Tue, 21 Nov 2023 10:43:31 +1100 Subject: [PATCH 3/5] ci: pin versions, use luarocks for luacheck (#2543) Co-authored-by: Azad <49314270+Akmadan23@users.noreply.github.com> --- .github/workflows/ci.yml | 47 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fe44e9a..e0aee388 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,28 +8,35 @@ on: branches: - master -jobs: - luacheck: - name: luacheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 +permissions: + contents: read - - name: Prepare - run: | - sudo apt-get update - sudo add-apt-repository universe - sudo apt install luarocks -y - sudo luarocks install luacheck - - name: Run luacheck - run: luacheck . - stylua: - name: stylua +jobs: + lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: JohnnyMorganz/stylua-action@v3 + - uses: actions/checkout@v3 + + - uses: leafo/gh-actions-lua@v10 + with: + luaVersion: "5.1" + + - uses: leafo/gh-actions-luarocks@v4 + + - name: luacheck + run: | + luarocks install luacheck 1.1.1 + luacheck lua + + style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: stylua + uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - version: latest - args: --color always --check lua/ + version: "0.19" + args: --check lua + From 8c534822a7d16c83cf69928c53e1d8a13bd2734a Mon Sep 17 00:00:00 2001 From: John Hui <11800204+j-hui@users.noreply.github.com> Date: Tue, 21 Nov 2023 00:04:43 -0500 Subject: [PATCH 4/5] feat(#2544): add api.tree.winid (#2545) * feat(#2544): add API for querying win ID, api.tree.winid() * Document winid() opts Co-authored-by: Alexander Courtis * Fix winid() docs Co-authored-by: Alexander Courtis * Handle case where tabpage = 0 --------- Co-authored-by: Alexander Courtis --- doc/nvim-tree-lua.txt | 12 ++++++++++++ lua/nvim-tree/api.lua | 5 +++++ lua/nvim-tree/view.lua | 15 +++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 9633d9e9..691611fd 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -1698,6 +1698,18 @@ tree.is_visible({opts}) *nvim-tree-api.tree.is_visible()* Return: ~ (boolean) nvim-tree is visible +tree.winid({opts}) *nvim-tree-api.tree.winid()* + Retrieve the winid of the open tree. + + Parameters: ~ + • {opts} (table) optional parameters + + Options: ~ + • {tabpage} (number|nil) tabpage, 0 or nil for current, default nil + + Return: ~ + (number) winid or nil if tree is not visible + ============================================================================== 6.2 API FILE SYSTEM *nvim-tree-api.fs* diff --git a/lua/nvim-tree/api.lua b/lua/nvim-tree/api.lua index 0b8df43f..886ff345 100644 --- a/lua/nvim-tree/api.lua +++ b/lua/nvim-tree/api.lua @@ -145,6 +145,11 @@ Api.tree.is_tree_buf = wrap(require("nvim-tree.utils").is_nvim_tree_buf) Api.tree.is_visible = wrap(require("nvim-tree.view").is_visible) +---@class ApiTreeWinIdOpts +---@field tabpage number|nil default nil + +Api.tree.winid = wrap(require("nvim-tree.view").winid) + Api.fs.create = wrap_node_or_nil(require("nvim-tree.actions.fs.create-file").fn) Api.fs.remove = wrap_node(require("nvim-tree.actions.fs.remove-file").fn) Api.fs.trash = wrap_node(require("nvim-tree.actions.fs.trash").fn) diff --git a/lua/nvim-tree/view.lua b/lua/nvim-tree/view.lua index 2b54df6a..c6dc4ef1 100644 --- a/lua/nvim-tree/view.lua +++ b/lua/nvim-tree/view.lua @@ -427,6 +427,21 @@ function M.focus(winnr, open_if_closed) vim.api.nvim_set_current_win(wnr) end +--- Retrieve the winid of the open tree. +--- @param opts ApiTreeWinIdOpts|nil +--- @return number|nil winid unlike get_winnr(), this returns nil if the nvim-tree window is not visible +function M.winid(opts) + local tabpage = opts and opts.tabpage + if tabpage == 0 then + tabpage = vim.api.nvim_get_current_tabpage() + end + if M.is_visible { tabpage = tabpage } then + return M.get_winnr(tabpage) + else + return nil + end +end + --- Restores the state of a NvimTree window if it was initialized before. function M.restore_tab_state() local tabpage = vim.api.nvim_get_current_tabpage() From fa00b57873008700a83c1387f02ef2c6fc183b53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Nov 2023 08:29:23 +0000 Subject: [PATCH 5/5] chore(deps): bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0aee388..4f7e8b27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: leafo/gh-actions-lua@v10 with: @@ -31,7 +31,7 @@ jobs: style: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: stylua uses: JohnnyMorganz/stylua-action@v3