File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -69,19 +69,10 @@ nnoremap <leader>n :LuaTreeFindFile<CR>
69
69
## TODO
70
70
71
71
### Perf / Fixes
72
- - Tree creation should be async
72
+ - Tree creation could be async
73
73
- refactor all ` system ` call to ` libuv ` functions, with better error management
74
- - bufferize leafs of node being closed so when opening again the node, we open every directory that was previously open
75
74
76
75
### Features
77
- - sneak like cd command to find a file/directory
78
- - better default colors (use default vim groups)
76
+ - better default colors (use vim highlight groups)
79
77
- create proper highlight groups or add highlight function to give the user ability to setup colors themselves
80
-
81
- ### Window Feature / Fixes
82
- - opening help should open on the bottom
83
- - better window management:
84
- - check tree buffer/window for change so we can avoid it being resized or moved around or replaced by another file
85
- - monitor window layout in current tab to open files in the right place
86
- > this might be a little hard to implement since window layout events do not exist yet
87
-
78
+ - bufferize leafs of node being closed so when opening again the node, we open every directory that was previously open
Original file line number Diff line number Diff line change @@ -53,6 +53,17 @@ if api.nvim_call_function('exists', { 'g:lua_tree_side' }) == 1 then
53
53
end
54
54
end
55
55
56
+ local function create_new_buf (open_type , bufname )
57
+ if open_type == ' edit' or open_type == ' split' then
58
+ api .nvim_command (' wincmd ' .. MOVE_TO .. ' | ' .. open_type .. ' ' .. bufname )
59
+ elseif open_type == ' vsplit' then
60
+ local windows = api .nvim_list_wins ();
61
+ api .nvim_command (# windows .. ' wincmd ' .. MOVE_TO .. ' | vsplit ' .. bufname )
62
+ elseif open_type == ' tabnew' then
63
+ api .nvim_command (' tabnew ' .. bufname )
64
+ end
65
+ end
66
+
56
67
local function open_file (open_type )
57
68
local tree_index = api .nvim_win_get_cursor (0 )[1 ]
58
69
local tree = get_tree ()
@@ -93,16 +104,15 @@ local function open_file(open_type)
93
104
init_tree (new_path )
94
105
update_view ()
95
106
else
96
- api . nvim_command ( ' wincmd ' .. MOVE_TO .. ' | ' .. open_type .. ' ' .. node .linkto )
107
+ create_new_buf ( open_type , node .link_to );
97
108
end
98
109
99
110
elseif node .dir == true then
100
111
if check_dir_access (node .path .. node .name ) == false then return end
101
112
open_dir (tree_index )
102
113
update_view (true )
103
-
104
114
else
105
- api . nvim_command ( ' wincmd ' .. MOVE_TO .. ' | ' .. open_type .. ' ' .. node .path .. node .name )
115
+ create_new_buf ( open_type , node .path .. node .name );
106
116
end
107
117
end
108
118
You can’t perform that action at this time.
0 commit comments