File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,15 @@ function M.check_windows_and_close()
153
153
end
154
154
end
155
155
156
+ function M .navigate_to_buffer_dir (bufname )
157
+ local new_path = get_cwd ()
158
+ if new_path ~= ' /' then
159
+ new_path = new_path .. ' /'
160
+ end
161
+ set_root_path (new_path )
162
+ init_tree ()
163
+ end
164
+
156
165
function M .check_buffer_and_open ()
157
166
local bufname = api .nvim_buf_get_name (0 )
158
167
if bufname == ' ' then
@@ -169,12 +178,7 @@ function M.check_buffer_and_open()
169
178
170
179
M .toggle ()
171
180
else
172
- local new_path = get_cwd ()
173
- if new_path ~= ' /' then
174
- new_path = new_path .. ' /'
175
- end
176
- set_root_path (new_path )
177
- init_tree ()
181
+ M .navigate_to_buffer_dir ()
178
182
end
179
183
end
180
184
Original file line number Diff line number Diff line change @@ -19,10 +19,12 @@ augroup LuaTree
19
19
au VimEnter * lua require' tree' .check_buffer_and_open ()
20
20
endif
21
21
22
+
22
23
if get (g: , ' lua_tree_follow' ) != 0
23
24
au BufEnter * :LuaTreeFindFile
24
25
endif
25
26
27
+ au BufEnter * lua require' tree' .navigate_to_buffer_dir ()
26
28
au ColorScheme * lua require' tree' .reset_highlight ()
27
29
augroup end
28
30
You can’t perform that action at this time.
0 commit comments