Merge pull request #60 from kyazdani42/fix/open-tree-on-find
open tree on find
This commit is contained in:
@@ -124,10 +124,13 @@ local function is_file_readable(fname)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.find_file()
|
function M.find_file(with_open)
|
||||||
local bufname = api.nvim_buf_get_name(api.nvim_get_current_buf())
|
local bufname = api.nvim_buf_get_name(api.nvim_get_current_buf())
|
||||||
if not is_file_readable(bufname) then return end
|
if not is_file_readable(bufname) then return end
|
||||||
|
|
||||||
|
if with_open then
|
||||||
|
M.open()
|
||||||
|
end
|
||||||
lib.set_index_and_redraw(bufname)
|
lib.set_index_and_redraw(bufname)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -158,7 +161,7 @@ end
|
|||||||
function M.buf_enter()
|
function M.buf_enter()
|
||||||
update_root_dir()
|
update_root_dir()
|
||||||
if vim.g.lua_tree_follow == 1 then
|
if vim.g.lua_tree_follow == 1 then
|
||||||
M.find_file()
|
M.find_file(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ command! LuaTreeClose lua require'tree'.close()
|
|||||||
command! LuaTreeToggle lua require'tree'.toggle()
|
command! LuaTreeToggle lua require'tree'.toggle()
|
||||||
command! LuaTreeRefresh lua require'tree'.refresh()
|
command! LuaTreeRefresh lua require'tree'.refresh()
|
||||||
command! LuaTreeClipboard lua require'tree'.print_clipboard()
|
command! LuaTreeClipboard lua require'tree'.print_clipboard()
|
||||||
command! LuaTreeFindFile lua require'tree'.find_file()
|
command! LuaTreeFindFile lua require'tree'.find_file(true)
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|||||||
Reference in New Issue
Block a user