File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
local a = vim .api
2
2
local lib = function () return require ' nvim-tree.lib' end
3
+ local utils = require ' nvim-tree.utils'
3
4
4
5
local M = {
5
6
current_tab = a .nvim_get_current_tabpage (),
@@ -9,7 +10,7 @@ local M = {
9
10
}
10
11
11
12
function M .fn (name )
12
- local foldername = name == ' ..' and vim .fn .fnamemodify (TreeExplorer .cwd , ' :h' ) or name
13
+ local foldername = name == ' ..' and vim .fn .fnamemodify (utils . path_remove_trailing ( TreeExplorer .cwd ) , ' :h' ) or name
13
14
local no_cwd_change = vim .fn .expand (foldername ) == TreeExplorer .cwd
14
15
local new_tab = a .nvim_get_current_tabpage ()
15
16
local is_window = vim .v .event .scope == " window" and new_tab == M .current_tab
Original file line number Diff line number Diff line change
1
+ local utils = require ' nvim-tree.utils'
2
+
1
3
local M = {}
2
4
3
5
function M .fn (node )
4
6
if not node or node .name == " .." then
5
7
return require ' nvim-tree.actions.change-dir' .fn (' ..' )
6
8
else
7
- local newdir = vim .fn .fnamemodify (TreeExplorer .cwd , ' :h' )
9
+ local newdir = vim .fn .fnamemodify (utils . path_remove_trailing ( TreeExplorer .cwd ) , ' :h' )
8
10
require ' nvim-tree.actions.change-dir' .fn (newdir )
9
11
return require " nvim-tree.actions.find-file" .fn (node .absolute_path )
10
12
end
Original file line number Diff line number Diff line change 29
29
30
30
local path_separator = package.config :sub (1 ,1 )
31
31
function M .path_join (paths )
32
- return table.concat (paths , path_separator )
32
+ return table.concat (vim . tbl_map ( M . path_remove_trailing , paths ) , path_separator )
33
33
end
34
34
35
35
function M .path_split (path )
You can’t perform that action at this time.
0 commit comments