Merge pull request #60 from kyazdani42/fix/open-tree-on-find

open tree on find
This commit is contained in:
Kiyan Yazdani 2020-07-23 11:17:21 +02:00 committed by GitHub
commit 8f49843a3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -124,10 +124,13 @@ local function is_file_readable(fname)
return true
end
function M.find_file()
function M.find_file(with_open)
local bufname = api.nvim_buf_get_name(api.nvim_get_current_buf())
if not is_file_readable(bufname) then return end
if with_open then
M.open()
end
lib.set_index_and_redraw(bufname)
end
@ -158,7 +161,7 @@ end
function M.buf_enter()
update_root_dir()
if vim.g.lua_tree_follow == 1 then
M.find_file()
M.find_file(false)
end
end

View File

@ -23,7 +23,7 @@ command! LuaTreeClose lua require'tree'.close()
command! LuaTreeToggle lua require'tree'.toggle()
command! LuaTreeRefresh lua require'tree'.refresh()
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
unlet s:save_cpo