Files
nvim-tree.lua/lua/nvim-tree/actions/dir-up.lua
Steve Vermeulen da59247db9 Fixed some trailing slash bugs (#957)
* Fixed issue where user would have to trigger dir-up action multiple times to get it to work

* Fix to path_join to ensure the result does not have a double slash
2022-02-10 08:56:05 +01:00

16 lines
413 B
Lua

local utils = require'nvim-tree.utils'
local M = {}
function M.fn(node)
if not node or node.name == ".." then
return require'nvim-tree.actions.change-dir'.fn('..')
else
local newdir = vim.fn.fnamemodify(utils.path_remove_trailing(TreeExplorer.cwd), ':h')
require'nvim-tree.actions.change-dir'.fn(newdir)
return require"nvim-tree.actions.find-file".fn(node.absolute_path)
end
end
return M